Jump to content

MrInfinity

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by MrInfinity

  1. Hello, my mod keeps crashing for some reason. If you could point it out, that would be great. Here's the crash report: ---- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 11/17/20 6:53 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:499) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.util.Util.acceptOrElse(Util.java:323) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading} at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:495) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.ResourceLoadProgressGui.render(ResourceLoadProgressGui.java:113) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:492) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:979) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:589) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_265] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_265] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_265] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-7.0.1.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-7.0.1.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-7.0.1.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-7.0.1.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-7.0.1.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraftforge.registries.DeferredRegister.register(DeferredRegister.java:125) ~[?:?] {re:classloading} -- MOD blocksthatmoveyou -- Details: Caused by 0: java.lang.ExceptionInInitializerError at com.mrinfinity.motionblocks.BlocksthatMoveyou.<init>(BlocksthatMoveyou.java:22) ~[?:?] {re:classloading} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_265] {} at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_265] {} at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_265] {} at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_265] {} at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_265] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[?:34.1] {re:classloading} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:111) ~[?:?] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_265] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_265] {} Mod File: main Failure message: Conveyors (blocksthatmoveyou) has failed to load correctly java.lang.ExceptionInInitializerError: null Mod Version: 1.16.3-1.0.0 Mod Issue URL: http://my.issue.tracker/ Exception message: java.lang.IllegalArgumentException: Duplicate registration curved_belt Stacktrace: at net.minecraftforge.registries.DeferredRegister.register(DeferredRegister.java:125) ~[?:?] {re:classloading} at com.mrinfinity.motionblocks.util.RegistryHandler.<clinit>(RegistryHandler.java:36) ~[?:?] {re:classloading} at com.mrinfinity.motionblocks.BlocksthatMoveyou.<init>(BlocksthatMoveyou.java:22) ~[?:?] {re:classloading} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_265] {} at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_265] {} at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_265] {} at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_265] {} at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_265] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[?:34.1] {re:classloading} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:111) ~[?:?] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_265] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_265] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_265] {} -- System Details -- Details: Minecraft Version: 1.16.3 Minecraft Version ID: 1.16.3 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_265, AdoptOpenJDK Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), AdoptOpenJDK Memory: 723057608 bytes (689 MB) / 1004535808 bytes (958 MB) up to 1901592576 bytes (1813 MB) CPUs: 4 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 7.0.1+78+master.e9771d8 ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /mixin-0.8.2.jar mixin PLUGINSERVICE /eventbus-3.0.3-service.jar eventbus PLUGINSERVICE /forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-2.2.0-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-launcher.jar runtimedistcleaner PLUGINSERVICE /mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE /forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-launcher.jar fml TRANSFORMATIONSERVICE FML: 34.1 Forge: net.minecraftforge:34.1.10 FML Language Providers: javafml@34.1 minecraft@1 Mod List: client-extra.jar Minecraft {minecraft@1.16.3 CREATE_REGISTRIES} forge-1.16.3-34.1.10_mapped_snapshot_20200723-1.16.1-recomp.jar Forge {forge@34.1.10 CREATE_REGISTRIES} main Conveyors {blocksthatmoveyou@1.16.3-1.0.0 ERROR} Crash Report UUID: cf298b39-30a2-4b19-8ec1-d74befd941d9
  2. https://minecraft.gamepedia.com/Nether_portal#Portal_search - Under Portal Creation Here it says that a nether portal first looks for any valid locations in a 4x4 chunk radius around the center of where it would spawn. If it finds none, then it will spawn somewhere between y 90 and 10 blocks below the world limit. So if you create a nether-portal like portal, it would follow those rules, meaning that if it spawned in empty space, the floating portal would be created
  3. Well In the nether, if you spawn above lava, you spawn inside of a portal with 1 block out on both sides. You might want to use this solution. Or you could have it automatically place a block under the player when they spawn in
  4. Hello. I want to use the replaceBlock function, to change the block when it's right clicked with a certain item. I have it @Override onBlockActivated, then check the item in the player's hand. The problem I've run into i getting the other blocks state. I've tried creating a variable in the other block with this.getDefaultState, but when I use it somewhere else, I get an unclassified usage. So I made a new variable, that simply is the same as the other one, only this one is created inside the block being replace's class. However, it says that the variable in the other class needs to be static, but when I make it static, this.getDefaultState doesn't work. How would I get the other blocks state into my block? Here's my @Override code: @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (player.getHeldItemMainhand().getItem() == RegistryHandler.WRENCH.get()) { RightCurvedBelt.replaceBlock(state, NEWSTATE, worldIn, pos, getHarvestLevel(state)); } And here's the 2 variables I've tried to make public static final BlockState RSTATE = this.getDefaultState(); private static final BlockState NEWSTATE = RightCurvedBelt.RSTATE;
  5. Yes. That's what I meant. like when you throw 2 stone on the ground, they'll turn into 2 stones in the same spot
  6. What I mean is that any stacks of items won't merge on a certain block, including vanilla. non-vanilla items. Is this possible?
  7. Is there an event for Items Merging? I want to cancel it on a certain block
  8. Well, I got it to work. Thanks: if (thisFacing == Direction.WEST) { entityIn.addVelocity(0.2D, 0.01D, 0D); } BTW, I have it backwards because the FACING seems to be backwards for the blocks, west is east, and east is west. I don't really care to fix that.
  9. Okay yeah that makes sense. Thanks. I didn't think of that for some reason. How would I get the belts motion? It's a block, so it normally woul'nt have any. I can get it's direction, but I can't put that into a vector variable
  10. Where would I put that though? If I try to put it here : v.x on v, it doesn't work. Where does that go?
  11. So I have this: if (thisFacing == Direction.WEST) { Vector3d v = entityIn.getMotion(); entityIn.setVelocity(v.x * 2.0D, v.y, v.z); } It gets the right velocity, and it moves you properly, but it moves you in both directions. I want it to only move you in 1 direction, but I can't get it to do that? How'd you go about doing that?
  12. So how would I get the Direction the block is Facing from the blockstate variable? I've looked at a lot of the options that pop up, and I can't seem to find it. what I mean is get the FACING of the block out of the variable storing the blockstate
  13. So could I use an If statement to check which direction the block under me is facing? I have a code that checks what block is under it, and gets that blocks BlockState.
  14. Well I added the ENABLED property by typing it in, and now it crashes whever I try to place the block. Here's the code with the enabled: package com.mrinfinity.motionblocks.blocks; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; 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.IHopper; 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.LockCode; import net.minecraft.world.World; import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.network.NetworkHooks; import javax.annotation.Nullable; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; import static net.minecraft.tileentity.HopperTileEntity.captureItem; import static net.minecraft.tileentity.IHopper.COLLECTION_AREA_SHAPE; public class ConveyorHopper extends Block { private NonNullList<ItemStack> inventory = NonNullList.withSize(5, ItemStack.EMPTY); private static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; private static final BooleanProperty ENABLED = BlockStateProperties.ENABLED; private int transferCooldown = -1; private LockCode code = LockCode.EMPTY_CODE; 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(Properties.create(Material.IRON) .hardnessAndResistance(4.0f, 5.0f) .sound(SoundType.METAL) .harvestLevel(2) .harvestTool(ToolType.PICKAXE)); } @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()).with(ENABLED, Boolean.TRUE); } @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; } private void updateState(World worldIn, BlockPos pos, BlockState state) { boolean flag = !worldIn.isBlockPowered(pos); if (flag != state.get(ENABLED)) { worldIn.setBlockState(pos, state.with(ENABLED, flag), 4); } } @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); } @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); } super.onReplaced(state, worldIn, pos, newState, isMoving); } } @Override public boolean hasComparatorInputOverride(BlockState state) { return true; } private boolean isOnTransferCooldown() { return this.transferCooldown > 0; } public int getSizeInventory() { return this.inventory.size(); } @Override public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } public static List<ItemEntity> getCaptureItems(IHopper p_200115_0_) { return p_200115_0_.getCollectionArea().toBoundingBoxList().stream().flatMap((p_200110_1_) -> { return Objects.requireNonNull(p_200115_0_.getWorld()).getEntitiesWithinAABB(ItemEntity.class, p_200110_1_.offset(p_200115_0_.getXPos() - 0.5D, p_200115_0_.getYPos() - 0.5D, p_200115_0_.getZPos() - 0.5D), EntityPredicates.IS_ALIVE).stream(); }).collect(Collectors.toList()); } VoxelShape getCollectionArea() { return COLLECTION_AREA_SHAPE; } public boolean onEntityCollision(Entity p_200113_1_, BlockPos pos, IHopper p_200115_0_) { if (p_200113_1_ instanceof ItemEntity) { if (VoxelShapes.compare(VoxelShapes.create(p_200113_1_.getBoundingBox().offset((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), this.getCollectionArea(), IBooleanFunction.AND)) { return captureItem((IInventory) this, (ItemEntity) p_200113_1_); } } assert p_200113_1_ instanceof ItemEntity; return captureItem((IInventory) this, (ItemEntity) p_200113_1_); } @Override public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof HopperTileEntity) { ((HopperTileEntity) tileentity).onEntityCollision(entityIn); } } } And here's what the crash report says at the top: java.lang.IllegalArgumentException: Cannot set property BooleanProperty{name=enabled, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in Block{blocksthatmoveyou:conveyor_hopper}
  15. When I load in the consol says that there is an invalid block entity at every position of the hopper block. Here's the full code: 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)); } @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); } @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); } super.onReplaced(state, worldIn, pos, newState, isMoving); } } @Override public boolean hasComparatorInputOverride(BlockState state) { return true; } @Override public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } @Override public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof HopperTileEntity) { ((HopperTileEntity)tileentity).onEntityCollision(entityIn); } } }
  16. Hello. I'm making a conveyor mod, so I need the entity to move based on the blocks direction property, here named FACING. I think I'll need to use If to get this to work, but I can't find how to compare the FACING variable properly. How would I do this? I've tried to figure it out by logging the variable whenever the block is walked on, but that only puts out this: DirectionProperty{name=facing, clazz=class net.minecraft.util.Direction, values=[north, south, west, east]} Here's my code: private static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; public ConveyorBlock() { super(Block.Properties.create(Material.IRON) .hardnessAndResistance(4.0f, 5.0f) .sound(SoundType.METAL) .harvestLevel(2) .harvestTool(ToolType.PICKAXE) .func_235859_g_()); } @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 void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { Vector3d v = entityIn.getMotion(); DirectionProperty facing = FACING; BlocksthatMoveyou.LOGGER.info(facing); BlocksthatMoveyou.LOGGER.info("Player walked on conveyor!"); if (FACING == north) //This was one of the ways I tried doing it, but it can't resolve the symbol I also tried putting it in quotes entityIn.setMotion(v.x, -v.y, v.z); }
  17. Ok so I looked at it, and wrote it into my block code. It still won't suck the item in, despite it being a copy of the hopperblock code. Here's what I put in: @Override public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof HopperTileEntity) { ((HopperTileEntity)tileentity).onEntityCollision(entityIn); } }
  18. The Replay mod is for fabric, as well as 1.14. I think that's what is causing the problem
  19. Where would that be? I've checked eveything I could, but I can't seem to find the coe. What would the fine name be?
  20. Hi. I'm making a hopper-like block, and In order to get the item into the gui, I need to be able to test if the item is on a block. I have this, and was wondering how to test what it collided with, or is there a better way to do it? @SubscribeEvent public static void ItemPickup(ItemEvent event) { ItemEntity itemEntity = (ItemEntity) event.getItem(); if (itemEntity.collidedVertically){ } } }
  21. I think that there might be an option in the in-game setting to turn it off or on
  22. Oh okay thanks
  23. It's normal on optifine for your hunger bar to dissapear. It's for ease of usage
  24. Any way to fix that?
  25. Alright so I think that the problem is that the tile entity is replacing itself every tick. This is why it'll break in creative and instamine, because it's destroyed in less than a tick
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.