TileEntity, Block и EventHandler...

Версия Minecraft
1.6.4

jopi

Попрошайка
1,421
31
260
Я конкретно уже За****ся.

Где я только не искал, у кого только не спрашивал уже невозможно.
Что мне нужно:
1, отправлять данные в тайл из блока и наоборот(необяз)
2, в EventHandler при ломании блока уменьшать число в TileEntity
P.S. На проверке если TileEntity.integer1 != 0 {} крашит с ошибкой NULL.
Т.е. у меня блок который финально ломается после 5 ударов.

код TileEntity:

Код:
package net.anonized.mod.main.blocks;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class TileEntityBlockSpecialOre extends TileEntity
{
    public int timesToBreak = 5;
   
    public void readFromNBT(NBTTagCompound par1NBTTagCompound)
    {
        super.readFromNBT(par1NBTTagCompound);
        this.timesToBreak = par1NBTTagCompound.getInteger("timesToBreak");
    }
   
    public void writeToNBT(NBTTagCompound par1NBTTagCompound)
    {
        super.writeToNBT(par1NBTTagCompound);
        par1NBTTagCompound.setInteger("timesToBreak", this.timesToBreak);
    }
   
    public void updateEntity() {
       super.updateEntity();
    }
   
    public int getTimes() {
        return this.timesToBreak;
    }
   
    public void incTimes() {
        ++this.timesToBreak;
    }
   
    public void decTimes() {
        --this.timesToBreak;
    }
}

код EventHandler


Java:
package net.anonized.mod.general;

import net.anonized.mod.main.blocks.NSpecialBlockOre;
import net.anonized.mod.main.blocks.TileEntityBlockSpecialOre;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;

public class EventHandler {
   
    @ForgeSubscribe
    public void onBlockBreakEvent(BreakEvent event) {
        System.out.println("BREEAAAAK");
        if (!event.world.isRemote){
            if (event.block instanceof NSpecialBlockOre) {
                TileEntityBlockSpecialOre tebso = (TileEntityBlockSpecialOre)event.world.getBlockTileEntity(event.x, event.y, event.z);
                System.out.println("INSTANCED");
                if (tebso.timesToBreak!= 0) {
                    //System.out.println("NotZero " + ((NSpecialBlockOre)event.block).i);
                    tebso.decTimes();
                    event.setCanceled(true);
                }
                else {
                    //((NSpecialBlockOre)event.block).i=5;
                }
            }
        }
    }
}

UPD1:
Поменял в тайле модификатор числа на static сработало, но после ломания блока число не возвращается на 5.
если начать ломать другой блок, число всеравно остается сколькоразударил-5
 
