From d35f9b61c8d480d616238c21ba78ac3b7e4f79e7 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 15 Jul 2019 17:31:20 +0200 Subject: Fix just in case. --- .../tectech/mechanics/anomaly/AnomalyHandler.java | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java index 3a932ec53b..fcc0242432 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java @@ -39,6 +39,8 @@ public class AnomalyHandler implements IChunkMetaDataHandler { private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer"; private static final int MEAN_DELAY =50; + private boolean fixMe=false; + @Override public String getTagName() { return "anomaly"; @@ -198,20 +200,26 @@ public class AnomalyHandler implements IChunkMetaDataHandler { @Override public void tickRender(HashMap data, TickEvent.RenderTickEvent aEvent) { EntityClientPlayerMP player=Minecraft.getMinecraft().thePlayer; - if(player!=null && !player.capabilities.isCreativeMode) { - NBTTagCompound tagCompound=TecTech.playerPersistence.getDataOrSetToNewTag(Minecraft.getMinecraft().thePlayer); - if(tagCompound!=null) { - float cancer = tagCompound.getFloat(SPACE_CANCER); - if (cancer > 0) { - player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 4 * cancer, (TecTech.RANDOM.nextFloat() - .5F) * 4 * cancer); - player.setInvisible(TecTech.RANDOM.nextFloat() * 2 < cancer); - if (cancer > 1.9f) { - player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer*cancer/2, (TecTech.RANDOM.nextFloat() - .5F) * cancer*cancer/2, (TecTech.RANDOM.nextFloat() - .5F) * cancer*cancer/2); - } else{ - player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer*cancer/2, (TecTech.RANDOM.nextFloat() - .5F) * cancer*cancer/2, (TecTech.RANDOM.nextFloat() - .5F) * cancer*cancer/2); + if(player!=null) { + if(player.capabilities.isCreativeMode) { + NBTTagCompound tagCompound = TecTech.playerPersistence.getDataOrSetToNewTag(Minecraft.getMinecraft().thePlayer); + if (tagCompound != null) { + float cancer = tagCompound.getFloat(SPACE_CANCER); + if (cancer > 0) { + player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 4 * cancer, (TecTech.RANDOM.nextFloat() - .5F) * 4 * cancer); + player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); + if (cancer > 1.9f) { + player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer * cancer / 2, (TecTech.RANDOM.nextFloat() - .5F) * cancer * cancer / 2, (TecTech.RANDOM.nextFloat() - .5F) * cancer * cancer / 2); + } else { + player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer * cancer / 2, (TecTech.RANDOM.nextFloat() - .5F) * cancer * cancer / 2, (TecTech.RANDOM.nextFloat() - .5F) * cancer * cancer / 2); + } } } } + if (fixMe){ + player.setInvisible(false); + fixMe=false; + } } } -- cgit