Fixed crash due to the preview entity's world being null

This commit is contained in:
Sollace 2018-07-11 10:50:33 +02:00
parent 808efacfbe
commit 11ce47f3de
2 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,39 @@
package com.sollace.dummy;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderSurface;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.storage.WorldInfo;
public class DWorld extends World {
public DWorld() {
super(null, new WorldInfo(
new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "MpServer"),
new WorldProviderSurface(), null, false);
}
@Override
protected IChunkProvider createChunkProvider() {
return null;
}
@Override
protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) {
return true;
}
@Override
public float getLightBrightness(BlockPos pos) {
return 1;
}
@Override
public BlockPos getSpawnPoint() {
return BlockPos.ORIGIN;
}
}

View file

@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.sollace.dummy.DWorld;
import com.voxelmodpack.hdskins.DynamicTextureImage;
import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
@ -56,7 +57,7 @@ public class EntityPlayerModel extends EntityLivingBase {
protected boolean previewThinArms = false;
public EntityPlayerModel(GameProfile profile) {
super(null);
super(new DWorld());
this.profile = profile;
this.textureManager = Minecraft.getMinecraft().getTextureManager();
this.remoteSkinResource = new ResourceLocation("skins/preview_" + this.profile.getName() + ".png");