Inform console about fake player

This commit is contained in:
Ellpeck 2015-12-16 14:59:03 +01:00
parent 5bdbef0165
commit 96a835c475
3 changed files with 12 additions and 5 deletions

View file

@ -42,6 +42,7 @@ import ellpeck.actuallyadditions.recipe.HairyBallHandler;
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.update.UpdateChecker;
import ellpeck.actuallyadditions.util.FakePlayerUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Items;
@ -109,6 +110,8 @@ public class ActuallyAdditions{
proxy.postInit(event);
ModUtil.LOGGER.info("PostInitialization Finished.");
FakePlayerUtil.info();
}
@EventHandler

View file

@ -19,14 +19,18 @@ import java.util.UUID;
public class FakePlayerUtil{
private static final String fakeName = "EllpecksActuallyAdditionsFakePlayer";
private static GameProfile fakeProfile = new GameProfile(UUID.nameUUIDFromBytes(fakeName.getBytes()), fakeName);
private static final String FAKE_NAME = "EllpecksActuallyAdditionsFakePlayer";
private static final GameProfile FAKE_PROFILE = new GameProfile(UUID.nameUUIDFromBytes(FAKE_NAME.getBytes()), FAKE_NAME);
private static FakePlayer theFakePlayer;
public static FakePlayer newFakePlayer(World world){
public static void info(){
ModUtil.LOGGER.info(ModUtil.NAME+"' Fake Player: '"+FAKE_PROFILE.getName()+"', UUID: "+FAKE_PROFILE.getId());
}
public static FakePlayer getFakePlayer(World world){
if(world instanceof WorldServer){
if(theFakePlayer == null){
theFakePlayer = new FakePlayer((WorldServer)world, fakeProfile);
theFakePlayer = new FakePlayer((WorldServer)world, FAKE_PROFILE);
}
return theFakePlayer;
}

View file

@ -149,7 +149,7 @@ public class WorldUtil{
try{
//Blocks
stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world, x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
stack.tryPlaceItemIntoWorld(FakePlayerUtil.getFakePlayer(world), world, x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
return stack;
}
catch(Exception e){