Краш-лог
2019-03-01 14:51:20 [INFO] [STDOUT] BREEAAAAK
2019-03-01 14:51:20 [INFO] [STDOUT] INSTANCED
2019-03-01 14:51:20 [INFO] [STDERR] net.minecraft.util.ReportedException: Ticking memory connection
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2019-03-01 14:51:20 [INFO] [STDERR] Caused by: java.lang.NullPointerException
2019-03-01 14:51:20 [INFO] [STDERR] at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraftforge.event.EventBus.post(EventBus.java:108)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2019-03-01 14:51:20 [INFO] [STDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2019-03-01 14:51:20 [INFO] [STDERR] ... 6 more
2019-03-01 14:51:20 [SEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
at net.minecraftforge.event.EventBus.post(EventBus.java:108)
at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
... 6 more
2019-03-01 14:51:20 [SEVERE] [Minecraft-Server] This crash report has been saved to: C:\Users\ppc\Desktop\SDE\forge\mcp\jars\.\crash-reports\crash-2019-03-01_14.51.20-server.txt
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Stopping server
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Saving players
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Player501 left the game
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Saving worlds
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2019-03-01 14:51:20 [INFO] [STDOUT] ---- Minecraft Crash Report ----
2019-03-01 14:51:20 [INFO] [STDOUT] // Oops.
2019-03-01 14:51:20 [INFO] [STDOUT]
2019-03-01 14:51:20 [INFO] [STDOUT] Time: 01.03.19 14:51
2019-03-01 14:51:20 [INFO] [STDOUT] Description: Ticking memory connection
2019-03-01 14:51:20 [INFO] [STDOUT]
2019-03-01 14:51:20 [INFO] [STDOUT] java.lang.NullPointerException
2019-03-01 14:51:20 [INFO] [STDOUT] at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.event.EventBus.post(EventBus.java:108)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2019-03-01 14:51:20 [INFO] [STDOUT]
2019-03-01 14:51:20 [INFO] [STDOUT]
2019-03-01 14:51:20 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2019-03-01 14:51:20 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2019-03-01 14:51:20 [INFO] [STDOUT]
2019-03-01 14:51:20 [INFO] [STDOUT] -- Head --
2019-03-01 14:51:20 [INFO] [STDOUT] Stacktrace:
2019-03-01 14:51:20 [INFO] [STDOUT] at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.event.EventBus.post(EventBus.java:108)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2019-03-01 14:51:20 [INFO] [STDOUT]
2019-03-01 14:51:20 [INFO] [STDOUT] -- Ticking connection --
2019-03-01 14:51:20 [INFO] [STDOUT] Details:
2019-03-01 14:51:20 [INFO] [STDOUT] Connection: net.minecraft.network.NetServerHandler@3167987e
2019-03-01 14:51:20 [INFO] [STDOUT] Stacktrace:
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2019-03-01 14:51:20 [INFO] [STDOUT] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2019-03-01 14:51:20 [INFO] [STDOUT]
Краш-лог:
2019-03-01 14:51:20 [INFO] [STDOUT] BREEAAAAK
2019-03-01 14:51:20 [INFO] [STDOUT] INSTANCED
2019-03-01 14:51:20 [INFO] [STDERR] net.minecraft.util.ReportedException: Ticking memory connection
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2019-03-01 14:51:20 [INFO] [STDERR] Caused by: java.lang.NullPointerException
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraftforge.event.EventBus.post(EventBus.java:108)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2019-03-01 14:51:20 [INFO] [STDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2019-03-01 14:51:20 [INFO] [STDERR] 	... 6 more
2019-03-01 14:51:20 [SEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63)
	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
	at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
	at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
	at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
	at net.minecraftforge.event.EventBus.post(EventBus.java:108)
	at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
	at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
	at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
	at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
	at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
	... 6 more
2019-03-01 14:51:20 [SEVERE] [Minecraft-Server] This crash report has been saved to: C:\Users\ppc\Desktop\SDE\forge\mcp\jars\.\crash-reports\crash-2019-03-01_14.51.20-server.txt
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Stopping server
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Saving players
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Player501 left the game
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Saving worlds
2019-03-01 14:51:20 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2019-03-01 14:51:20 [INFO] [STDOUT] ---- Minecraft Crash Report ----
2019-03-01 14:51:20 [INFO] [STDOUT] // Oops.
2019-03-01 14:51:20 [INFO] [STDOUT] 
2019-03-01 14:51:20 [INFO] [STDOUT] Time: 01.03.19 14:51
2019-03-01 14:51:20 [INFO] [STDOUT] Description: Ticking memory connection
2019-03-01 14:51:20 [INFO] [STDOUT] 
2019-03-01 14:51:20 [INFO] [STDOUT] java.lang.NullPointerException
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.event.EventBus.post(EventBus.java:108)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2019-03-01 14:51:20 [INFO] [STDOUT] 
2019-03-01 14:51:20 [INFO] [STDOUT] 
2019-03-01 14:51:20 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2019-03-01 14:51:20 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2019-03-01 14:51:20 [INFO] [STDOUT] 
2019-03-01 14:51:20 [INFO] [STDOUT] -- Head --
2019-03-01 14:51:20 [INFO] [STDOUT] Stacktrace:
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.anonized.mod.general.EventHandler.onBlockBreakEvent(EventHandler.java:18)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.event.ASMEventHandler_4_EventHandler_onBlockBreakEvent_BreakEvent.invoke(.dynamic)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.event.EventBus.post(EventBus.java:108)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(ForgeHooks.java:479)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:292)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.item.ItemInWorldManager.uncheckedTryHarvestBlock(ItemInWorldManager.java:240)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:502)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2019-03-01 14:51:20 [INFO] [STDOUT] 
2019-03-01 14:51:20 [INFO] [STDOUT] -- Ticking connection --
2019-03-01 14:51:20 [INFO] [STDOUT] Details:
2019-03-01 14:51:20 [INFO] [STDOUT] 	Connection: net.minecraft.network.NetServerHandler@3167987e
2019-03-01 14:51:20 [INFO] [STDOUT] Stacktrace:
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2019-03-01 14:51:20 [INFO] [STDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2019-03-01 14:51:20 [INFO] [STDOUT]
Последнее редактирование:
ничево не поньял.
Я понял только что нужно изменять значение, ну допустим я оверрайжу метод, пишу --counter; потом пишу super.breakBlock();
чекаю в евенте на counter, после 5 раз как ударил всеравно он не возвращается на 5
 
Чо ты хочешь то? Насколько я понял, тебе надо сделать так чтобы блок нужно было сломать 5 раз, а потом он исчезает.
Я тебе написал алгоритм.
Java:
// В блоке у тебя
void breakBlock(...){
    TileEntity tile = ...
    tile.counter++;
    super.breakBlock(...);
}

// В ивенте
TileEntity tile = ...
if(tile.counter < 5){
    event.setCanceled(true);
}
 
@Agravaine потом попробую как ты написал, я крч подумал мб сохранять какой блок последний раз ломался и сохранять корды а после слома блока удалять сохр корды, потещу если баги будут тогда поробую шо ты написал
 
Назад
Сверху