use of micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling in project Galacticraft by micdoodle8.
the class MarsUtil method openSlimelingInventory.
public static void openSlimelingInventory(EntityPlayerMP player, EntitySlimeling slimeling) {
player.getNextWindowId();
player.closeContainer();
int windowId = player.currentWindowId;
GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMars(EnumSimplePacketMars.C_OPEN_CUSTOM_GUI, GCCoreUtil.getDimensionID(player.worldObj), new Object[] { windowId, 0, slimeling.getEntityId() }), player);
player.openContainer = new ContainerSlimeling(player.inventory, slimeling, player);
player.openContainer.windowId = windowId;
player.openContainer.onCraftGuiOpened(player);
}
use of micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling in project Galacticraft by micdoodle8.
the class PacketSimpleMars method handleServerSide.
@Override
public void handleServerSide(EntityPlayer player) {
EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
switch(this.type) {
case S_UPDATE_SLIMELING_DATA:
Entity entity = player.worldObj.getEntityByID((Integer) this.data.get(0));
if (entity instanceof EntitySlimeling) {
EntitySlimeling slimeling = (EntitySlimeling) entity;
int subType = (Integer) this.data.get(1);
switch(subType) {
case 0:
if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
slimeling.setSittingAI(!slimeling.isSitting());
slimeling.setJumping(false);
slimeling.getNavigator().clearPathEntity();
slimeling.setAttackTarget(null);
}
break;
case 1:
if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
slimeling.slimelingName = (String) this.data.get(2);
slimeling.setName(slimeling.slimelingName);
}
break;
case 2:
if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
slimeling.age += 5000;
}
break;
case 3:
if (!slimeling.isInLove() && player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
slimeling.setInLove(playerBase);
}
break;
case 4:
if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
slimeling.attackDamage = Math.min(slimeling.attackDamage + 0.1F, 1.0F);
}
break;
case 5:
if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
slimeling.setHealth(slimeling.getHealth() + 5.0F);
}
break;
case 6:
if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
MarsUtil.openSlimelingInventory(playerBase, slimeling);
}
break;
}
}
break;
case S_WAKE_PLAYER:
BlockPos c = playerBase.playerLocation;
if (c != null) {
EventWakePlayer event = new EventWakePlayer(playerBase, c, true, true, false, true);
MinecraftForge.EVENT_BUS.post(event);
playerBase.wakeUpPlayer(true, true, false);
}
break;
case S_UPDATE_ADVANCED_GUI:
TileEntity tile = player.worldObj.getTileEntity((BlockPos) this.data.get(1));
switch((Integer) this.data.get(0)) {
case 0:
if (tile instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
launchController.setFrequency((Integer) this.data.get(2));
}
break;
case 1:
if (tile instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
launchController.setLaunchDropdownSelection((Integer) this.data.get(2));
}
break;
case 2:
if (tile instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
launchController.setDestinationFrequency((Integer) this.data.get(2));
}
break;
case 3:
if (tile instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
launchController.launchPadRemovalDisabled = (Integer) this.data.get(2) == 1;
}
break;
case 4:
if (tile instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
launchController.setLaunchSchedulingEnabled((Integer) this.data.get(2) == 1);
}
break;
case 5:
if (tile instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
launchController.requiresClientUpdate = true;
}
break;
default:
break;
}
break;
case S_UPDATE_CARGO_ROCKET_STATUS:
Entity entity2 = player.worldObj.getEntityByID((Integer) this.data.get(0));
if (entity2 instanceof EntityCargoRocket) {
EntityCargoRocket rocket = (EntityCargoRocket) entity2;
int subType = (Integer) this.data.get(1);
switch(subType) {
default:
rocket.statusValid = rocket.checkLaunchValidity();
break;
}
}
break;
case S_SWITCH_LAUNCH_CONTROLLER_GUI:
BlockPos pos = (BlockPos) this.data.get(0);
TileEntity tile1 = player.worldObj.getTileEntity(pos);
if (tile1 instanceof TileEntityLaunchController) {
TileEntityLaunchController launchController = (TileEntityLaunchController) tile1;
switch((Integer) this.data.get(1)) {
case 0:
MarsUtil.openAdvancedLaunchController(playerBase, launchController);
break;
case 1:
player.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_MARS, player.worldObj, pos.getX(), pos.getY(), pos.getZ());
break;
}
}
break;
default:
break;
}
}
use of micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling in project Galacticraft by micdoodle8.
the class EntitySlimeling method spawnBabyAnimal.
public EntitySlimeling spawnBabyAnimal(EntityAgeable par1EntityAgeable) {
if (par1EntityAgeable instanceof EntitySlimeling) {
EntitySlimeling otherSlimeling = (EntitySlimeling) par1EntityAgeable;
Vector3 colorParentA = new Vector3(this.getColorRed(), this.getColorGreen(), this.getColorBlue());
Vector3 colorParentB = new Vector3(otherSlimeling.getColorRed(), otherSlimeling.getColorGreen(), otherSlimeling.getColorBlue());
Vector3 newColor = ColorUtil.addColorsRealistically(colorParentA, colorParentB);
newColor.x = Math.max(Math.min(newColor.x, 1.0F), 0);
newColor.y = Math.max(Math.min(newColor.y, 1.0F), 0);
newColor.z = Math.max(Math.min(newColor.z, 1.0F), 0);
EntitySlimeling newSlimeling = new EntitySlimeling(this.worldObj, (float) newColor.x, (float) newColor.y, (float) newColor.z);
String s = this.getOwnerId();
if (s != null && s.trim().length() > 0) {
newSlimeling.setOwnerId(s);
newSlimeling.setTamed(true);
}
return newSlimeling;
}
return null;
}
use of micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling in project Galacticraft by micdoodle8.
the class PacketSimpleMars method handleClientSide.
@SideOnly(Side.CLIENT)
@Override
public void handleClientSide(EntityPlayer player) {
EntityPlayerSP playerBaseClient = null;
if (player instanceof EntityPlayerSP) {
playerBaseClient = (EntityPlayerSP) player;
}
switch(this.type) {
case C_OPEN_CUSTOM_GUI:
int entityID = 0;
Entity entity = null;
switch((Integer) this.data.get(1)) {
case 0:
entityID = (Integer) this.data.get(2);
entity = player.worldObj.getEntityByID(entityID);
if (entity != null && entity instanceof EntitySlimeling) {
FMLClientHandler.instance().getClient().displayGuiScreen(new GuiSlimelingInventory(player, (EntitySlimeling) entity));
}
player.openContainer.windowId = (Integer) this.data.get(0);
break;
case 1:
entityID = (Integer) this.data.get(2);
entity = player.worldObj.getEntityByID(entityID);
if (entity != null && entity instanceof EntityCargoRocket) {
FMLClientHandler.instance().getClient().displayGuiScreen(new GuiCargoRocket(player.inventory, (EntityCargoRocket) entity));
}
player.openContainer.windowId = (Integer) this.data.get(0);
break;
}
break;
case C_OPEN_CUSTOM_GUI_TILE:
BlockPos pos;
TileEntity tile;
switch((Integer) this.data.get(1)) {
case 0:
pos = (BlockPos) this.data.get(2);
tile = player.worldObj.getTileEntity(pos);
if (tile != null && tile instanceof TileEntityLaunchController) {
FMLClientHandler.instance().getClient().displayGuiScreen(new GuiLaunchControllerAdvanced(player.inventory, (TileEntityLaunchController) tile));
}
player.openContainer.windowId = (Integer) this.data.get(0);
break;
}
break;
case C_BEGIN_CRYOGENIC_SLEEP:
pos = (BlockPos) this.data.get(0);
tile = player.worldObj.getTileEntity(pos);
if (tile instanceof TileEntityCryogenicChamber) {
((TileEntityCryogenicChamber) tile).sleepInBedAt(player, pos.getX(), pos.getY(), pos.getZ());
}
default:
break;
}
}
use of micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling in project Galacticraft by micdoodle8.
the class ContainerSlimeling method addSlots.
public static void addSlots(ContainerSlimeling container, InventoryPlayer playerInventory, EntitySlimeling slimeling) {
Slot slot = new SlotSpecific(slimeling.slimelingInventory, 1, 9, 30, new ItemStack(MarsItems.marsItemBasic, 1, 4));
container.addSlotToContainer(slot);
int var3;
for (var3 = 0; var3 < 3; ++var3) {
for (int var4 = 0; var4 < 9; ++var4) {
slot = new Slot(playerInventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 129 + var3 * 18);
container.addSlotToContainer(slot);
}
}
for (var3 = 0; var3 < 9; ++var3) {
slot = new Slot(playerInventory, var3, 8 + var3 * 18, 187);
container.addSlotToContainer(slot);
}
}
Aggregations