Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
darkevilmac committed May 12, 2015
1 parent 2db4426 commit 613192c
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions src/main/java/darkevilmac/archimedes/blockitem/BlockEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.Sys;

public class BlockEngine extends BlockContainer {
public float enginePower;
Expand All @@ -26,20 +31,16 @@ public BlockEngine(Material material, float power, int fuelconsumption) {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
meta &= 3;
switch (side) {
case 0:
case 1:
case 4:
return backIcon;
case 3:
case 2:
return blockIcon;
case 5:
return frontIcon;
if (side == 1 || side == 0)
return this.backIcon;
if (side == meta)
return this.frontIcon;

if(ForgeDirection.getOrientation(side).getOpposite().ordinal() == meta){
return this.backIcon;
}
return blockIcon;

return this.blockIcon;
}

@Override
Expand All @@ -65,4 +66,24 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p
}
return false;
}

public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack stack) {
int l = MathHelper.floor_double((double) (placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

if (l == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}

if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}

if (l == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}

if (l == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
}
}

0 comments on commit 613192c

Please sign in to comment.