Lambda
Members-
Posts
486 -
Joined
-
Last visited
Everything posted by Lambda
-
Thanks! That seemed to fix it!
-
Okay, So I seem to be getting this error: [22:05:00] [server thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.util.ConcurrentModificationException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_91] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_91] at net.minecraft.util.Util.runTask(Util.java:27) [util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:753) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) ~[?:1.8.0_91] at java.util.ArrayList$Itr.next(ArrayList.java:851) ~[?:1.8.0_91] at com.lambda.plentifulmisc.events.CommonEvents.HarvestDropsEvent(CommonEvents.java:83) ~[CommonEvents.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_12_CommonEvents_HarvestDropsEvent_HarvestDropsEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) ~[EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:260) ~[ForgeEventFactory.class:?] at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:692) ~[block.class:?] at net.minecraft.block.Block.dropBlockAsItem(Block.java:681) ~[block.class:?] at net.minecraft.block.Block.harvestBlock(Block.java:889) ~[block.class:?] at net.minecraft.server.management.PlayerInteractionManager.tryHarvestBlock(PlayerInteractionManager.java:355) ~[PlayerInteractionManager.class:?] at net.minecraft.server.management.PlayerInteractionManager.blockRemoving(PlayerInteractionManager.java:264) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:664) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(CPacketPlayerDigging.java:56) ~[CPacketPlayerDigging.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(CPacketPlayerDigging.java:12) ~[CPacketPlayerDigging.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_91] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_91] at net.minecraft.util.Util.runTask(Util.java:26) ~[util.class:?] ... 5 more [22:05:01] [server thread/ERROR]: Exception caught during firing event net.minecraftforge.event.world.BlockEvent$HarvestDropsEvent@2ae16890: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) ~[?:1.8.0_91] at java.util.ArrayList$Itr.next(ArrayList.java:851) ~[?:1.8.0_91] at com.lambda.plentifulmisc.events.CommonEvents.HarvestDropsEvent(CommonEvents.java:83) ~[CommonEvents.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_12_CommonEvents_HarvestDropsEvent_HarvestDropsEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:260) [ForgeEventFactory.class:?] at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:692) [block.class:?] at net.minecraft.block.Block.dropBlockAsItem(Block.java:681) [block.class:?] at net.minecraft.block.Block.harvestBlock(Block.java:889) [block.class:?] at net.minecraft.server.management.PlayerInteractionManager.tryHarvestBlock(PlayerInteractionManager.java:355) [PlayerInteractionManager.class:?] at net.minecraft.server.management.PlayerInteractionManager.blockRemoving(PlayerInteractionManager.java:264) [PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:664) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(CPacketPlayerDigging.java:56) [CPacketPlayerDigging.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(CPacketPlayerDigging.java:12) [CPacketPlayerDigging.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) [PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_91] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91] at net.minecraft.util.Util.runTask(Util.java:26) [util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:753) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] [22:05:01] [server thread/ERROR]: Index: 1 Listeners: [22:05:01] [server thread/ERROR]: 0: NORMAL [22:05:01] [server thread/ERROR]: 1: ASM: class com.lambda.plentifulmisc.events.CommonEvents HarvestDropsEvent(Lnet/minecraftforge/event/world/BlockEvent$HarvestDropsEvent;)V [22:05:01] [server thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.util.ConcurrentModificationException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_91] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_91] at net.minecraft.util.Util.runTask(Util.java:27) [util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:753) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) ~[?:1.8.0_91] at java.util.ArrayList$Itr.next(ArrayList.java:851) ~[?:1.8.0_91] at com.lambda.plentifulmisc.events.CommonEvents.HarvestDropsEvent(CommonEvents.java:83) ~[CommonEvents.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_12_CommonEvents_HarvestDropsEvent_HarvestDropsEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) ~[EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:260) ~[ForgeEventFactory.class:?] at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:692) ~[block.class:?] at net.minecraft.block.Block.dropBlockAsItem(Block.java:681) ~[block.class:?] at net.minecraft.block.Block.harvestBlock(Block.java:889) ~[block.class:?] at net.minecraft.server.management.PlayerInteractionManager.tryHarvestBlock(PlayerInteractionManager.java:355) ~[PlayerInteractionManager.class:?] at net.minecraft.server.management.PlayerInteractionManager.blockRemoving(PlayerInteractionManager.java:264) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:664) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(CPacketPlayerDigging.java:56) ~[CPacketPlayerDigging.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(CPacketPlayerDigging.java:12) ~[CPacketPlayerDigging.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_91] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_91] at net.minecraft.util.Util.runTask(Util.java:26) ~[util.class:?] ... 5 more On line: for(ItemStack stack : event.getDrops()) { This, however doesnt crash my game.
-
Hello there, So I'm having issues with rendering over the game with a texture, however, I cannot figure out how to draw the texture, this , for example didnt work : @SubscribeEvent public static void onRenderGameOverlay(RenderGameOverlayEvent event) { final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_mana_bar"); Minecraft mc = Minecraft.getMinecraft(); if(!event.isCanceled() && event.getType() == RenderGameOverlayEvent.ElementType.TEXT) { CapabilityManaData storage = mc.thePlayer.getCapability(CapabilityMagic.MANA, null); mc.renderEngine.bindTexture(RES_LOC); mc.ingameGUI.drawTexturedModalRect(mc.displayWidth / 2, mc.displayHeight / 2, 0, 0, 111, 9); } } Thanks,
-
No I added the second one because cobble wasnt even dropping when I added the rand. Even if the rand was false.
-
Thanks! However, the random chance thing seems to drop nothing, not even the cobble: if (event.getHarvester() instanceof EntityPlayer) { if (!event.isSilkTouching()) { for(ItemStack stack : event.getDrops()) { if(stack.getItem() == Item.getItemFromBlock(Blocks.COBBLESTONE)) { if(rand.nextInt(2) == 1) { event.getDrops().add(new ItemStack(InitItems.item_gems, 1, 0)); event.getDrops().add(new ItemStack(InitItems.item_gems, 1, 1)); event.getDrops().add(new ItemStack(InitItems.item_gems, 1, 2)); event.getDrops().add(new ItemStack(InitItems.item_gems, 1, 3)); event.getDrops().add(new ItemStack(Blocks.COBBLESTONE, 1)); } event.getDrops().add(new ItemStack(Blocks.COBBLESTONE, 1)); } } } }
-
Then how would I do it, I tried making a list and comparing the list, however didnt seem to work:/
-
ah yes, so look for a ItemStack like this? if(event.getHarvester() instanceof EntityPlayer) { if(!event.isSilkTouching()) { if(event.getDrops().contains(new ItemStack(Blocks.COBBLESTONE))) { event.getDrops().add(new ItemStack(InitBlocks.block_fire_opal_ore)); } } } However, still doesnt seem to drop
-
Okay this: if(event.getDrops() == Blocks.COBBLESTONE) { event.getDrops().add(new ItemStack(InitBlocks.block_fire_opal_ore)); } seems not to drop when a block drops cobblestone (ex. stone), and also, is there a way to find the block that I'm mining, other than finding the drop?
-
Oh, Yeah figured that out before you commented. Thanks either way...
-
Yes like this: @SubscribeEvent public static void HarvestDropsEvent(BlockEvent.HarvestDropsEvent event) { Minecraft mc = Minecraft.getMinecraft(); if(event.getHarvester() instanceof EntityPlayer) { if(!event.isSilkTouching()) { if(event.getDrops() == Blocks.COBBLESTONE) { } } } } So when cobble is dropped I want it to drop the cobble and x
-
How would I override an event like that? one of the first times messing with them.
-
Random chance, but know how to handle that
-
Hey there, So I'm in need of dropping an item when a block is broken, I have the event but i need to spawn the item in.
-
Ah yes, seems like if I do a check of the entity, it will work! Thanks
-
Hello there, So I'm syncing my capability between the server and client, however, when I try to extract mana, I get this error: Dec 12, 2016 9:10:01 PM io.netty.channel.embedded.EmbeddedChannel recordException WARNING: More than one exception was raised. Will report only the first one and log others. java.lang.RuntimeException: PLAYER target expects a Player arg at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125) at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) 0 at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractMana(CapabilityManaData.java:85) 8520 at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:43) [21:10:01] [server thread/ERROR]: FMLIndexedMessageCodec exception caught at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41) java.lang.RuntimeException: PLAYER target expects a Player arg at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193) at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125) ~[FMLOutboundHandler$OutboundTarget$4.class:?] at net.minecraft.world.World.updateEntities(World.java:1968) at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) ~[FMLOutboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) ~[MessageToMessageEncoder.class:4.0.23.Final] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.0.23.Final] at java.lang.Thread.run(Thread.java:745) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) ~[DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) ~[AbstractChannel.class:4.0.23.Final] at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) [simpleNetworkWrapper.class:?] at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractMana(CapabilityManaData.java:85) [CapabilityManaData.class:?] at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:43) [CapabilityManaData.class:?] at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41) [TileEntityChargeStand.class:?] at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193) [TileEntityBase.class:?] at net.minecraft.world.World.updateEntities(World.java:1968) [World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] [21:10:01] [server thread/ERROR]: FMLIndexedMessageCodec exception caught java.lang.RuntimeException: PLAYER target expects a Player arg at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125) ~[FMLOutboundHandler$OutboundTarget$4.class:?] at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) ~[FMLOutboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) ~[MessageToMessageEncoder.class:4.0.23.Final] at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) ~[AbstractChannelHandlerContext.class:4.0.23.Final] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) ~[DefaultChannelPipeline.class:4.0.23.Final] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) ~[AbstractChannel.class:4.0.23.Final] at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) [simpleNetworkWrapper.class:?] at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:44) [CapabilityManaData.class:?] at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41) [TileEntityChargeStand.class:?] at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193) [TileEntityBase.class:?] at net.minecraft.world.World.updateEntities(World.java:1968) [World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] Dec 12, 2016 9:10:01 PM io.netty.channel.embedded.EmbeddedChannel recordException WARNING: More than one exception was raised. Will report only the first one and log others. java.lang.RuntimeException: PLAYER target expects a Player arg at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$4.validateArgs(FMLOutboundHandler.java:125) at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:254) at com.lambda.plentifulmisc.magic.internal.CapabilityManaData.extractManaInternal(CapabilityManaData.java:44) at com.lambda.plentifulmisc.tile.magic.TileEntityChargeStand.updateEntity(TileEntityChargeStand.java:41) at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:193) at net.minecraft.world.World.updateEntities(World.java:1968) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) at java.lang.Thread.run(Thread.java:745) I needed to send a packet everytime that it is changed, so in my capability data, I have these: PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity()); In every function that is changing the current mana. This is where the error occurs however, here is the entire class for reference: public class CapabilityManaData extends ManaHandler { private EntityLivingBase entity; public CapabilityManaData(){ super(500000); } public CapabilityManaData(int capacity, int maxReceive, int maxExtract){ super(capacity, maxReceive, maxExtract); } public EntityLivingBase getEntity() { return entity; } public void setEntity(EntityLivingBase entity) { this.entity = entity; } public int extractManaInternal(int maxExtract, boolean simulate){ int before = this.maxExtract; this.maxExtract = Integer.MAX_VALUE; int toReturn = this.extractMana(maxExtract, simulate); PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity()); this.maxExtract = before; return toReturn; } public int receiveManaInternal(int maxReceive, boolean simulate){ int before = this.maxReceive; this.maxReceive = Integer.MAX_VALUE; int toReturn = this.receiveMana(maxReceive, simulate); PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity()); this.maxReceive = before; return toReturn; } @Override public int receiveMana(int maxReceive, boolean simulate){ if(!this.canReceive()){ return 0; } int mana = this.getManaStored(); int manaReceived = Math.min(this.capacity-mana, Math.min(this.maxReceive, maxReceive)); if(!simulate){ this.setManaStored(mana+manaReceived); } PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity()); return manaReceived; } @Override public int extractMana(int maxExtract, boolean simulate){ if(!this.canExtract()){ return 0; } int mana = this.getManaStored(); int manaExtracted = Math.min(mana, Math.min(this.maxExtract, maxExtract)); if(!simulate){ this.setManaStored(mana-manaExtracted); } PlentifulMisc.network.sendTo(new ManaNetworkSyncClient(this.getManaStored()), (EntityPlayerMP) this.getEntity()); // PlentifulMisc.network.sendToServer(new ManaNetworkSyncServer(this.getManaStored())); return manaExtracted; } public void readFromNBT(NBTTagCompound compound){ this.setManaStored(compound.getInteger("Mana")); } public NBTBase writeData() { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("Mana", mana); return tag; } public void readData(NBTBase nbt) { NBTTagCompound tag = (NBTTagCompound) nbt; this.setManaStored(tag.getInteger("Mana")); } public void writeToNBT(NBTTagCompound compound){ compound.setInteger("Mana", this.getManaStored()); } public int getPercentedMana() { return this.getManaStored() / this.getMaxManaStored(); } public void setManaStored(int energy){ this.mana = energy; } } The TE thats crashing it: public class TileEntityChargeStand extends TileEntityCrystalSearchBase { public final int MANA_PER_TICK = 50; public UUID uuid; public TileEntityChargeStand() { super("chargeStand"); } @Override public void updateEntity() { super.updateEntity(); if(!worldObj.isRemote) { System.out.println(storage.getManaStored()); EntityPlayer player = worldObj.getClosestPlayer(pos.getX(), pos.getY() + 1, pos.getZ(), 1, false); if (player != null) { if (player.getUniqueID().equals(uuid) && uuid != null) { if (player.hasCapability(CapabilityMagic.MANA, null)) { if (storage.getManaStored() >= 0) { CapabilityManaData cap = player.getCapability(CapabilityMagic.MANA, null); cap.receiveManaInternal(MANA_PER_TICK, false); this.storage.extractManaInternal(MANA_PER_TICK, false); } } } } } } @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { //e compound.setUniqueId("ChargeUUID", uuid); } uuid = compound.getUniqueId("ChargeUUID"); super.writeSyncableNBT(compound, type); } @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { } uuid = compound.getUniqueId("ChargeUUID"); super.readSyncableNBT(compound, type); } }
-
[1.11] Detecting TEs that are not horizontal / vertical from the orginal
Lambda replied to Lambda's topic in Modder Support
Hm, running into an issue, this doesn't seem to detect the TEs at all: for(int i = 0; i < MAX_SEARCH_RANGE; i++) { BlockPos pos = this.getPos().offset(facing, i); Iterable<BlockPos> positions = BlockPos.getAllInBox(pos.add(-3,-3,-3), pos.add(3,3,3)); TileEntity te = worldObj.getTileEntity(positions.iterator().next()); if (te instanceof TileEntityManaCrystal) { int manaToProduce = ((TileEntityManaCrystal) te).mana_produce; this.storage.receiveManaInternal(manaToProduce * crystalsAround.size(), false, false); if (!crystalsAround.contains(te)) { crystalsAround.add(te); } } if (i >= MAX_SEARCH_RANGE) { return; } } validateTE(); } Also, I shouldnt have the foreach loop for EnumFacing facing : EnumFacing.values , correct? -
[1.11] Detecting TEs that are not horizontal / vertical from the orginal
Lambda replied to Lambda's topic in Modder Support
Thanks, however, I'm having an issue getting the positions and looking for a te at that position. So how would I access the positions? -
[1.11] Detecting TEs that are not horizontal / vertical from the orginal
Lambda replied to Lambda's topic in Modder Support
This BlockPos.getAllInBox method is confusing the hell out of me for some reason, I've tried using the pos, using a Iterable.. just keeps on giving me an error about Iterable, which I tried applying. -
Ah didn't catch that. It saves though relog but not though restart.
-
Ah, changed that, test works, but doesnt save, so something is wrong with my NBT still: public class TileEntityChargeStand extends TileEntityCrystalSearchBase { public final int MANA_PER_TICK = 50; public UUID uuid; public TileEntityChargeStand() { super("chargeStand"); } @Override public void updateEntity() { super.updateEntity(); if(!worldObj.isRemote) { EntityPlayer player = worldObj.getClosestPlayer(pos.getX(), pos.getY() + 1, pos.getZ(), 1, false); if (player != null) { if (player.getUniqueID() == uuid && uuid != null) { if (player.hasCapability(CapabilityMagic.MANA, null)) { if (storage.getManaStored() >= 0) { CapabilityManaData cap = player.getCapability(CapabilityMagic.MANA, null); cap.receiveManaInternal(MANA_PER_TICK, false); this.storage.extractMana(MANA_PER_TICK, false); } } } } } } @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { compound.setUniqueId("ChargeUUID", uuid); } super.writeSyncableNBT(compound, type); } @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { uuid = compound.getUniqueId("ChargeUUID"); } super.readSyncableNBT(compound, type); } } Thanks.
-
@Override public void readSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { uuid = new UUID(compound.getLong("UUID.LEASTBIT"), compound.getLong("UUID.MOSTBIT")); } super.readSyncableNBT(compound, type); }
-
Okay, so like this: public long leastbit; public long mostbit; public UUID uuid = new UUID(leastbit, mostbit); @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { compound.setLong("UUID.LEASTBIT", uuid.getLeastSignificantBits()); compound.setLong("UUID.MOSTBIT", uuid.getMostSignificantBits()); } super.writeSyncableNBT(compound, type); } @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type) { if(type != NBTType.SAVE_BLOCK) { leastbit = compound.getLong("UUID.LEASTBIT"); mostbit = compound.getLong("UUID.MOSTBIT"); } super.readSyncableNBT(compound, type); }
-
Hey there, So I have an Item here that need to set a string in a TE ,the string will check if the bounded player is the same, and do x if it is. However, I'm having an issue with finding a way of accessing something that differentiates a player. Thanks,
-
Ah! That seemed to work, Thanks!