Everything posted by MrInfinity
-
[1.16.3] Tile Entity Won't Break
For some reason, SetRequiresTool doesn't work, but that's the code that does it
-
[1.16.3] Tile Entity Won't Break
Ok so now when I have this, and when I break it in creative the items inside drop. In survival, it still refuses to break. Any idea why? @Override public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { if (!state.isIn(newState.getBlock())) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof HopperTileEntity) { InventoryHelper.dropInventoryItems(worldIn, pos, (HopperTileEntity)tileentity); worldIn.updateComparatorOutputLevel(pos, this); } super.onReplaced(state, worldIn, pos, newState, isMoving); } } Edit: Using haste 155, or instamine, I can break it. Obviously, you can't get this normally, but it does break. This is in survival
-
[1.16.3] Tile Entity Won't Break
Found it
-
[1.16.3] Tile Entity Won't Break
Where would I find the vanilla files for a hopper or chest? I can't figure out what any of the stuff in the minecraft folder means
-
[1.16.3] Tile Entity Won't Break
I'm making a mod, and have created a hopper-like block. I used @Override to turn it into a tile entity. It all works, you can put items in it, and hoppers underneath take them out. The problem is that when I break it in creative, it breaks, but the items in it disappear. In survival, it doesn't break at all. It's make the animation, and a new one will immediately appear. Is there an Override command to stop this from happening? It's also a custom block, so it has it's own voxel shape. Here's my code: package com.mrinfinity.motionblocks.blocks; import com.mrinfinity.motionblocks.BlocksthatMoveyou; import com.mrinfinity.motionblocks.util.RegistryHandler; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.loot.LootContext; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.HopperTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.shapes.IBooleanFunction; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.common.Tags; import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.network.NetworkHooks; import javax.annotation.Nullable; import java.util.List; import java.util.stream.Stream; public class ConveyorHopper extends Block { private static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; private static final VoxelShape SHAPE_N = Stream.of( Block.makeCuboidShape(0, 10, 0, 16, 16, 16), Block.makeCuboidShape(6, 0, 6, 10, 4, 10), Block.makeCuboidShape(4, 4, 4, 12, 10, 12) ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get(); private static final VoxelShape SHAPE_E = Stream.of( Block.makeCuboidShape(0, 10, 0, 16, 16, 16), Block.makeCuboidShape(6, 0, 6, 10, 4, 10), Block.makeCuboidShape(4, 4, 4, 12, 10, 12) ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get(); private static final VoxelShape SHAPE_S = Stream.of( Block.makeCuboidShape(0, 10, 0, 16, 16, 16), Block.makeCuboidShape(6, 0, 6, 10, 4, 10), Block.makeCuboidShape(4, 4, 4, 12, 10, 12) ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get(); private static final VoxelShape SHAPE_W = Stream.of( Block.makeCuboidShape(0, 10, 0, 16, 16, 16), Block.makeCuboidShape(6, 0, 6, 10, 4, 10), Block.makeCuboidShape(4, 4, 4, 12, 10, 12) ).reduce((v1, v2) -> {return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);}).get(); public ConveyorHopper() { super(AbstractBlock.Properties.create(Material.IRON) .hardnessAndResistance(4.0f, 5.0f) .sound(SoundType.METAL) .harvestLevel(2) .harvestTool(ToolType.PICKAXE) .func_235859_g_()); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { switch (state.get(FACING)) { case EAST: return SHAPE_E; case SOUTH: return SHAPE_S; case WEST: return SHAPE_W; default: return SHAPE_N; } } @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite()); } @Override public BlockState rotate(BlockState state, Rotation rot) { return state.with(FACING, rot.rotate(state.get(FACING))); } @Override public BlockState mirror(BlockState state, Mirror mirrorIn) { return state.rotate(mirrorIn.toRotation(state.get(FACING))); } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(FACING); } @Override public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) { return 0.5f; } @Override public boolean hasTileEntity(BlockState state) { return true; } @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new HopperTileEntity(); } @Override public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult trace) { if (!world.isRemote) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof INamedContainerProvider) { NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tileEntity, tileEntity.getPos()); } else { throw new IllegalStateException("Our named container provider is missing!"); } return ActionResultType.SUCCESS; } return super.onBlockActivated(state, world, pos, player, hand, trace); } }
-
Block has texture, but the item doesn't
I got it to work by renaming blocks in textures to block, which I figured out when looking at the directories to the texture
-
Block has texture, but the item doesn't
I'm not really interested in learning how it works, just making a mod. Another thing is that in his video, it worked.
-
Block has texture, but the item doesn't
Well I'm following the tutorial to make my own mod, and it's my first time, so not really
-
Block has texture, but the item doesn't
- Block has texture, but the item doesn't
Then where do I put the code in it- Block has texture, but the item doesn't
I'm using TechnoVision's tutorial:- Block has texture, but the item doesn't
Hello, I am using IntelliJ idea to create a mod, and I'm trying to make a block, but when I load into the game, I can place it, and the placed block will have texture, but the item in my hand doesn't. I checked my directory, so I can't figure out why it's not working. Here it is, in case I missed something: - Block has texture, but the item doesn't
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.