mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-26 06:43:01 +00:00
Refractored Code
+added Solar Factory -removed unnessecary solar and essentia generator classes +started gtnh researches +added tooltip clearance on solars (maximal output) Signed-off-by: bartimaeusnek <[email protected]>
This commit is contained in:
1 parent
980df8516a
commit
0fecf28b65
397 files changed
+8693
-9288
No files matched your search
@@ -5,21 +5,21 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public abstract class BlockBase extends Block {
|
||||
public final String name;
|
||||
public final String name;
|
||||
|
||||
public BlockBase(String unlocName, Material material, String textureName, SoundType soundType, float hardness) {
|
||||
super(material);
|
||||
name = unlocName;
|
||||
setBlockName(EMT.MOD_ID + ".block." + unlocName);
|
||||
if (textureName != null) {
|
||||
setBlockTextureName(EMT.TEXTURE_PATH + ":" + textureName);
|
||||
}
|
||||
setCreativeTab(EMT.TAB);
|
||||
setStepSound(soundType);
|
||||
setHardness(hardness);
|
||||
}
|
||||
public BlockBase(String unlocName, Material material, String textureName, SoundType soundType, float hardness) {
|
||||
super(material);
|
||||
name = unlocName;
|
||||
setBlockName(EMT.MOD_ID + ".block." + unlocName);
|
||||
if (textureName != null) {
|
||||
setBlockTextureName(EMT.TEXTURE_PATH + ":" + textureName);
|
||||
}
|
||||
setCreativeTab(EMT.TAB);
|
||||
setStepSound(soundType);
|
||||
setHardness(hardness);
|
||||
}
|
||||
|
||||
public BlockBase(String unlocName, Material material, SoundType soundType, float hardness) {
|
||||
this(unlocName, material, null, soundType, hardness);
|
||||
}
|
||||
public BlockBase(String unlocName, Material material, SoundType soundType, float hardness) {
|
||||
this(unlocName, material, null, soundType, hardness);
|
||||
}
|
||||
}
|
||||
@@ -17,137 +17,142 @@ import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockBaseContainer extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IconSet[] iconSets;
|
||||
public int instance;
|
||||
public int countOfMetas;
|
||||
@SideOnly(Side.CLIENT)
|
||||
IconSet[] iconSets;
|
||||
|
||||
public int instance;
|
||||
public int countOfMetas;
|
||||
public BlockBaseContainer(String unlocName, Material material, SoundType soundType, float hardness) {
|
||||
this(unlocName, material, soundType, 1, hardness);
|
||||
}
|
||||
|
||||
public BlockBaseContainer(String unlocName, Material material, SoundType soundType, float hardness) {
|
||||
this(unlocName, material, soundType, 1, hardness);
|
||||
}
|
||||
public BlockBaseContainer(String unlocName, Material material, SoundType soundType, int countOfMetas, float hardness) {
|
||||
this(unlocName, material, soundType, countOfMetas, 0, hardness);
|
||||
}
|
||||
|
||||
public BlockBaseContainer(String unlocName, Material material, SoundType soundType, int countOfMetas, float hardness) {
|
||||
this(unlocName, material, soundType, countOfMetas, 0, hardness);
|
||||
}
|
||||
public BlockBaseContainer(String unlocName, Material material, SoundType soundType, int countOfMetas, int curInstance, float hardness) {
|
||||
super(material);
|
||||
this.setBlockName(EMT.MOD_ID + "." + unlocName);
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
this.setStepSound(soundType);
|
||||
this.setHardness(hardness);
|
||||
|
||||
public BlockBaseContainer(String unlocName, Material material, SoundType soundType, int countOfMetas, int curInstance, float hardness) {
|
||||
super(material);
|
||||
this.setBlockName(EMT.MOD_ID + "." + unlocName);
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
this.setStepSound(soundType);
|
||||
this.setHardness(hardness);
|
||||
this.countOfMetas = countOfMetas;
|
||||
this.instance = curInstance;
|
||||
|
||||
this.countOfMetas = countOfMetas;
|
||||
this.instance = curInstance;
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
iconSets = new IconSet[countOfMetas];
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
iconSets = new IconSet[countOfMetas];
|
||||
for (int meta = 0; meta < countOfMetas; meta++) {
|
||||
iconSets[meta] = new IconSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int meta = 0; meta < countOfMetas; meta++) {
|
||||
iconSets[meta] = new IconSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IconSet[] getIconSets() {
|
||||
return iconSets;
|
||||
}
|
||||
public IconSet[] getIconSets() {
|
||||
return iconSets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) {
|
||||
TileEntityEMT tile = (TileEntityEMT) access.getTileEntity(x, y, z);
|
||||
int meta = access.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) {
|
||||
TileEntityEMT tile = (TileEntityEMT) access.getTileEntity(x, y, z);
|
||||
int meta = access.getBlockMetadata(x, y, z);
|
||||
|
||||
IconSet set = iconSets[meta];
|
||||
if (meta >= countOfMetas)
|
||||
return null;
|
||||
|
||||
if (side == 0) {
|
||||
return set.bottom;
|
||||
}
|
||||
else if (side == 1) {
|
||||
return set.top;
|
||||
}
|
||||
else if (side != tile.facing) {
|
||||
return set.side;
|
||||
}
|
||||
else if (tile.isOn) {
|
||||
if (set.frontOn != null) {
|
||||
return set.frontOn;
|
||||
}
|
||||
IconSet set = iconSets[meta];
|
||||
|
||||
if (set.frontOff != null) {
|
||||
return set.frontOff;
|
||||
}
|
||||
if (side == 0) {
|
||||
return set.bottom;
|
||||
} else if (side == 1) {
|
||||
return set.top;
|
||||
} else if (side != tile.facing) {
|
||||
return set.side;
|
||||
} else if (tile.isOn) {
|
||||
if (set.frontOn != null) {
|
||||
return set.frontOn;
|
||||
}
|
||||
|
||||
return set.side;
|
||||
}
|
||||
else {
|
||||
if (set.frontOff != null) {
|
||||
return set.frontOff;
|
||||
}
|
||||
if (set.frontOff != null) {
|
||||
return set.frontOff;
|
||||
}
|
||||
|
||||
return set.side;
|
||||
}
|
||||
}
|
||||
return set.side;
|
||||
} else {
|
||||
if (set.frontOff != null) {
|
||||
return set.frontOff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
IconSet set = iconSets[meta];
|
||||
return set.side;
|
||||
}
|
||||
}
|
||||
|
||||
if (side < 1) {
|
||||
return set.bottom;
|
||||
}
|
||||
if (side == 1) {
|
||||
return set.top;
|
||||
}
|
||||
if (side == 3) {
|
||||
return set.frontOff;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
return set.side;
|
||||
}
|
||||
if (meta >= countOfMetas)
|
||||
return null;
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) {
|
||||
int facing = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
TileEntityEMT tile = (TileEntityEMT) world.getTileEntity(x, y, z);
|
||||
IconSet set = iconSets[meta];
|
||||
|
||||
switch (facing) {
|
||||
case 0:
|
||||
tile.facing = 2;
|
||||
break;
|
||||
if (side < 1) {
|
||||
return set.bottom;
|
||||
}
|
||||
if (side == 1) {
|
||||
return set.top;
|
||||
}
|
||||
if (side == 3) {
|
||||
return set.frontOff;
|
||||
}
|
||||
|
||||
case 1:
|
||||
tile.facing = 5;
|
||||
break;
|
||||
return set.side;
|
||||
}
|
||||
|
||||
case 2:
|
||||
tile.facing = 3;
|
||||
break;
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) {
|
||||
int facing = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
TileEntityEMT tile = (TileEntityEMT) world.getTileEntity(x, y, z);
|
||||
|
||||
case 3:
|
||||
tile.facing = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tile == null)
|
||||
return;
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
switch (facing) {
|
||||
case 0:
|
||||
tile.facing = 2;
|
||||
break;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class IconSet {
|
||||
public IIcon top;
|
||||
public IIcon bottom;
|
||||
public IIcon side;
|
||||
public IIcon frontOff;
|
||||
public IIcon frontOn;
|
||||
}
|
||||
case 1:
|
||||
tile.facing = 5;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tile.facing = 3;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tile.facing = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class IconSet {
|
||||
public IIcon top;
|
||||
public IIcon bottom;
|
||||
public IIcon side;
|
||||
public IIcon frontOff;
|
||||
public IIcon frontOn;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package emt.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
@@ -16,78 +14,80 @@ import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockElectricCloud extends BlockBase {
|
||||
public IIcon icon;
|
||||
public IIcon icon;
|
||||
|
||||
public BlockElectricCloud(String unlocName) {
|
||||
super(unlocName, Material.cloth, soundTypeCloth, 0.1f);
|
||||
setBlockBounds(0.3f, 0.3f, 0.3f, 0.7f, 0.7f, 0.7f);
|
||||
}
|
||||
public BlockElectricCloud(String unlocName) {
|
||||
super(unlocName, Material.cloth, soundTypeCloth, 0.1f);
|
||||
setBlockBounds(0.3f, 0.3f, 0.3f, 0.7f, 0.7f, 0.7f);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rnd) {
|
||||
FXSparkle ef = new FXSparkle(world, x + 0.5F, y + 0.5F, z + 0.5F, x + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, y + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, z + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, 1.0F, 6, 3);
|
||||
ef.setGravity(0.05F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rnd) {
|
||||
FXSparkle ef = new FXSparkle(world, x + 0.5F, y + 0.5F, z + 0.5F, x + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, y + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, z + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, 1.0F, 6, 3);
|
||||
ef.setGravity(0.05F);
|
||||
ParticleEngine.instance.addEffect(world, ef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileElectricCloud();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileElectricCloud();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "tile.EMT." + super.getUnlocalizedName().substring(15);
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "tile.EMT." + super.getUnlocalizedName().substring(15);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
icon = ir.registerIcon(EMT.TEXTURE_PATH + ":empty");
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
icon = ir.registerIcon(EMT.TEXTURE_PATH + ":empty");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package emt.block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
import emt.tile.generator.*;
|
||||
import emt.tile.generator.TileEntityBaseGenerator;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntitySmokeFX;
|
||||
@@ -20,88 +20,73 @@ import java.util.Random;
|
||||
|
||||
public class BlockEssentiaGenerators extends BlockBaseContainer {
|
||||
|
||||
private static int subtypes=6;
|
||||
|
||||
public BlockEssentiaGenerators(String name) {
|
||||
super(name, Material.iron, soundTypeMetal, subtypes, 4.0F);
|
||||
}
|
||||
private static int subtypes = 6;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
super.registerBlockIcons(ir);
|
||||
this.blockIcon = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/top");
|
||||
public BlockEssentiaGenerators(String name) {
|
||||
super(name, Material.iron, soundTypeMetal, subtypes, 4.0F);
|
||||
}
|
||||
|
||||
for (int meta = 0; meta < subtypes; meta++) {
|
||||
iconSets[meta].top = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/top");
|
||||
iconSets[meta].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/top");
|
||||
iconSets[meta].side = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/side");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
super.registerBlockIcons(ir);
|
||||
this.blockIcon = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/top");
|
||||
|
||||
iconSets[0].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/potentiafront");
|
||||
iconSets[1].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/ignisfront");
|
||||
iconSets[2].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/auramfront");
|
||||
iconSets[3].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/arborfront");
|
||||
iconSets[4].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/aerfront");
|
||||
iconSets[5].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/aerfront");
|
||||
}
|
||||
for (int meta = 0; meta < subtypes; meta++) {
|
||||
iconSets[meta].top = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/top");
|
||||
iconSets[meta].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/top");
|
||||
iconSets[meta].side = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(id, 1, 0));
|
||||
list.add(new ItemStack(id, 1, 1));
|
||||
list.add(new ItemStack(id, 1, 2));
|
||||
list.add(new ItemStack(id, 1, 3));
|
||||
list.add(new ItemStack(id, 1, 4));
|
||||
list.add(new ItemStack(id, 1, 5));
|
||||
}
|
||||
iconSets[0].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/potentiafront");
|
||||
iconSets[1].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/ignisfront");
|
||||
iconSets[2].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/auramfront");
|
||||
iconSets[3].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/arborfront");
|
||||
iconSets[4].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/aerfront");
|
||||
iconSets[5].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":essentiagenerator/aerfront");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return new TileEntityPotentiaGenerator();
|
||||
case 1:
|
||||
return new TileEntityIgnisGenerator();
|
||||
case 2:
|
||||
return new TileEntityAuramGenerator();
|
||||
case 3:
|
||||
return new TileEntityArborGenerator();
|
||||
case 4:
|
||||
return new TileEntityAerGenerator();
|
||||
case 5:
|
||||
return new TileEntityLucrumGenerator();
|
||||
}
|
||||
return super.createTileEntity(world, meta);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(id, 1, 0));
|
||||
list.add(new ItemStack(id, 1, 1));
|
||||
list.add(new ItemStack(id, 1, 2));
|
||||
list.add(new ItemStack(id, 1, 3));
|
||||
list.add(new ItemStack(id, 1, 4));
|
||||
list.add(new ItemStack(id, 1, 5));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
TileEntityBaseGenerator te = (TileEntityBaseGenerator) world.getTileEntity(x, y, z);
|
||||
if (te.isActive) {
|
||||
int color = te.aspect.getColor();
|
||||
float r = (float) (color >> 16 & 0xff) / 255F;
|
||||
float g = (float) (color >> 8 & 0xff) / 255F;
|
||||
float b = (float) (color & 0xff) / 255F;
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return new TileEntityBaseGenerator(meta);
|
||||
}
|
||||
|
||||
EntitySmokeFX fx = new EntitySmokeFX(world, x + 0.5f, y + 1.1, z + 0.5f, 0, 0.1, 0, 3);
|
||||
fx.setRBGColorF(r, g, b);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3)
|
||||
{
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
if (tileentity != null) {
|
||||
player.openGui(emt.EMT.instance, 1, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
TileEntityBaseGenerator te = (TileEntityBaseGenerator) world.getTileEntity(x, y, z);
|
||||
if (te.isActive) {
|
||||
int color = te.aspect.getColor();
|
||||
float r = (float) (color >> 16 & 0xff) / 255F;
|
||||
float g = (float) (color >> 8 & 0xff) / 255F;
|
||||
float b = (float) (color & 0xff) / 255F;
|
||||
|
||||
EntitySmokeFX fx = new EntitySmokeFX(world, x + 0.5f, y + 1.1, z + 0.5f, 0, 0.1, 0, 3);
|
||||
fx.setRBGColorF(r, g, b);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
if (tileentity != null) {
|
||||
player.openGui(emt.EMT.instance, 1, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package emt.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
import emt.gthandler.common.implementations.automation.EssentiaFiller;
|
||||
import emt.tile.TileEntityEtherealMacerator;
|
||||
import emt.tile.TileEntityIndustrialWandRecharge;
|
||||
import ic2.api.item.IC2Items;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -18,120 +19,115 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
import emt.tile.TileEntityEtherealMacerator;
|
||||
import emt.tile.TileEntityIndustrialWandRecharge;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockMachines extends BlockBaseContainer {
|
||||
|
||||
public BlockMachines(String name) {
|
||||
super(name, Material.iron, soundTypeMetal, 3, 4.0F);
|
||||
}
|
||||
public BlockMachines(String name) {
|
||||
super(name, Material.iron, soundTypeMetal, 3, 4.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
super.registerBlockIcons(ir);
|
||||
|
||||
this.blockIcon = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/top");
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
super.registerBlockIcons(ir);
|
||||
|
||||
iconSets[0].top = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/top");
|
||||
iconSets[1].top = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
iconSets[2].top = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
this.blockIcon = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/top");
|
||||
|
||||
iconSets[0].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/side");
|
||||
iconSets[1].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmacerator");
|
||||
iconSets[2].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
iconSets[0].top = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/top");
|
||||
iconSets[1].top = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
iconSets[2].top = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
|
||||
iconSets[0].side = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/side");
|
||||
iconSets[1].side = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmacerator");
|
||||
iconSets[2].side = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
iconSets[0].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/side");
|
||||
iconSets[1].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmacerator");
|
||||
iconSets[2].bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
|
||||
iconSets[0].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/wandcharger");
|
||||
iconSets[1].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratorfront");
|
||||
iconSets[2].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
iconSets[0].side = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/side");
|
||||
iconSets[1].side = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmacerator");
|
||||
iconSets[2].side = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
|
||||
iconSets[0].frontOn = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/wandcharger");
|
||||
iconSets[1].frontOn = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratorfrontactive");
|
||||
iconSets[2].frontOn = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
}
|
||||
iconSets[0].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/wandcharger");
|
||||
iconSets[1].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratorfront");
|
||||
iconSets[2].frontOff = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(id, 1, 0));
|
||||
list.add(new ItemStack(id, 1, 1));
|
||||
list.add(new ItemStack(id, 1, 2));
|
||||
}
|
||||
iconSets[0].frontOn = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/wandcharger");
|
||||
iconSets[1].frontOn = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratorfrontactive");
|
||||
iconSets[2].frontOn = ir.registerIcon(EMT.TEXTURE_PATH + ":machines/etherealmaceratortop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
if (meta == 0) {
|
||||
return new TileEntityIndustrialWandRecharge();
|
||||
}
|
||||
else if (meta == 1) {
|
||||
return new TileEntityEtherealMacerator();
|
||||
}
|
||||
else if (meta == 2){
|
||||
return new EssentiaFiller();
|
||||
}
|
||||
return super.createTileEntity(world, meta);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(id, 1, 0));
|
||||
list.add(new ItemStack(id, 1, 1));
|
||||
list.add(new ItemStack(id, 1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityIndustrialWandRecharge) {
|
||||
player.openGui(EMT.instance, 0, world, x, y, z);
|
||||
}
|
||||
else if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityEtherealMacerator) {
|
||||
player.openGui(EMT.instance, 1, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
if (meta == 0) {
|
||||
return new TileEntityIndustrialWandRecharge();
|
||||
} else if (meta == 1) {
|
||||
return new TileEntityEtherealMacerator();
|
||||
} else if (meta == 2) {
|
||||
return new EssentiaFiller();
|
||||
}
|
||||
return super.createTileEntity(world, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return IC2Items.getItem("machine").getItem();
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityIndustrialWandRecharge) {
|
||||
player.openGui(EMT.instance, 0, world, x, y, z);
|
||||
} else if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityEtherealMacerator) {
|
||||
player.openGui(EMT.instance, 1, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
dropItems(world, x, y, z);
|
||||
world.removeTileEntity(x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return IC2Items.getItem("machine").getItem();
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z) {
|
||||
Random rand = world.rand;
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
return;
|
||||
}
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
dropItems(world, x, y, z);
|
||||
world.removeTileEntity(x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
private void dropItems(World world, int x, int y, int z) {
|
||||
Random rand = world.rand;
|
||||
|
||||
if (item != null && item.stackSize > 0) {
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
return;
|
||||
}
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
if (item != null && item.stackSize > 0) {
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,68 +17,68 @@ import java.util.Random;
|
||||
|
||||
public class BlockPortableNode extends BlockAiry {
|
||||
|
||||
public IIcon texture;
|
||||
public IIcon texture;
|
||||
|
||||
public BlockPortableNode(String name) {
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
setBlockName(EMT.MOD_ID + "." + name);
|
||||
setBlockUnbreakable();
|
||||
}
|
||||
public BlockPortableNode(String name) {
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
setBlockName(EMT.MOD_ID + "." + name);
|
||||
setBlockUnbreakable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return new TileEntityPortableNode();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return new TileEntityPortableNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||
}
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ri) {
|
||||
texture = ri.registerIcon(EMT.TEXTURE_PATH + ":portablenode");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ri) {
|
||||
texture = ri.registerIcon(EMT.TEXTURE_PATH + ":portablenode");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return texture;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote && player.isSneaking() && player.getHeldItem() == null) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
if (!world.isRemote && player.isSneaking() && player.getHeldItem() == null) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package emt.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
import emt.tile.generator.TileEntityBaseGenerator;
|
||||
import emt.tile.generator.TileEntityReflexionGen;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntitySmokeFX;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockReflectedGen
|
||||
extends BlockBaseContainer
|
||||
{
|
||||
private int subtypes;
|
||||
private static int overalltypes = TileEntityReflexionGen.L.size();
|
||||
public static short Set;
|
||||
private int[] posInList;
|
||||
|
||||
public BlockReflectedGen(String name, short Set)
|
||||
{
|
||||
super(name, Material.iron, soundTypeMetal, 16, 4.0F);
|
||||
this.Set = Set;
|
||||
this.subtypes = 16;
|
||||
|
||||
if ((Set*16) > overalltypes)
|
||||
subtypes= ((Set-1)*16)+overalltypes-((Set-1)*16);
|
||||
|
||||
posInList= new int[subtypes];
|
||||
if ((Set*16) < overalltypes)
|
||||
for (int i=0; i<subtypes;++i) {
|
||||
posInList[i]=(Set*16)+i;
|
||||
}
|
||||
else if ((Set*16) > overalltypes)
|
||||
for (int i=0; i<subtypes;++i) {
|
||||
posInList[i]=((Set-1)*16)+overalltypes-((Set-1)*16)+i;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir)
|
||||
{
|
||||
super.registerBlockIcons(ir);
|
||||
this.blockIcon = ir.registerIcon("emt:machines/top");
|
||||
for (int meta = 0; meta < this.subtypes; meta++)
|
||||
{
|
||||
this.iconSets[meta].top = ir.registerIcon("emt:essentiagenerator/top");
|
||||
this.iconSets[meta].bottom = ir.registerIcon("emt:essentiagenerator/top");
|
||||
this.iconSets[meta].side = ir.registerIcon("emt:essentiagenerator/side");
|
||||
}
|
||||
for (int i = 0; i < this.subtypes; i++) {
|
||||
this.iconSets[i].frontOff = ir.registerIcon("emt:essentiagenerator/side");
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < this.subtypes; i++) {
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity createTileEntity(World world, int meta)
|
||||
{
|
||||
return TileEntityReflexionGen.Gens[posInList[meta]];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
TileEntityBaseGenerator te = (TileEntityBaseGenerator)world.getTileEntity(x, y, z);
|
||||
if (te.isActive)
|
||||
{
|
||||
int color = te.aspect.getColor();
|
||||
float r = (color >> 16 & 0xFF) / 255.0F;
|
||||
float g = (color >> 8 & 0xFF) / 255.0F;
|
||||
float b = (color & 0xFF) / 255.0F;
|
||||
|
||||
EntitySmokeFX fx = new EntitySmokeFX(world, x + 0.5F, y + 1.1D, z + 0.5F, 0.0D, 0.1D, 0.0D, 3.0F);
|
||||
fx.setRBGColorF(r, g, b);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3)
|
||||
{
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
if (tileentity != null) {
|
||||
player.openGui(EMT.instance, 1, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,62 +16,62 @@ import java.util.Random;
|
||||
|
||||
public class BlockShield extends Block {
|
||||
|
||||
public BlockShield(String name) {
|
||||
super(Material.rock);
|
||||
setBlockName(EMT.MOD_ID + "." + name);
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
this.setHardness(1F);
|
||||
this.setResistance(10000000000000000000000000000000000000F);
|
||||
}
|
||||
public BlockShield(String name) {
|
||||
super(Material.rock);
|
||||
setBlockName(EMT.MOD_ID + "." + name);
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
this.setHardness(1F);
|
||||
this.setResistance(10000000000000000000000000000000000000F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(EMT.TEXTURE_PATH + ":shield");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(EMT.TEXTURE_PATH + ":shield");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||
}
|
||||
@Override
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||
}
|
||||
}
|
||||
@@ -3,27 +3,7 @@ package emt.block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
import emt.tile.solar.air.TileEntityAirSolar;
|
||||
import emt.tile.solar.air.TileEntityDoubleAirSolar;
|
||||
import emt.tile.solar.air.TileEntityTripleAirSolar;
|
||||
import emt.tile.solar.compressed.TileEntityCompressedSolar;
|
||||
import emt.tile.solar.compressed.TileEntityDoubleCompressedSolar;
|
||||
import emt.tile.solar.compressed.TileEntityTripleCompressedSolar;
|
||||
import emt.tile.solar.dark.TileEntityDarkSolar;
|
||||
import emt.tile.solar.dark.TileEntityDoubleDarkSolar;
|
||||
import emt.tile.solar.dark.TileEntityTripleDarkSolar;
|
||||
import emt.tile.solar.earth.TileEntityDoubleEarthSolar;
|
||||
import emt.tile.solar.earth.TileEntityEarthSolar;
|
||||
import emt.tile.solar.earth.TileEntityTripleEarthSolar;
|
||||
import emt.tile.solar.fire.TileEntityDoubleFireSolar;
|
||||
import emt.tile.solar.fire.TileEntityFireSolar;
|
||||
import emt.tile.solar.fire.TileEntityTripleFireSolar;
|
||||
import emt.tile.solar.order.TileEntityDoubleOrderSolar;
|
||||
import emt.tile.solar.order.TileEntityOrderSolar;
|
||||
import emt.tile.solar.order.TileEntityTripleOrderSolar;
|
||||
import emt.tile.solar.water.TileEntityDoubleWaterSolar;
|
||||
import emt.tile.solar.water.TileEntityTripleWaterSolar;
|
||||
import emt.tile.solar.water.TileEntityWaterSolar;
|
||||
import emt.tile.solar.Solars;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -36,208 +16,138 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class BlockSolars extends BlockBaseContainer {
|
||||
public BlockSolars(String name, int countOfMetas, int instance) {
|
||||
super(name, Material.iron, soundTypeMetal, countOfMetas, instance, 4.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
IIcon solarTop = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/solartop");
|
||||
IIcon doubleSolarTop = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/doublesolartop");
|
||||
IIcon tripleSolarTop = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/triplesolartop");
|
||||
IIcon bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/bottom");
|
||||
public BlockSolars(String name, int countOfMetas, int instance) {
|
||||
super(name, Material.iron, soundTypeMetal, countOfMetas, instance, 4.0F);
|
||||
}
|
||||
|
||||
if(instance == 0) {
|
||||
iconSets[0].top = solarTop;
|
||||
iconSets[1].top = doubleSolarTop;
|
||||
iconSets[2].top = tripleSolarTop;
|
||||
iconSets[3].top = solarTop;
|
||||
iconSets[4].top = doubleSolarTop;
|
||||
iconSets[5].top = tripleSolarTop;
|
||||
iconSets[6].top = solarTop;
|
||||
iconSets[7].top = doubleSolarTop;
|
||||
iconSets[8].top = tripleSolarTop;
|
||||
iconSets[9].top = solarTop;
|
||||
iconSets[10].top = doubleSolarTop;
|
||||
iconSets[11].top = tripleSolarTop;
|
||||
iconSets[12].top = solarTop;
|
||||
iconSets[13].top = doubleSolarTop;
|
||||
iconSets[14].top = tripleSolarTop;
|
||||
iconSets[15].top = solarTop;
|
||||
|
||||
iconSets[0].bottom = bottom;
|
||||
iconSets[1].bottom = bottom;
|
||||
iconSets[2].bottom = bottom;
|
||||
iconSets[3].bottom = bottom;
|
||||
iconSets[4].bottom = bottom;
|
||||
iconSets[5].bottom = bottom;
|
||||
iconSets[6].bottom = bottom;
|
||||
iconSets[7].bottom = bottom;
|
||||
iconSets[8].bottom = bottom;
|
||||
iconSets[9].bottom = bottom;
|
||||
iconSets[10].bottom = bottom;
|
||||
iconSets[11].bottom = bottom;
|
||||
iconSets[12].bottom = bottom;
|
||||
iconSets[13].bottom = bottom;
|
||||
iconSets[14].bottom = bottom;
|
||||
iconSets[15].bottom = bottom;
|
||||
|
||||
IIcon side = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/side");
|
||||
IIcon waterSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/water/waterside");
|
||||
IIcon darkSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/dark/darkside");
|
||||
IIcon orderSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/order/orderside");
|
||||
IIcon fireSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/fire/fireside");
|
||||
IIcon airSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/air/airside");
|
||||
|
||||
iconSets[0].side = side;
|
||||
iconSets[1].side = side;
|
||||
iconSets[2].side = side;
|
||||
iconSets[3].side = waterSide;
|
||||
iconSets[4].side = waterSide;
|
||||
iconSets[5].side = waterSide;
|
||||
iconSets[6].side = darkSide;
|
||||
iconSets[7].side = darkSide;
|
||||
iconSets[8].side = darkSide;
|
||||
iconSets[9].side = orderSide;
|
||||
iconSets[10].side = orderSide;
|
||||
iconSets[11].side = orderSide;
|
||||
iconSets[12].side = fireSide;
|
||||
iconSets[13].side = fireSide;
|
||||
iconSets[14].side = fireSide;
|
||||
iconSets[15].side = airSide;
|
||||
}
|
||||
if(instance == 1) {
|
||||
iconSets[0].top = doubleSolarTop;
|
||||
iconSets[1].top = tripleSolarTop;
|
||||
iconSets[2].top = solarTop;
|
||||
iconSets[3].top = doubleSolarTop;
|
||||
iconSets[4].top = tripleSolarTop;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
IIcon solarTop = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/solartop");
|
||||
IIcon doubleSolarTop = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/doublesolartop");
|
||||
IIcon tripleSolarTop = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/triplesolartop");
|
||||
|
||||
iconSets[0].bottom = bottom;
|
||||
iconSets[1].bottom = bottom;
|
||||
iconSets[2].bottom = bottom;
|
||||
iconSets[3].bottom = bottom;
|
||||
iconSets[4].bottom = bottom;
|
||||
IIcon bottom = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/bottom");
|
||||
|
||||
IIcon airSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/air/airside");
|
||||
IIcon earthSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/earth/earthside");
|
||||
|
||||
iconSets[0].side = airSide;
|
||||
iconSets[1].side = airSide;
|
||||
iconSets[2].side = earthSide;
|
||||
iconSets[3].side = earthSide;
|
||||
iconSets[4].side = earthSide;
|
||||
}
|
||||
}
|
||||
IIcon side = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/side");
|
||||
IIcon waterSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/water/waterside");
|
||||
IIcon darkSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/dark/darkside");
|
||||
IIcon orderSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/order/orderside");
|
||||
IIcon fireSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/fire/fireside");
|
||||
IIcon airSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/air/airside");
|
||||
IIcon earthSide = ir.registerIcon(EMT.TEXTURE_PATH + ":solars/earth/earthside");
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
if (instance == 0) {
|
||||
for (int meta = 0; meta < 16; meta++) {
|
||||
list.add(new ItemStack(id, 1, meta));
|
||||
}
|
||||
}
|
||||
IIcon[] sides = {side, orderSide, darkSide, airSide, earthSide, waterSide, fireSide};
|
||||
|
||||
if (instance == 1) {
|
||||
for (int meta = 0; meta < 5; meta++) {
|
||||
list.add(new ItemStack(id, 1, meta));
|
||||
}
|
||||
}
|
||||
if (instance != 1 && instance != 0)
|
||||
for (int i = 0; i < countOfMetas; i++) {
|
||||
iconSets[i].bottom = bottom;
|
||||
iconSets[i].side = sides[(Objects.requireNonNull(Solars.getTileEntitySolarBase(instance, i)).aspect)];
|
||||
iconSets[i].top = tripleSolarTop;
|
||||
}
|
||||
else if (instance == 0) {
|
||||
for (int i = 0; i < countOfMetas; i++) {
|
||||
iconSets[i].bottom = bottom;
|
||||
}
|
||||
iconSets[0].top = solarTop;
|
||||
iconSets[1].top = doubleSolarTop;
|
||||
iconSets[2].top = tripleSolarTop;
|
||||
iconSets[3].top = solarTop;
|
||||
iconSets[4].top = doubleSolarTop;
|
||||
iconSets[5].top = tripleSolarTop;
|
||||
iconSets[6].top = solarTop;
|
||||
iconSets[7].top = doubleSolarTop;
|
||||
iconSets[8].top = tripleSolarTop;
|
||||
iconSets[9].top = solarTop;
|
||||
iconSets[10].top = doubleSolarTop;
|
||||
iconSets[11].top = tripleSolarTop;
|
||||
iconSets[12].top = solarTop;
|
||||
iconSets[13].top = doubleSolarTop;
|
||||
iconSets[14].top = tripleSolarTop;
|
||||
iconSets[15].top = solarTop;
|
||||
iconSets[0].side = side;
|
||||
iconSets[1].side = side;
|
||||
iconSets[2].side = side;
|
||||
iconSets[3].side = waterSide;
|
||||
iconSets[4].side = waterSide;
|
||||
iconSets[5].side = waterSide;
|
||||
iconSets[6].side = darkSide;
|
||||
iconSets[7].side = darkSide;
|
||||
iconSets[8].side = darkSide;
|
||||
iconSets[9].side = orderSide;
|
||||
iconSets[10].side = orderSide;
|
||||
iconSets[11].side = orderSide;
|
||||
iconSets[12].side = fireSide;
|
||||
iconSets[13].side = fireSide;
|
||||
iconSets[14].side = fireSide;
|
||||
iconSets[15].side = airSide;
|
||||
} else {
|
||||
iconSets[0].top = doubleSolarTop;
|
||||
iconSets[1].top = tripleSolarTop;
|
||||
iconSets[2].top = solarTop;
|
||||
iconSets[3].top = doubleSolarTop;
|
||||
iconSets[4].top = tripleSolarTop;
|
||||
for (int i = 0; i < countOfMetas; i++) {
|
||||
iconSets[i].bottom = bottom;
|
||||
}
|
||||
iconSets[0].side = airSide;
|
||||
iconSets[1].side = airSide;
|
||||
iconSets[2].side = earthSide;
|
||||
iconSets[3].side = earthSide;
|
||||
iconSets[4].side = earthSide;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int meta = 0; meta < countOfMetas; meta++) {
|
||||
list.add(new ItemStack(id, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side < 1) {
|
||||
return iconSets[meta].bottom;
|
||||
}
|
||||
if (side == 1) {
|
||||
return iconSets[meta].top;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
return iconSets[meta].side;
|
||||
}
|
||||
if (meta >= countOfMetas)
|
||||
return null;
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
if (instance == 0) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return new TileEntityCompressedSolar();
|
||||
case 1:
|
||||
return new TileEntityDoubleCompressedSolar();
|
||||
case 2:
|
||||
return new TileEntityTripleCompressedSolar();
|
||||
case 3:
|
||||
return new TileEntityWaterSolar();
|
||||
case 4:
|
||||
return new TileEntityDoubleWaterSolar();
|
||||
case 5:
|
||||
return new TileEntityTripleWaterSolar();
|
||||
case 6:
|
||||
return new TileEntityDarkSolar();
|
||||
case 7:
|
||||
return new TileEntityDoubleDarkSolar();
|
||||
case 8:
|
||||
return new TileEntityTripleDarkSolar();
|
||||
case 9:
|
||||
return new TileEntityOrderSolar();
|
||||
case 10:
|
||||
return new TileEntityDoubleOrderSolar();
|
||||
case 11:
|
||||
return new TileEntityTripleOrderSolar();
|
||||
case 12:
|
||||
return new TileEntityFireSolar();
|
||||
case 13:
|
||||
return new TileEntityDoubleFireSolar();
|
||||
case 14:
|
||||
return new TileEntityTripleFireSolar();
|
||||
case 15:
|
||||
return new TileEntityAirSolar();
|
||||
}
|
||||
}
|
||||
if (side < 1) {
|
||||
return iconSets[meta].bottom;
|
||||
}
|
||||
if (side == 1) {
|
||||
return iconSets[meta].top;
|
||||
}
|
||||
|
||||
if (instance == 1) {
|
||||
return iconSets[meta].side;
|
||||
}
|
||||
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return new TileEntityDoubleAirSolar();
|
||||
case 1:
|
||||
return new TileEntityTripleAirSolar();
|
||||
case 2:
|
||||
return new TileEntityEarthSolar();
|
||||
case 3:
|
||||
return new TileEntityDoubleEarthSolar();
|
||||
case 4:
|
||||
return new TileEntityTripleEarthSolar();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return Solars.getTileEntitySolarBase(instance, meta);
|
||||
}
|
||||
|
||||
return super.createTileEntity(world, meta);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
world.removeTileEntity(x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
world.removeTileEntity(x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3)
|
||||
{
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
if (tileentity != null) {
|
||||
player.openGui(emt.EMT.instance, 1, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
if (tileentity != null) {
|
||||
player.openGui(emt.EMT.instance, 1, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user