lethinh
Members-
Posts
191 -
Joined
-
Last visited
Everything posted by lethinh
-
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
I use @Mod.EventBusSubscriber on the beginning of the class file -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
When I toggle line breakpoint. It doesn't break. But it doesn't break unbreable block -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
Thanks for your idea but it doesn't work. The world.isRemote has already called in the code. -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
So do you know how to convert List<ItemStack> to ItemStack ? -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
How to wheater the code is reaching the break unbreakable block statements? -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
Do you know how to use debugger? I'm using Intellij IDEA -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
It breaks ordinary breakable blocks. The game doesn't crash. And I have called the event by using MinecraftForge.EventBus::register -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
It doesn't break unbreakable block. That's the point of the code. -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
I have just learned java for few months. And the code didn't work: @SubscribeEvent public void onPlayerDig(PlayerInteractEvent.LeftClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); if (event.getFace() == null || world.isRemote || StackUtils.isEmpty(player.getHeldItem(EnumHand.MAIN_HAND)) || player.isCreative()) return; BlockPos pos = event.getPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); List<ItemStack> drop = new ArrayList<>(); if (drop == null) drop = new ArrayList<>(block.getDrops(world, pos, state, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, new ItemStack(this)))); block.harvestBlock(world, player, pos, state, world.getTileEntity(pos), new ItemStack(block)); InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(block)); world.setBlockToAir(pos); world.playEvent(2001, pos, Block.getStateId(state)); } -
My fml-client-latest.log: https://gist.github.com/letruongthinh/39a43b171466c9a97cec851b27871e23 My latest.log: https://gist.github.com/letruongthinh/0030e677c0918872b176a3ddb6d4eec7
-
It shows these error lines: [21:04:27] [File IO Thread/ERROR]: Failed to save chunk java.lang.NullPointerException at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347) ~[?:1.8.0_51] at java.io.DataOutputStream.writeUTF(DataOutputStream.java:323) ~[?:1.8.0_51] at net.minecraft.nbt.NBTTagCompound.writeEntry(NBTTagCompound.java:555) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:29) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagList.write(NBTTagList.java:37) ~[NBTTagList.class:?] at net.minecraft.nbt.NBTTagCompound.writeEntry(NBTTagCompound.java:556) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:29) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.writeEntry(NBTTagCompound.java:556) ~[NBTTagCompound.class:?] at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:29) ~[NBTTagCompound.class:?] at net.minecraft.nbt.CompressedStreamTools.writeTag(CompressedStreamTools.java:126) ~[CompressedStreamTools.class:?] at net.minecraft.nbt.CompressedStreamTools.write(CompressedStreamTools.java:116) ~[CompressedStreamTools.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkData(AnvilChunkLoader.java:252) ~[AnvilChunkLoader.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeNextIO(AnvilChunkLoader.java:230) [AnvilChunkLoader.class:?] at net.minecraft.world.storage.ThreadedFileIOBase.processQueue(ThreadedFileIOBase.java:48) [ThreadedFileIOBase.class:?] at net.minecraft.world.storage.ThreadedFileIOBase.run(ThreadedFileIOBase.java:36) [ThreadedFileIOBase.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
-
Yes!
-
Well, I changed the SLOT_PLAN to 0, SLOLT_CRAFT_RESULT to 1, and SLOT_CRAFT_MATRIX to 2 in the InventoryConstructor.
-
Now it doesn't open the gui. Here is my ContainerBase code: https://gist.github.com/letruongthinh/21f58eb3c04fac917d72ed35190397d0 My ContainerConstructor code: https://gist.github.com/letruongthinh/649c2ace3a7dd7fed501b421df50478e
-
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
It is: @SubscribeEvent public void onPlayerDig(PlayerInteractEvent.LeftClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); if (event.getFace() == null || world.isRemote || StackUtils.isEmpty(player.getHeldItem(EnumHand.MAIN_HAND)) || player.isCreative()) return; BlockPos pos = event.getPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); List<ItemStack> drop = new ArrayList<>(); if (block.getDrops(world, pos, state, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, new ItemStack(this))) == drop) { if (drop == null) drop = new ArrayList<>(block.getDrops(world, pos, state, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, new ItemStack(this)))); InventoryHelper.spawnItemStack(world, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), drop); } else block.harvestBlock(world, player, pos, state, world.getTileEntity(pos), drop); world.setBlockToAir(pos); world.playEvent(2001, pos, Block.getStateId(state)); } -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
Can't be. If I do that, the method InventoryHelper::spawnItemStack and Block::harvestBlock WILL NOT WORK -
Hello everyone. I'm getting trouble with my TileEntity. Here is my crash report: https://gist.github.com/letruongthinh/cfe53052b3b289502973deb28c65f71a My Inventory Base code: https://gist.github.com/letruongthinh/7f2dd5df5ae401aca54f7deb3085f9f9 My InventoryTile code: https://gist.github.com/letruongthinh/594b82c891f6796f3994bb012993b63d My Tile Base code: https://gist.github.com/letruongthinh/9cf3622a35e9069332e0c74c85aee15b
-
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
I can't. Block::getDrops is List<ItemStack> but the drop is a item stack. -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
All the code that I have shown to you. And could you show me how to not call Block::getMetaFromState? -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
Do you know how to fix those errors? I have tried all! -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
Here is my final newest code: https://gist.github.com/anonymous/28b892b90e2f73d2242a3f2b077e77ca -
[Forge 1.10.2] Create a pickaxe that break unbreakable blocks?
lethinh replied to lethinh's topic in Modder Support
Still doesn't work!