mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-16 18:54:54 +00:00
Update buildscript & spotlessApply
This commit is contained in:
1 parent
e4329e2b8f
commit
8683a345c3
818 files changed
+51123
-49403
No files matched your search
@@ -13,6 +13,7 @@ import binnie.extratrees.api.IToolHammer;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -25,145 +26,142 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BlockDesign extends BlockMetadata implements IMultipassBlock {
|
||||
public static ForgeDirection[] RENDER_DIRECTIONS = new ForgeDirection[]{
|
||||
ForgeDirection.DOWN,
|
||||
ForgeDirection.UP,
|
||||
ForgeDirection.EAST,
|
||||
ForgeDirection.WEST,
|
||||
ForgeDirection.NORTH,
|
||||
ForgeDirection.SOUTH
|
||||
};
|
||||
public static ForgeDirection[] RENDER_DIRECTIONS = new ForgeDirection[] {
|
||||
ForgeDirection.DOWN,
|
||||
ForgeDirection.UP,
|
||||
ForgeDirection.EAST,
|
||||
ForgeDirection.WEST,
|
||||
ForgeDirection.NORTH,
|
||||
ForgeDirection.SOUTH
|
||||
};
|
||||
|
||||
protected IDesignSystem designSystem;
|
||||
protected IDesignSystem designSystem;
|
||||
|
||||
public BlockDesign(IDesignSystem system, Material material) {
|
||||
super(material);
|
||||
designSystem = system;
|
||||
}
|
||||
public BlockDesign(IDesignSystem system, Material material) {
|
||||
super(material);
|
||||
designSystem = system;
|
||||
}
|
||||
|
||||
public static int getMetadata(int plank1, int plank2, int design) {
|
||||
return plank1 + (plank2 << 9) + (design << 18);
|
||||
}
|
||||
public static int getMetadata(int plank1, int plank2, int design) {
|
||||
return plank1 + (plank2 << 9) + (design << 18);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClick(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onClick(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = event.entityPlayer.worldObj;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockDesign)) {
|
||||
return;
|
||||
}
|
||||
World world = event.entityPlayer.worldObj;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockDesign)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockDesign blockC = (BlockDesign) world.getBlock(x, y, z);
|
||||
ItemStack item = player.getHeldItem();
|
||||
if (item == null
|
||||
|| !(item.getItem() instanceof IToolHammer)
|
||||
|| !((IToolHammer) item.getItem()).isActive(item)) {
|
||||
return;
|
||||
}
|
||||
BlockDesign blockC = (BlockDesign) world.getBlock(x, y, z);
|
||||
ItemStack item = player.getHeldItem();
|
||||
if (item == null
|
||||
|| !(item.getItem() instanceof IToolHammer)
|
||||
|| !((IToolHammer) item.getItem()).isActive(item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DesignBlock block = blockC.getCarpentryBlock(world, x, y, z);
|
||||
TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z);
|
||||
block.rotate(event.face, item, player, world, x, y, z);
|
||||
int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
tile.setTileMetadata(meta, true);
|
||||
}
|
||||
DesignBlock block = blockC.getCarpentryBlock(world, x, y, z);
|
||||
TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z);
|
||||
block.rotate(event.face, item, player, world, x, y, z);
|
||||
int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
tile.setTileMetadata(meta, true);
|
||||
}
|
||||
|
||||
public abstract ItemStack getCreativeStack(IDesign design);
|
||||
public abstract ItemStack getCreativeStack(IDesign design);
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (IDesign design : CarpentryManager.carpentryInterface.getSortedDesigns()) {
|
||||
list.add(getCreativeStack(design));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (IDesign design : CarpentryManager.carpentryInterface.getSortedDesigns()) {
|
||||
list.add(getCreativeStack(design));
|
||||
}
|
||||
}
|
||||
|
||||
public IDesignSystem getDesignSystem() {
|
||||
return designSystem;
|
||||
}
|
||||
public IDesignSystem getDesignSystem() {
|
||||
return designSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack stack) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
return getBlockName(block);
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack stack) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
return getBlockName(block);
|
||||
}
|
||||
|
||||
public abstract String getBlockName(DesignBlock design);
|
||||
|
||||
public DesignBlock getCarpentryBlock(IBlockAccess world, int x, int y, int z) {
|
||||
return ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getTileMetadata(world, x, y, z));
|
||||
}
|
||||
public abstract String getBlockName(DesignBlock design);
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
DesignBlock block = getCarpentryBlock(world, x, y, z);
|
||||
return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
}
|
||||
public DesignBlock getCarpentryBlock(IBlockAccess world, int x, int y, int z) {
|
||||
return ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getTileMetadata(world, x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(int meta) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), meta);
|
||||
return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
DesignBlock block = getCarpentryBlock(world, x, y, z);
|
||||
return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int damage) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), damage);
|
||||
if (MultipassBlockRenderer.getLayer() > 0) {
|
||||
return block.getSecondaryIcon(getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
}
|
||||
return block.getPrimaryIcon(getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
}
|
||||
@Override
|
||||
public int colorMultiplier(int meta) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), meta);
|
||||
return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
if (block.getPrimaryMaterial() != block.getSecondaryMaterial()) {
|
||||
tooltip.add(I18N.localise(
|
||||
"extratrees.block.tooltip.twoMaterials",
|
||||
block.getPrimaryMaterial().getName(),
|
||||
block.getSecondaryMaterial().getName()
|
||||
));
|
||||
} else {
|
||||
tooltip.add(block.getPrimaryMaterial().getName());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int damage) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), damage);
|
||||
if (MultipassBlockRenderer.getLayer() > 0) {
|
||||
return block.getSecondaryIcon(getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
}
|
||||
return block.getPrimaryIcon(getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(int plank1, int plank2, int design) {
|
||||
return TileEntityMetadata.getItemStack(this, getMetadata(plank1, plank2, design));
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
if (block.getPrimaryMaterial() != block.getSecondaryMaterial()) {
|
||||
tooltip.add(I18N.localise(
|
||||
"extratrees.block.tooltip.twoMaterials",
|
||||
block.getPrimaryMaterial().getName(),
|
||||
block.getSecondaryMaterial().getName()));
|
||||
} else {
|
||||
tooltip.add(block.getPrimaryMaterial().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (IDesignSystem system : DesignerManager.instance.getDesignSystems()) {
|
||||
system.registerIcons(register);
|
||||
}
|
||||
}
|
||||
public ItemStack getItemStack(int plank1, int plank2, int design) {
|
||||
return TileEntityMetadata.getItemStack(this, getMetadata(plank1, plank2, design));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), tileMeta);
|
||||
return block.getItemMetadata(getDesignSystem());
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (IDesignSystem system : DesignerManager.instance.getDesignSystems()) {
|
||||
system.registerIcons(register);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 2;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), tileMeta);
|
||||
return block.getItemMetadata(getDesignSystem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user