use of micdoodle8.mods.galacticraft.core.inventory.ContainerParaChest in project Galacticraft by micdoodle8.
the class GCCoreUtil method openParachestInv.
public static void openParachestInv(EntityPlayerMP player, EntityLanderBase landerInv) {
player.getNextWindowId();
player.closeContainer();
int windowId = player.currentWindowId;
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_PARACHEST_GUI, GCCoreUtil.getDimensionID(player.worldObj), new Object[] { windowId, 1, landerInv.getEntityId() }), player);
player.openContainer = new ContainerParaChest(player.inventory, landerInv, player);
player.openContainer.windowId = windowId;
player.openContainer.onCraftGuiOpened(player);
}
use of micdoodle8.mods.galacticraft.core.inventory.ContainerParaChest in project Galacticraft by micdoodle8.
the class GuiHandler method getServerGuiElement.
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
if (playerBase == null) {
player.addChatMessage(new ChatComponentText("Galacticraft player instance null server-side. This is a bug."));
return null;
}
GCPlayerStats stats = GCPlayerStats.get(playerBase);
if (ID == GuiIdsCore.ROCKET_INVENTORY && player.ridingEntity instanceof EntityTieredRocket) {
return new ContainerRocketInventory(player.inventory, (EntityTieredRocket) player.ridingEntity, ((EntityTieredRocket) player.ridingEntity).getType(), player);
} else if (ID == GuiIdsCore.EXTENDED_INVENTORY) {
return new ContainerExtendedInventory(player, stats.getExtendedInventory());
}
BlockPos pos = new BlockPos(x, y, z);
TileEntity tile = world.getTileEntity(pos);
if (tile != null) {
if (tile instanceof TileEntityCrafting) {
return new ContainerCrafting(player.inventory, (TileEntityCrafting) tile);
} else if (tile instanceof TileEntityRefinery) {
return new ContainerRefinery(player.inventory, (TileEntityRefinery) tile, player);
} else if (tile instanceof TileEntityOxygenCollector) {
return new ContainerOxygenCollector(player.inventory, (TileEntityOxygenCollector) tile);
} else if (tile instanceof TileEntityOxygenDistributor) {
return new ContainerOxygenDistributor(player.inventory, (TileEntityOxygenDistributor) tile);
} else if (tile instanceof TileEntityFuelLoader) {
return new ContainerFuelLoader(player.inventory, (TileEntityFuelLoader) tile);
} else if (tile instanceof TileEntityOxygenSealer) {
return new ContainerOxygenSealer(player.inventory, (TileEntityOxygenSealer) tile);
} else if (tile instanceof TileEntityCargoLoader) {
return new ContainerCargoLoader(player.inventory, (TileEntityCargoLoader) tile);
} else if (tile instanceof TileEntityCargoUnloader) {
return new ContainerCargoLoader(player.inventory, (TileEntityCargoUnloader) tile);
} else if (tile instanceof TileEntityParaChest) {
return new ContainerParaChest(player.inventory, (TileEntityParaChest) tile, player);
} else if (tile instanceof TileEntitySolar) {
return new ContainerSolar(player.inventory, (TileEntitySolar) tile);
} else if (tile instanceof TileEntityEnergyStorageModule) {
return new ContainerEnergyStorageModule(player.inventory, (TileEntityEnergyStorageModule) tile);
} else if (tile instanceof TileEntityCoalGenerator) {
return new ContainerCoalGenerator(player.inventory, (TileEntityCoalGenerator) tile);
} else if (tile instanceof TileEntityElectricFurnace) {
return new ContainerElectricFurnace(player.inventory, (TileEntityElectricFurnace) tile);
} else if (tile instanceof TileEntityIngotCompressor) {
return new ContainerIngotCompressor(player.inventory, (TileEntityIngotCompressor) tile);
} else if (tile instanceof TileEntityElectricIngotCompressor) {
return new ContainerElectricIngotCompressor(player.inventory, (TileEntityElectricIngotCompressor) tile);
} else if (tile instanceof TileEntityCircuitFabricator) {
return new ContainerCircuitFabricator(player.inventory, (TileEntityCircuitFabricator) tile);
} else if (tile instanceof TileEntityOxygenStorageModule) {
return new ContainerOxygenStorageModule(player.inventory, (TileEntityOxygenStorageModule) tile);
} else if (tile instanceof TileEntityOxygenCompressor) {
return new ContainerOxygenCompressor(player.inventory, (TileEntityOxygenCompressor) tile, player);
} else if (tile instanceof TileEntityOxygenDecompressor) {
return new ContainerOxygenDecompressor(player.inventory, (TileEntityOxygenDecompressor) tile, player);
} else if (tile instanceof TileEntityDeconstructor) {
return new ContainerDeconstructor(player.inventory, (TileEntityDeconstructor) tile);
} else if (tile instanceof TileEntityPainter) {
return new ContainerPainter(player.inventory, (TileEntityPainter) tile);
}
}
for (ISchematicPage page : stats.getUnlockedSchematics()) {
if (ID == page.getGuiID()) {
return page.getResultContainer(playerBase, new BlockPos(x, y, z));
}
}
return null;
}
use of micdoodle8.mods.galacticraft.core.inventory.ContainerParaChest in project Galacticraft by micdoodle8.
the class TileEntityParaChest method update.
@Override
public void update() {
super.update();
float f;
if (!this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticks + this.getPos().getX() + this.getPos().getY() + this.getPos().getZ()) % 200 == 0) {
this.numUsingPlayers = 0;
f = 5.0F;
List<?> list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.getPos().getX() - f, this.getPos().getY() - f, this.getPos().getZ() - f, this.getPos().getX() + 1 + f, this.getPos().getY() + 1 + f, this.getPos().getZ() + 1 + f));
Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
if (entityplayer.openContainer instanceof ContainerParaChest) {
++this.numUsingPlayers;
}
}
}
this.prevLidAngle = this.lidAngle;
f = 0.1F;
double d0;
if (this.numUsingPlayers > 0 && this.lidAngle == 0.0F) {
double d1 = this.getPos().getX() + 0.5D;
d0 = this.getPos().getZ() + 0.5D;
this.worldObj.playSoundEffect(d1, this.getPos().getY() + 0.5D, d0, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F) {
float f1 = this.lidAngle;
if (this.numUsingPlayers > 0) {
this.lidAngle += f;
} else {
this.lidAngle -= f;
}
if (this.lidAngle > 1.0F) {
this.lidAngle = 1.0F;
}
float f2 = 0.5F;
if (this.lidAngle < f2 && f1 >= f2) {
d0 = this.getPos().getX() + 0.5D;
double d2 = this.getPos().getZ() + 0.5D;
this.worldObj.playSoundEffect(d0, this.getPos().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.lidAngle < 0.0F) {
this.lidAngle = 0.0F;
}
}
if (!this.worldObj.isRemote) {
this.checkFluidTankTransfer(this.chestContents.length - 1, this.fuelTank);
}
}
use of micdoodle8.mods.galacticraft.core.inventory.ContainerParaChest in project Galacticraft by micdoodle8.
the class MarsUtil method openParachestInventory.
public static void openParachestInventory(EntityPlayerMP player, EntityLandingBalloons landerInv) {
player.getNextWindowId();
player.closeContainer();
int windowId = player.currentWindowId;
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_PARACHEST_GUI, GCCoreUtil.getDimensionID(player.worldObj), new Object[] { windowId, 1, landerInv.getEntityId() }), player);
player.openContainer = new ContainerParaChest(player.inventory, landerInv, player);
player.openContainer.windowId = windowId;
player.openContainer.onCraftGuiOpened(player);
}
Aggregations