fix: more packet spam

This commit is contained in:
LordMZTE 2023-03-16 18:03:10 +01:00
parent 93c83c6453
commit 0758cb6c69
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
2 changed files with 18 additions and 15 deletions

View File

@ -24,11 +24,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityAgeable;
@ -38,12 +35,10 @@ import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.MovingObjectPosition.MovingObjectType;
@ -52,11 +47,9 @@ import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent; import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.*; import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.world.WorldEvent;
public class AetherEventHandler { public class AetherEventHandler {
@SubscribeEvent @SubscribeEvent
@ -397,14 +390,23 @@ public class AetherEventHandler {
AetherWorldProvider providerAether = (AetherWorldProvider) provider; AetherWorldProvider providerAether = (AetherWorldProvider) provider;
providerAether.setIsEternalDay(data.isEternalDay()); providerAether.setIsEternalDay(data.isEternalDay());
AetherNetwork.sendToAll( if (providerAether.getIsEternalDay() != providerAether.eternalDayPrev) {
new PacketSendEternalDay(providerAether.getIsEternalDay()) AetherNetwork.sendToAll(
); new PacketSendEternalDay(providerAether.getIsEternalDay())
);
providerAether.eternalDayPrev = providerAether.getIsEternalDay();
}
providerAether.setShouldCycleCatchup(data.isShouldCycleCatchup()); providerAether.setShouldCycleCatchup(data.isShouldCycleCatchup());
AetherNetwork.sendToAll( if (providerAether.getShouldCycleCatchup()
new PacketSendShouldCycle(providerAether.getShouldCycleCatchup()) != providerAether.shouldCycleCatchupPrev) {
); AetherNetwork.sendToAll(
new PacketSendShouldCycle(providerAether.getShouldCycleCatchup())
);
providerAether.shouldCycleCatchupPrev
= providerAether.getShouldCycleCatchup();
}
} }
} }

View File

@ -7,7 +7,6 @@ import com.gildedgames.the_aether.player.PlayerAether;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProvider;
@ -19,7 +18,9 @@ public class AetherWorldProvider extends WorldProvider {
private float[] colorsSunriseSunset = new float[4]; private float[] colorsSunriseSunset = new float[4];
private boolean eternalDay; private boolean eternalDay;
public boolean eternalDayPrev;
private boolean shouldCycleCatchup; private boolean shouldCycleCatchup;
public boolean shouldCycleCatchupPrev;
private long aetherTime = 6000; private long aetherTime = 6000;
public AetherWorldProvider() { public AetherWorldProvider() {
@ -227,4 +228,4 @@ public class AetherWorldProvider extends WorldProvider {
) {} ) {}
}; };
} }
} }