Rewrite cable logic to use FE.
Fixes #1077 Fixes #1071 Fixes #1067 Fixes #1070 Fixes #1059 Fixes #1044 Fixes #1041 Fixes #1025 Fixes #1006 Fixes #990 Fixes #987 Fixes #962 Fixes #955 Fixes #897
This commit is contained in:
parent
541d3096a0
commit
aee7ca9f14
5 changed files with 86 additions and 596 deletions
|
@ -29,14 +29,10 @@ import net.minecraft.init.MobEffects;
|
|||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.power.PowerDestroyEvent;
|
||||
import techreborn.power.PowerTickEvent;
|
||||
|
||||
public class TRTickHandler {
|
||||
|
||||
|
@ -56,32 +52,4 @@ public class TRTickHandler {
|
|||
previouslyWearing = chestslot;
|
||||
}
|
||||
|
||||
int ticksCounted = 0;
|
||||
long tickTime = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
public void worldTick(TickEvent.WorldTickEvent e) {
|
||||
if (e.world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
long start = System.nanoTime();
|
||||
e.world.theProfiler.startSection("TechRebornPowerNet");
|
||||
MinecraftForge.EVENT_BUS.post(new PowerTickEvent(e.world));
|
||||
e.world.theProfiler.endSection();
|
||||
long elapsed = System.nanoTime() - start;
|
||||
tickTime += elapsed;
|
||||
ticksCounted++;
|
||||
if (ticksCounted == 20 * 5) {
|
||||
//Enable this this line to get some infomation when debuging.
|
||||
//System.out.println("Average powernet tick time over last 5 seconds: " + (tickTime / ticksCounted) + "ns");
|
||||
ticksCounted = 0;
|
||||
tickTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void unload(WorldEvent.Unload event){
|
||||
MinecraftForge.EVENT_BUS.post(new PowerDestroyEvent(event.getWorld()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue