Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

[1.12, various; patch included] Possible solution to allow slab-like forms to act as solid for placement of beds, pressure plates, etc... (related to #254)

Korynkai opened this issue ยท 0 comments

commented

Our group uses Chisels-and-Bits to create the flooring for one of our bases in order to use design methods which would otherwise be impossible. When we discovered we could not place certain objects such as beds on this flooring, initially we hadn't given it much though. However the real issue occurred when we attempted to use pressure plates for our doors, in which case we would've had to use an alternative to Chisels-and-Bits flooring in those places, though this would have obvious cosmetic consequences.

I decided to delve into the decompiled Minecraft code to see if I could find a solution based on what methods the bed and pressure plates used to determine whether they could be placed, and I discovered that if one were to additionally override the undocumented method public boolean isFullyOpaque(IBlockState) within net.minecraft.block.Block to return true within mod.chiselsandbits.chiseledblock.BlockChiseled, placement works as expected.

I suppose there may be a way to create some sort of sanity-checking conditions utilizing any relevant data provided by the passed IBlockState instance, however this would involve some sort of additional extended state mechanism utilizing unlisted properties, which I am currently not interested in implementing myself; we have our own mods and other projects we need to focus on.

We are currently using a temporary (and yet-to-be-released) fork in our modpack, with only the following small patch applied:

--- Chisels-and-Bits/src/main/java/mod/chiselsandbits/chiseledblock/BlockChiseled.java  2019-10-24 10:44:00.602478827 +0000
+++ Chisels-and-Bits-patched/src/main/java/mod/chiselsandbits/chiseledblock/BlockChiseled.java        2019-10-17 07:56:54.078986393 +0000
@@ -192,6 +192,12 @@
        }
 
        @Override
+       public boolean isFullyOpaque(final IBlockState state)
+       {
+               return true;
+       }
+
+       @Override
        public boolean isReplaceable(
                        final IBlockAccess worldIn,
                        final BlockPos pos )

Not sure if @AlgorithmX2 was intentionally avoiding this method or if this has anything to do with the patch to Forge he mentioned in #254 (also noting his retirement as per #474).

As we currently have it implemented (utilizing the above patch), this even allows beds and pressure plates (and I assume any similar objects which make use of this method to determine if placement is valid) to be placed on top of a BlockChiseled block space, even with only a single bit on the bottom of that block space (thus allowing such objects to appear hovering in midair, and pressure plates to be activated by the player walking through them) and can thus be considered somewhat "hackish". No other issues have been discovered; everything functions as otherwise expected with no other changes to the behavior of BlockChiseled to which we are aware. Redstone signals from pressure plates also work as expected.

Considering the simplicity and small stature of this change, I see no reason to make a proper fork as I have posted the small patch here, unless someone would like me to publish a proper pull request (unless, of course, someone requests a fork). However, if anyone would like to test or utilize this change without creating a workspace to only add this patch, anyone can download a patched build for 1.12 from our [semi-experimental 1.12.2 modpack project within our] GitLab here: https://git.qmx-software.com/open-source/minecraft/qmxtechmodpack/raw/server/mods/ChiselsAndBits-14.33.QMX.jar

I assure anybody interested in testing or utilizing this patched build the only other change made to this build was to the version string, to reflect version 14.33, utilizing the BUILD_NUMBER shell environmental variable to pass the build number QMX to Gradle. As stated above, I will provide a proper fork upon request. I will also create pull requests upon request, but I assume any pull requests to this repository would be ignored due to @AlgorithmX2's retirement.

This is related to #254 as a possible solution to that issue.