resonant-induction/minecraft/dark/BasicUtilities/Blocks/BlockGenerator.java
Rseifert 5787f65148 Reformating, and rebalance of tanks, Final 1.4.5
Did some file changes to make finding things easier
Added: Custom creative tab
Changed: File root system, :p to many files
Changed: Tank liquid trade method to balance out instead of full trade
Changed: the packet update rate of the Tank to try to fix Render Lag
Fixed: Tank Render so Liquid levels can be seen
BugIgnorable: uneven levels of liquid will not show up on tank render
but are present
BugIgnorable: eValve names sometime glitch and call all instances Empty
XXX
TODO: Fix Textures, and add model for eValve
TODO: Finish One way valve
TODO: Finish OIL,STEAM,FUEL liquid/gas blocks
2012-12-23 05:28:26 -05:00

72 lines
2 KiB
Java

package dark.BasicUtilities.Blocks;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import dark.BasicUtilities.ItemRenderHelper;
import dark.BasicUtilities.PipeTab;
import dark.BasicUtilities.Tile.TileEntityGen;
public class BlockGenerator extends universalelectricity.prefab.BlockMachine {
public BlockGenerator(int id) {
super("Generator", id, Material.iron);
this.setCreativeTab(PipeTab.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
}
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this, 1, 0));
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z,
EntityLiving par5EntityLiving) {
int angle = MathHelper
.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
world.setBlockAndMetadataWithUpdate(x, y, z, blockID, angle, true);
}
@Override
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int angle = MathHelper
.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int metadata = par1World.getBlockMetadata(x, y, z);
if (metadata < 3) {
par1World.setBlockAndMetadata(x, y, z, blockID, metadata + angle);
} else {
par1World.setBlockAndMetadata(x, y, z, blockID, 0);
}
return true;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return ItemRenderHelper.renderID;
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileEntityGen();
}
}