Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

Chisel and Bits and Mod support

Raycoms opened this issue · 13 comments

commented

Hi there, I'm one of the devs of minecolonies and we want our builder to be able to build chisel and bits + we want to be able to copy paste chisel and bits structures easily.

The problems I'm running into:

Doing this here:
return new ItemStack(item, 1, getDamageValue(block, blockState));

Gives me a block which is only obtainable in creative. Is there a vanilla way to get this the right way?

Second, I'm trying to render those blocks in our render tool:

[for (final Template.BlockInfo aBlockList : blockList)
{
final IBlockState iblockstate = aBlockList.blockState;
fakeWorld.setBlockState(aBlockList.pos, iblockstate);
final Block block = iblockstate.getBlock();
TileEntity tileentity = null;
if (block.hasTileEntity(aBlockList.blockState) && aBlockList.tileentityData != null)
{
tileentity = block.createTileEntity(clientWorld, iblockstate);
tileentity.readFromNBT(aBlockList.tileentityData);
}
fakeWorld.setTileEntity(aBlockList.pos, tileentity);
}

        for (final Template.BlockInfo aBlockList : blockList)
        {
            IBlockState iblockstate = aBlockList.blockState;
            Block block = iblockstate.getBlock();
            iblockstate = aBlockList.blockState.getBlock().getActualState(aBlockList.blockState, fakeWorld, aBlockList.pos);

            if (block == ModBlocks.blockSubstitution)
            {
                continue;
            }

            if (block == ModBlocks.blockSolidSubstitution)
            {
                iblockstate = BlockUtils.getSubstitutionBlockAtWorld(clientWorld, startingPos);
                block = iblockstate.getBlock();
            }

            final BlockPos blockpos = aBlockList.pos.add(startingPos);
            final IBlockState iBlockExtendedState = block.getExtendedState(iblockstate, clientWorld, blockpos);
            final IBakedModel ibakedmodel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(iblockstate);

            final ModelHolder models = new ModelHolder(blockpos, iblockstate, iBlockExtendedState, fakeWorld.getTileEntity(aBlockList.pos), ibakedmodel);
            modelList.add(models);
        }](url)

And afterwards, I render the models. This works for all blocks - chisel and bits, hope you can help me out there.

commented

I'm quite confused by your first problem, you indicate that creating and itemstack using a item, quantity, and damage value can only be done in creative... I'm not sure what to say about that.

As for your second one its to to say for certain considering the limited scope of the code, but I imagine that your not copying the tile entity, or other problems might include layers since C&B uses all layers and it can complicate creating models from in world blocks.

commented

About the first problem, What I wanted to say is that the itemStack I get from this line of code is not obtainable by a player outside of creative.
I am searching for a way to get a result itemStack a player can easily obtain. (Like a list of bits).

About the rendering, that's how we do it, we include all layers afaik, I can't imagine what I'm leaving out.

https://github.com/Minecolonies/minecolonies/blob/version/1.11/src/main/java/com/minecolonies/structures/helpers/Structure.java

commented

The list of bits is really only visible via the creative tab, since bits are not crafted in any meaningful way outside of in world interactions. Most items in the creative tab are obtainable in game, though not all I suppose.

At a glance it looks fairly complete, i'm not sure. It looks a job for the debugger. Only odd case that comes to mind is if C&B is convinced that its using the TESR renderer, but since your constructing a new TE it should default to the normal renderer at least for one cycle, so I wouldn't think that would be the problem.

Sorry I'm not sure what else it could be.

commented
commented
commented

C&B has a full API if you want to use it, it lets you decompose the items and blocks into voxels and convert between bits, items, and states.

commented

C&B blocks as an inventory would be terrible.... since that would have 4096 slots with one bit in each one.

commented
commented

Plus I doubt anyone wants their pipes machines and hoppers to mess with their C&B Creations.

commented

Unfortunately getting any real information about a C&B Block or Item requires the API, since they are all unlisted properties or parts of the tile entities.

And using the API as an optional dep is much easier/better then trying to mess with reflection.

commented
commented

https://dvs1.progwml6.com/jenkins/job/Chisels-and-Bits/ has maven + builds, I just updated the branches, so it should hopefully push out new builds for the latest commits on each branch.

commented