Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/main/java/kamkeel/plugin/Blocks/BlockBarrel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.BlockRotatedPillar;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
Expand All @@ -16,7 +16,12 @@
import net.minecraft.world.World;


public class BlockBarrel extends Block {
/**
* Barrel block that behaves similarly to a {@link BlockRotatedPillar} so it can be rotated
* like vanilla pillars. The original orientation and texture logic is preserved so the
* block still renders the correct top and bottom faces regardless of placement direction.
*/
public class BlockBarrel extends BlockRotatedPillar {

public IIcon top;
public IIcon bottom;
Expand Down Expand Up @@ -65,4 +70,16 @@ public IIcon getIcon(int p_149691_1_, int p_149691_2_)
int k = BlockPistonBase.getPistonOrientation(p_149691_2_);
return k > 5 ? this.top : (p_149691_1_ == k ? this.top : (p_149691_1_ == Facing.oppositeSide[k] ? this.bottom : this.blockIcon));
}

@Override
protected IIcon getSideIcon(int meta)
{
return this.blockIcon;
}

@Override
protected IIcon getTopIcon(int meta)
{
return this.top;
}
}