resonant-induction/minecraft/dark/BasicUtilities/mechanical/BlockGenerator.java
Rseifert 494d98bb05 where do i begin
I've made a mess of changes since last upload. Main big change is change
in forge file formate that merged minecraft and common folder. The other
is the complete rewrite to Forge Liquid api. So far only the pump,
boiler, and pipe are converted to the new system. The pipe will actual
not fully work with most machines since it can't drain liquids out of
machines. In future update there will be a block to do this called a
pipe pump. Other than those changes nothing much is diffrent.
2012-12-22 04:44:17 -05:00

68 lines
1.8 KiB
Java

package dark.BasicUtilities.mechanical;
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;
public class BlockGenerator extends universalelectricity.prefab.BlockMachine {
public BlockGenerator(int id) {
super("Generator", id, Material.iron);
this.setCreativeTab(CreativeTabs.tabBlock);
}
@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();
}
}