use of micdoodle8.mods.galacticraft.core.tile.TileEntityOxygenCollector in project Galacticraft by micdoodle8.
the class BlockOxygenCollector method randomDisplayTick.
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityOxygenCollector) {
if (((TileEntityOxygenCollector) tile).lastOxygenCollected > 1) {
for (int particleCount = 0; particleCount < 10; particleCount++) {
double x2 = pos.getX() + rand.nextFloat();
double y2 = pos.getY() + rand.nextFloat();
double z2 = pos.getZ() + rand.nextFloat();
double mX = 0.0D;
double mY = 0.0D;
double mZ = 0.0D;
int dir = rand.nextInt(2) * 2 - 1;
mX = (rand.nextFloat() - 0.5D) * 0.5D;
mY = (rand.nextFloat() - 0.5D) * 0.5D;
mZ = (rand.nextFloat() - 0.5D) * 0.5D;
final int meta = getMetaFromState(state);
if (meta == 3 || meta == 2) {
x2 = pos.getX() + 0.5D + 0.25D * dir;
mX = rand.nextFloat() * 2.0F * dir;
} else {
z2 = pos.getZ() + 0.5D + 0.25D * dir;
mZ = rand.nextFloat() * 2.0F * dir;
}
GalacticraftCore.proxy.spawnParticle("oxygen", new Vector3(x2, y2, z2), new Vector3(mX, mY, mZ), new Object[] { new Vector3(0.7D, 0.7D, 1.0D) });
}
}
}
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityOxygenCollector in project Galacticraft by micdoodle8.
the class GuiHandler method getClientGuiElement.
@SideOnly(Side.CLIENT)
private Object getClientGuiElement(int ID, EntityPlayer player, World world, BlockPos position) {
EntityPlayerSP playerClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
if (ID == GuiIdsCore.GALAXY_MAP) {
return new GuiCelestialSelection(true, null);
} else if (ID == GuiIdsCore.ROCKET_INVENTORY && player.ridingEntity instanceof EntityTieredRocket) {
return new GuiRocketInventory(player.inventory, (EntityTieredRocket) player.ridingEntity, ((EntityTieredRocket) player.ridingEntity).getType());
} else if (ID == GuiIdsCore.EXTENDED_INVENTORY) {
return new GuiExtendedInventory(player, ClientProxyCore.dummyInventory);
} else if (ID == GuiIdsCore.SPACE_RACE_START) {
return new GuiNewSpaceRace(player);
} else if (ID == GuiIdsCore.SPACE_RACE_JOIN) {
return new GuiJoinSpaceRace(playerClient);
} else if (ID == GuiIdsCore.PRE_LAUNCH_CHECKLIST) {
return new GuiPreLaunchChecklist(WorldUtil.getAllChecklistKeys(), player.getHeldItem().hasTagCompound() ? (NBTTagCompound) player.getHeldItem().getTagCompound().getTag("checklistData") : null);
}
TileEntity tile = world.getTileEntity(position);
if (tile != null) {
if (tile instanceof TileEntityCrafting) {
return new GuiCrafting(player.inventory, (TileEntityCrafting) tile);
} else if (tile instanceof TileEntityRefinery) {
return new GuiRefinery(player.inventory, (TileEntityRefinery) world.getTileEntity(position));
} else if (tile instanceof TileEntityOxygenCollector) {
return new GuiOxygenCollector(player.inventory, (TileEntityOxygenCollector) tile);
} else if (tile instanceof TileEntityOxygenDistributor) {
return new GuiOxygenDistributor(player.inventory, (TileEntityOxygenDistributor) tile);
} else if (tile instanceof TileEntityFuelLoader) {
return new GuiFuelLoader(player.inventory, (TileEntityFuelLoader) tile);
} else if (tile instanceof TileEntityOxygenSealer) {
return new GuiOxygenSealer(player.inventory, (TileEntityOxygenSealer) tile);
} else if (tile instanceof TileEntityCargoLoader) {
return new GuiCargoLoader(player.inventory, (TileEntityCargoLoader) tile);
} else if (tile instanceof TileEntityCargoUnloader) {
return new GuiCargoUnloader(player.inventory, (TileEntityCargoUnloader) tile);
} else if (tile instanceof TileEntityParaChest) {
return new GuiParaChest(player.inventory, (TileEntityParaChest) tile);
} else if (tile instanceof TileEntitySolar) {
return new GuiSolar(player.inventory, (TileEntitySolar) tile);
} else if (tile instanceof TileEntityAirLockController) {
return new GuiAirLockController((TileEntityAirLockController) tile);
} else if (tile instanceof TileEntityEnergyStorageModule) {
return new GuiEnergyStorageModule(player.inventory, (TileEntityEnergyStorageModule) tile);
} else if (tile instanceof TileEntityCoalGenerator) {
return new GuiCoalGenerator(player.inventory, (TileEntityCoalGenerator) tile);
} else if (tile instanceof TileEntityElectricFurnace) {
return new GuiElectricFurnace(player.inventory, (TileEntityElectricFurnace) tile);
} else if (tile instanceof TileEntityIngotCompressor) {
return new GuiIngotCompressor(player.inventory, (TileEntityIngotCompressor) tile);
} else if (tile instanceof TileEntityElectricIngotCompressor) {
return new GuiElectricIngotCompressor(player.inventory, (TileEntityElectricIngotCompressor) tile);
} else if (tile instanceof TileEntityCircuitFabricator) {
return new GuiCircuitFabricator(player.inventory, (TileEntityCircuitFabricator) tile);
} else if (tile instanceof TileEntityOxygenStorageModule) {
return new GuiOxygenStorageModule(player.inventory, (TileEntityOxygenStorageModule) tile);
} else if (tile instanceof TileEntityOxygenCompressor) {
return new GuiOxygenCompressor(player.inventory, (TileEntityOxygenCompressor) tile);
} else if (tile instanceof TileEntityOxygenDecompressor) {
return new GuiOxygenDecompressor(player.inventory, (TileEntityOxygenDecompressor) tile);
} else if (tile instanceof TileEntityDeconstructor) {
return new GuiDeconstructor(player.inventory, (TileEntityDeconstructor) tile);
} else if (tile instanceof TileEntityPainter) {
return new GuiPainter(player.inventory, (TileEntityPainter) tile);
}
}
if (playerClient != null) {
GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerClient);
for (ISchematicPage page : stats.getUnlockedSchematics()) {
if (ID == page.getGuiID()) {
GuiScreen screen = page.getResultScreen(playerClient, position);
if (screen instanceof ISchematicResultPage) {
((ISchematicResultPage) screen).setPageIndex(page.getPageID());
}
return screen;
}
}
}
return null;
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityOxygenCollector 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;
}
Aggregations