From 6ef13d9e9a3be52fa2cb9b928803c11802ce1e23 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Wed, 22 Aug 2018 18:19:27 -0400 Subject: [PATCH] Make DummyWorld singleton. --- .../voxelmodpack/hdskins/gui/DummyWorld.java | 54 ++++++++++--------- .../hdskins/gui/EntityPlayerModel.java | 3 +- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java index 8a9a7153..4409efa3 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/DummyWorld.java @@ -13,34 +13,38 @@ import net.minecraft.world.storage.WorldInfo; public class DummyWorld extends World { - public DummyWorld() { - super(null, new WorldInfo( - new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "MpServer"), - new WorldProviderSurface(), null, true); - } + public static final World INSTANCE = new DummyWorld(); - @Override - protected IChunkProvider createChunkProvider() { - return null; - } + private DummyWorld() { + super(null, + new WorldInfo(new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "MpServer"), + new WorldProviderSurface(), + null, + true); + } - @Override - protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { - return true; - } + @Override + protected IChunkProvider createChunkProvider() { + return null; + } - @Override - public IBlockState getBlockState(BlockPos pos) { - return Blocks.AIR.getDefaultState(); - } + @Override + protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { + return true; + } - @Override - public float getLightBrightness(BlockPos pos) { - return 1; - } + @Override + public IBlockState getBlockState(BlockPos pos) { + return Blocks.AIR.getDefaultState(); + } - @Override - public BlockPos getSpawnPoint() { - return BlockPos.ORIGIN; - } + @Override + public float getLightBrightness(BlockPos pos) { + return 1; + } + + @Override + public BlockPos getSpawnPoint() { + return BlockPos.ORIGIN; + } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java index 0bdf110f..8d18191f 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/EntityPlayerModel.java @@ -7,7 +7,6 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.voxelmodpack.hdskins.LocalTexture; import com.voxelmodpack.hdskins.LocalTexture.IBlankSkinSupplier; import com.voxelmodpack.hdskins.SkinUploader; - import net.minecraft.client.Minecraft; import net.minecraft.client.resources.SkinManager; import net.minecraft.entity.EntityLivingBase; @@ -43,7 +42,7 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup protected boolean previewThinArms = false; public EntityPlayerModel(GameProfile gameprofile) { - super(new DummyWorld()); + super(DummyWorld.INSTANCE); profile = gameprofile;