aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/miscutil/xmod/ic2/HANDLER_IC2.java2
-rw-r--r--src/Java/miscutil/xmod/ic2/block/RTGGenerator/BlockRTG.java291
-rw-r--r--src/Java/miscutil/xmod/ic2/item/ItemGenerators.java55
3 files changed, 212 insertions, 136 deletions
diff --git a/src/Java/miscutil/xmod/ic2/HANDLER_IC2.java b/src/Java/miscutil/xmod/ic2/HANDLER_IC2.java
index fd348eef69..cf2e0e3d17 100644
--- a/src/Java/miscutil/xmod/ic2/HANDLER_IC2.java
+++ b/src/Java/miscutil/xmod/ic2/HANDLER_IC2.java
@@ -11,7 +11,7 @@ public class HANDLER_IC2{
public static void preInit() {
if (LoadedMods.IndustrialCraft2){
IC2_Items.register();
- new BlockRTG(InternalName.blockGenerator);
+ new BlockRTG(InternalName.beer);
}
}
diff --git a/src/Java/miscutil/xmod/ic2/block/RTGGenerator/BlockRTG.java b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/BlockRTG.java
index bda119af5c..aefdeb5222 100644
--- a/src/Java/miscutil/xmod/ic2/block/RTGGenerator/BlockRTG.java
+++ b/src/Java/miscutil/xmod/ic2/block/RTGGenerator/BlockRTG.java
@@ -8,15 +8,18 @@ import ic2.core.block.generator.tileentity.TileEntityKineticGenerator;
import ic2.core.block.generator.tileentity.TileEntityRTGenerator;
import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric;
import ic2.core.init.InternalName;
-import ic2.core.item.block.ItemGenerator;
+import java.util.List;
import java.util.Random;
import miscutil.xmod.ic2.block.kieticgenerator.tileentity.TileEntityKineticWindGenerator;
import miscutil.xmod.ic2.item.IC2_Items;
+import miscutil.xmod.ic2.item.ItemGenerators;
import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -28,62 +31,80 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockRTG
- extends BlockMultiID
+extends BlockMultiID
{
- public BlockRTG(InternalName internalName1)
- {
- super(internalName1, Material.iron, ItemGenerator.class);
-
- setHardness(3.0F);
- setStepSound(soundTypeMetal);
-
- IC2_Items.blockRTG = new ItemStack(this, 1, 0);
- IC2_Items.blockKineticGenerator = new ItemStack(this, 1, 1);
-
- GameRegistry.registerTileEntity(TileEntityRTG.class, "Radioisotope Thermoelectric Generator Mach II");
- GameRegistry.registerTileEntity(TileEntityKineticWindGenerator.class, "Kinetic Wind Generator Mach II");
- }
-
- @Override
-public String getTextureFolder(int id)
- {
- return "generator";
- }
-
- @Override
-public int damageDropped(int meta)
- {
- switch (meta)
- {
- case 2:
- return 2;
- }
- return 0;
- }
-
- @Override
-public Class<? extends TileEntity> getTeClass(int meta, MutableObject<Class<?>[]> ctorArgTypes, MutableObject<Object[]> ctorArgs)
- {
- try
- {
- switch (meta)
- {
- case 0:
- return TileEntityRTGenerator.class;
- case 1:
- return TileEntityKineticGenerator.class;
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- return null;
- }
-
- /*
- *
- * {
+ public BlockRTG(InternalName internalName1)
+ {
+ super(internalName1, Material.iron, ItemGenerators.class);
+
+ setHardness(3.0F);
+ setStepSound(soundTypeMetal);
+
+ IC2_Items.blockRTG = new ItemStack(this, 1, 0);
+ IC2_Items.blockKineticGenerator = new ItemStack(this, 1, 1);
+
+ GameRegistry.registerTileEntity(TileEntityRTG.class, "Radioisotope Thermoelectric Generator Mach II");
+ GameRegistry.registerTileEntity(TileEntityKineticWindGenerator.class, "Kinetic Wind Generator Mach II");
+ }
+
+ @Override
+ public void getSubBlocks(Item j, CreativeTabs tabs, List itemList) {
+ Item item = Item.getItemFromBlock(this);
+ if (!item.getHasSubtypes()) {
+ itemList.add(new ItemStack(this));
+ } else {
+ for (int i = 0; i < 16; i++)
+ {
+ ItemStack is = new ItemStack(this, 1, i);
+ if (is.getItem().getUnlocalizedName(is) == null) {
+ break;
+ }
+ itemList.add(is);
+ }
+ }
+ }
+
+
+ @Override
+ public String getTextureFolder(int id)
+ {
+ return "generator";
+ }
+
+ @Override
+ public int damageDropped(int meta)
+ {
+ switch (meta)
+ {
+ case 2:
+ return 2;
+ }
+ return 0;
+ }
+
+ @Override
+ public Class<? extends TileEntity> getTeClass(int meta, MutableObject<Class<?>[]> ctorArgTypes, MutableObject<Object[]> ctorArgs)
+ {
+ try
+ {
+ switch (meta)
+ {
+ case 0:
+ return TileEntityRTGenerator.class;
+ case 1:
+ return TileEntityKineticGenerator.class;
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ return null;
+ }
+
+ /*
+ *
+ * {
case 0:
return TileEntityGenerator.class;
case 1:
@@ -105,83 +126,83 @@ public Class<? extends TileEntity> getTeClass(int meta, MutableObject<Class<?>[]
case 9:
return TileEntityKineticGenerator.class;
}
- *
- * (non-Javadoc)
- * @see net.minecraft.block.Block#randomDisplayTick(net.minecraft.world.World, int, int, int, java.util.Random)
- */
-
- @Override
-public void randomDisplayTick(World world, int x, int y, int z, Random random)
- {
- if (!IC2.platform.isRendering()) {
- return;
- }
- int meta = world.getBlockMetadata(x, y, z);
- if ((meta == 0) && (isActive(world, x, y, z)))
- {
- TileEntityBlock te = (TileEntityBlock)getOwnTe(world, x, y, z);
- if (te == null) {
- return;
- }
- int l = te.getFacing();
- float f = x + 0.5F;
- float f1 = y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
- float f2 = z + 0.5F;
- float f3 = 0.52F;
- float f4 = random.nextFloat() * 0.6F - 0.3F;
- switch (l)
- {
- case 4:
- world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- break;
- case 5:
- world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
- break;
- case 2:
- world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
- break;
- case 3:
- world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
- world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
- }
- }
- else if (meta == 5)
- {
- TileEntityNuclearReactorElectric te = (TileEntityNuclearReactorElectric)getOwnTe(world, x, y, z);
- if (te == null) {
- return;
- }
- int puffs = te.heat / 1000;
- if (puffs <= 0) {
- return;
- }
- puffs = world.rand.nextInt(puffs);
- for (int n = 0; n < puffs; n++) {
- world.spawnParticle("smoke", x + random.nextFloat(), y + 0.95F, z + random.nextFloat(), 0.0D, 0.0D, 0.0D);
- }
- puffs -= world.rand.nextInt(4) + 3;
- for (int n = 0; n < puffs; n++) {
- world.spawnParticle("flame", x + random.nextFloat(), y + 1.0F, z + random.nextFloat(), 0.0D, 0.0D, 0.0D);
- }
- }
- }
-
- @Override
-public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int side, float a, float b, float c)
- {
- if ((entityplayer.getCurrentEquippedItem() != null) && (entityplayer.getCurrentEquippedItem().isItemEqual(Ic2Items.reactorChamber))) {
- return false;
- }
- return super.onBlockActivated(world, i, j, k, entityplayer, side, a, b, c);
- }
-
- @Override
-@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(ItemStack stack)
- {
- return stack.getItemDamage() == 5 ? EnumRarity.uncommon : EnumRarity.common;
- }
+ *
+ * (non-Javadoc)
+ * @see net.minecraft.block.Block#randomDisplayTick(net.minecraft.world.World, int, int, int, java.util.Random)
+ */
+
+ @Override
+ public void randomDisplayTick(World world, int x, int y, int z, Random random)
+ {
+ if (!IC2.platform.isRendering()) {
+ return;
+ }
+ int meta = world.getBlockMetadata(x, y, z);
+ if ((meta == 0) && (isActive(world, x, y, z)))
+ {
+ TileEntityBlock te = (TileEntityBlock)getOwnTe(world, x, y, z);
+ if (te == null) {
+ return;
+ }
+ int l = te.getFacing();
+ float f = x + 0.5F;
+ float f1 = y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
+ float f2 = z + 0.5F;
+ float f3 = 0.52F;
+ float f4 = random.nextFloat() * 0.6F - 0.3F;
+ switch (l)
+ {
+ case 4:
+ world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
+ break;
+ case 5:
+ world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
+ break;
+ case 2:
+ world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
+ break;
+ case 3:
+ world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
+ }
+ }
+ else if (meta == 5)
+ {
+ TileEntityNuclearReactorElectric te = (TileEntityNuclearReactorElectric)getOwnTe(world, x, y, z);
+ if (te == null) {
+ return;
+ }
+ int puffs = te.heat / 1000;
+ if (puffs <= 0) {
+ return;
+ }
+ puffs = world.rand.nextInt(puffs);
+ for (int n = 0; n < puffs; n++) {
+ world.spawnParticle("smoke", x + random.nextFloat(), y + 0.95F, z + random.nextFloat(), 0.0D, 0.0D, 0.0D);
+ }
+ puffs -= world.rand.nextInt(4) + 3;
+ for (int n = 0; n < puffs; n++) {
+ world.spawnParticle("flame", x + random.nextFloat(), y + 1.0F, z + random.nextFloat(), 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int side, float a, float b, float c)
+ {
+ if ((entityplayer.getCurrentEquippedItem() != null) && (entityplayer.getCurrentEquippedItem().isItemEqual(Ic2Items.reactorChamber))) {
+ return false;
+ }
+ return super.onBlockActivated(world, i, j, k, entityplayer, side, a, b, c);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack stack)
+ {
+ return stack.getItemDamage() == 5 ? EnumRarity.uncommon : EnumRarity.common;
+ }
}
diff --git a/src/Java/miscutil/xmod/ic2/item/ItemGenerators.java b/src/Java/miscutil/xmod/ic2/item/ItemGenerators.java
new file mode 100644
index 0000000000..d7437a0b69
--- /dev/null
+++ b/src/Java/miscutil/xmod/ic2/item/ItemGenerators.java
@@ -0,0 +1,55 @@
+package miscutil.xmod.ic2.item;
+
+import ic2.core.item.block.ItemBlockIC2;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+
+public class ItemGenerators
+ extends ItemBlockIC2
+{
+ public ItemGenerators(Block block)
+ {
+ super(block);
+
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ }
+
+ @Override
+public int getMetadata(int i)
+ {
+ return i;
+ }
+
+ @Override
+public String getUnlocalizedName(ItemStack itemstack)
+ {
+ int meta = itemstack.getItemDamage();
+ switch (meta)
+ {
+ case 0:
+ return "ic2.blockRTGenerator2";
+ case 1:
+ return "ic2.blockKineticGenerator2";
+ }
+ return null;
+ }
+
+ @Override
+public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean b)
+ {
+ int meta = itemStack.getItemDamage();
+ switch (meta)
+ {
+ case 0:
+ info.add(StatCollector.translateToLocal("ic2.item.tooltip.PowerOutput") + " 1-32 EU/t " + StatCollector.translateToLocal("ic2.item.tooltip.max")); break;
+ case 1:
+ info.add(StatCollector.translateToLocal("ic2.item.tooltip.PowerOutput") + " 1-512 EU/t " + StatCollector.translateToLocal("ic2.item.tooltip.max"));
+ }
+ }
+}