fixed nature altar lagging on laggy servers

This commit is contained in:
Ellpeck 2018-11-08 22:15:25 +01:00
parent 5456262cf1
commit 0e93ebc2fd
2 changed files with 8 additions and 1 deletions

View file

@ -22,6 +22,8 @@ import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
@ -49,6 +51,9 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
} }
}; };
@SideOnly(Side.CLIENT)
public int bobTimer;
private final BasicAuraContainer container = new BasicAuraContainer(AuraType.OVERWORLD, 5000); private final BasicAuraContainer container = new BasicAuraContainer(AuraType.OVERWORLD, 5000);
public boolean structureFine; public boolean structureFine;
@ -170,6 +175,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
} }
} }
this.bobTimer++;
} }
} }

View file

@ -13,7 +13,7 @@ public class RenderNatureAltar extends TileEntitySpecialRenderer<TileEntityNatur
ItemStack stack = tile.items.getStackInSlot(0); ItemStack stack = tile.items.getStackInSlot(0);
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
float time = tile.getWorld().getTotalWorldTime() + partialTicks; float time = tile.bobTimer + partialTicks;
float bob = (float) Math.sin(time / 10F) * 0.1F; float bob = (float) Math.sin(time / 10F) * 0.1F;
GlStateManager.translate(x + 0.5F, y + 1.2F + bob, z + 0.5F); GlStateManager.translate(x + 0.5F, y + 1.2F + bob, z + 0.5F);
GlStateManager.rotate((time * 3) % 360, 0F, 1F, 0F); GlStateManager.rotate((time * 3) % 360, 0F, 1F, 0F);