mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-30 02:38:34 +01:00
Scrapping Tool Table.
For now. Wasn't happy with it. Sorry.
This commit is contained in:
parent
760108e446
commit
e6bcf6d0c6
22 changed files with 1 additions and 1693 deletions
|
@ -29,7 +29,6 @@ import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||||
import ellpeck.actuallyadditions.items.InitForeignPaxels;
|
import ellpeck.actuallyadditions.items.InitForeignPaxels;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.items.ItemCoffee;
|
import ellpeck.actuallyadditions.items.ItemCoffee;
|
||||||
import ellpeck.actuallyadditions.items.tools.table.InitToolTableTools;
|
|
||||||
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
||||||
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
||||||
import ellpeck.actuallyadditions.misc.DispenserHandlerEmptyBucket;
|
import ellpeck.actuallyadditions.misc.DispenserHandlerEmptyBucket;
|
||||||
|
@ -99,7 +98,6 @@ public class ActuallyAdditions{
|
||||||
HairyBallHandler.init();
|
HairyBallHandler.init();
|
||||||
TreasureChestHandler.init();
|
TreasureChestHandler.init();
|
||||||
InitForeignPaxels.init();
|
InitForeignPaxels.init();
|
||||||
InitToolTableTools.init();
|
|
||||||
proxy.postInit(event);
|
proxy.postInit(event);
|
||||||
|
|
||||||
ModUtil.LOGGER.info("PostInitialization Finished.");
|
ModUtil.LOGGER.info("PostInitialization Finished.");
|
||||||
|
|
|
@ -1,146 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockToolTable.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.blocks;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
|
||||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityInventoryBase;
|
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityToolTable;
|
|
||||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.INameableItem;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
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.init.Blocks;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class BlockToolTable extends BlockContainerBase implements INameableItem{
|
|
||||||
|
|
||||||
public BlockToolTable(){
|
|
||||||
super(Material.wood);
|
|
||||||
this.setHarvestLevel("axe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(5.0F);
|
|
||||||
this.setStepSound(soundTypeWood);
|
|
||||||
|
|
||||||
this.setBlockBounds(0F, 0F, 0F, 1F, 1F-3/16, 1F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
|
||||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
|
||||||
|
|
||||||
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 0);
|
|
||||||
if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 3);
|
|
||||||
if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
|
||||||
if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
|
||||||
return new TileEntityToolTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int metadata){
|
|
||||||
return this.blockIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister iconReg){
|
|
||||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean renderAsNormalBlock(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRenderType(){
|
|
||||||
return AssetUtil.TOOL_TABLE_RENDER_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
|
||||||
if(!world.isRemote){
|
|
||||||
TileEntityToolTable table = (TileEntityToolTable)world.getTileEntity(x, y, z);
|
|
||||||
if(table != null){
|
|
||||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.TOOL_TABLE.ordinal(), world, x, y, z);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
|
||||||
if(!world.isRemote){
|
|
||||||
TileEntity aTile = world.getTileEntity(x, y, z);
|
|
||||||
if(aTile instanceof TileEntityInventoryBase){
|
|
||||||
TileEntityInventoryBase tile = (TileEntityInventoryBase)aTile;
|
|
||||||
if(tile.getSizeInventory() > 0){
|
|
||||||
for(int i = 0; i < tile.getSizeInventory(); i++){
|
|
||||||
if(i != TileEntityToolTable.SLOT_OUTPUT){
|
|
||||||
this.dropSlotFromInventory(i, tile, world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.breakBlock(world, x, y, z, block, par6);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(){
|
|
||||||
return "blockToolTable";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlock{
|
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(false);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
return EnumRarity.rare;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUnlocalizedName(ItemStack stack){
|
|
||||||
return this.getUnlocalizedName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int damage){
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -93,14 +93,9 @@ public class InitBlocks{
|
||||||
|
|
||||||
public static Block blockSmileyCloud;
|
public static Block blockSmileyCloud;
|
||||||
|
|
||||||
public static Block blockToolTable;
|
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Blocks...");
|
ModUtil.LOGGER.info("Initializing Blocks...");
|
||||||
|
|
||||||
blockToolTable = new BlockToolTable();
|
|
||||||
BlockUtil.register(blockToolTable);
|
|
||||||
|
|
||||||
blockSmileyCloud = new BlockSmileyCloud();
|
blockSmileyCloud = new BlockSmileyCloud();
|
||||||
BlockUtil.register(blockSmileyCloud);
|
BlockUtil.register(blockSmileyCloud);
|
||||||
|
|
||||||
|
|
|
@ -1,263 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ModelToolTable.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.blocks.render;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
|
||||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Made by Canitzp.
|
|
||||||
* Thanks.
|
|
||||||
*/
|
|
||||||
public class ModelToolTable extends ModelBaseAA{
|
|
||||||
|
|
||||||
ModelRenderer leg1;
|
|
||||||
ModelRenderer leg2;
|
|
||||||
ModelRenderer leg3;
|
|
||||||
ModelRenderer lag4;
|
|
||||||
ModelRenderer tableTop;
|
|
||||||
ModelRenderer back1;
|
|
||||||
ModelRenderer back2;
|
|
||||||
ModelRenderer side1;
|
|
||||||
ModelRenderer side2;
|
|
||||||
ModelRenderer bottom;
|
|
||||||
ModelRenderer side3;
|
|
||||||
ModelRenderer onTop;
|
|
||||||
ModelRenderer random1;
|
|
||||||
ModelRenderer random2;
|
|
||||||
ModelRenderer random3;
|
|
||||||
ModelRenderer random4;
|
|
||||||
ModelRenderer random5;
|
|
||||||
ModelRenderer random6;
|
|
||||||
ModelRenderer random7;
|
|
||||||
ModelRenderer random8;
|
|
||||||
ModelRenderer random9;
|
|
||||||
|
|
||||||
public ModelToolTable(){
|
|
||||||
textureWidth = 128;
|
|
||||||
textureHeight = 128;
|
|
||||||
|
|
||||||
leg1 = new ModelRenderer(this, 0, 0);
|
|
||||||
leg1.addBox(0F, 0F, 0F, 2, 10, 2);
|
|
||||||
leg1.setRotationPoint(-8F, 14F, -8F);
|
|
||||||
leg1.setTextureSize(128, 128);
|
|
||||||
leg1.mirror = true;
|
|
||||||
setRotation(leg1, 0F, 0F, 0F);
|
|
||||||
leg2 = new ModelRenderer(this, 0, 0);
|
|
||||||
leg2.addBox(0F, 0F, 0F, 2, 10, 2);
|
|
||||||
leg2.setRotationPoint(6F, 14F, -8F);
|
|
||||||
leg2.setTextureSize(128, 128);
|
|
||||||
leg2.mirror = true;
|
|
||||||
setRotation(leg2, 0F, 0F, 0F);
|
|
||||||
leg3 = new ModelRenderer(this, 0, 0);
|
|
||||||
leg3.addBox(0F, 0F, 0F, 2, 10, 2);
|
|
||||||
leg3.setRotationPoint(-8F, 14F, 6F);
|
|
||||||
leg3.setTextureSize(128, 128);
|
|
||||||
leg3.mirror = true;
|
|
||||||
setRotation(leg3, 0F, 0F, 0F);
|
|
||||||
lag4 = new ModelRenderer(this, 0, 0);
|
|
||||||
lag4.addBox(0F, 0F, 0F, 2, 10, 2);
|
|
||||||
lag4.setRotationPoint(6F, 14F, 6F);
|
|
||||||
lag4.setTextureSize(128, 128);
|
|
||||||
lag4.mirror = true;
|
|
||||||
setRotation(lag4, 0F, 0F, 0F);
|
|
||||||
tableTop = new ModelRenderer(this, 0, 13);
|
|
||||||
tableTop.addBox(0F, 0F, 0F, 16, 2, 16);
|
|
||||||
tableTop.setRotationPoint(-8F, 12F, -8F);
|
|
||||||
tableTop.setTextureSize(128, 128);
|
|
||||||
tableTop.mirror = true;
|
|
||||||
setRotation(tableTop, 0F, 0F, 0F);
|
|
||||||
back1 = new ModelRenderer(this, 9, 0);
|
|
||||||
back1.addBox(0F, 0F, 0F, 12, 10, 1);
|
|
||||||
back1.setRotationPoint(-6F, 14F, 7F);
|
|
||||||
back1.setTextureSize(128, 128);
|
|
||||||
back1.mirror = true;
|
|
||||||
setRotation(back1, 0F, 0F, 0F);
|
|
||||||
back2 = new ModelRenderer(this, 0, 32);
|
|
||||||
back2.addBox(0F, 0F, 0F, 16, 16, 1);
|
|
||||||
back2.setRotationPoint(-8F, -4F, 7F);
|
|
||||||
back2.setTextureSize(128, 128);
|
|
||||||
back2.mirror = true;
|
|
||||||
setRotation(back2, 0F, 0F, 0F);
|
|
||||||
side1 = new ModelRenderer(this, 9, 0);
|
|
||||||
side1.addBox(0F, 0F, 0F, 12, 10, 1);
|
|
||||||
side1.setRotationPoint(-7F, 14F, 6F);
|
|
||||||
side1.setTextureSize(128, 128);
|
|
||||||
side1.mirror = true;
|
|
||||||
setRotation(side1, 0F, 1.579523F, 0F);
|
|
||||||
side2 = new ModelRenderer(this, 9, 0);
|
|
||||||
side2.addBox(0F, 0F, 0F, 12, 10, 1);
|
|
||||||
side2.setRotationPoint(6F, 14F, 6F);
|
|
||||||
side2.setTextureSize(128, 128);
|
|
||||||
side2.mirror = true;
|
|
||||||
setRotation(side2, 0F, 1.579523F, 0F);
|
|
||||||
bottom = new ModelRenderer(this, 36, 0);
|
|
||||||
bottom.addBox(0F, 0F, 0F, 8, 12, 1);
|
|
||||||
bottom.setRotationPoint(-6F, 24F, 6F);
|
|
||||||
bottom.setTextureSize(128, 128);
|
|
||||||
bottom.mirror = true;
|
|
||||||
setRotation(bottom, 1.579523F, 1.579523F, 0F);
|
|
||||||
side3 = new ModelRenderer(this, 9, 0);
|
|
||||||
side3.addBox(0F, 0F, 0F, 12, 9, 1);
|
|
||||||
side3.setRotationPoint(-6F, 14F, -2F);
|
|
||||||
side3.setTextureSize(128, 128);
|
|
||||||
side3.mirror = true;
|
|
||||||
setRotation(side3, 0F, 0F, 0F);
|
|
||||||
onTop = new ModelRenderer(this, 0, 50);
|
|
||||||
onTop.addBox(0F, 0F, 0F, 12, 1, 12);
|
|
||||||
onTop.setRotationPoint(-6F, 11.8F, -6F);
|
|
||||||
onTop.setTextureSize(128, 128);
|
|
||||||
onTop.mirror = true;
|
|
||||||
setRotation(onTop, 0F, 0F, 0F);
|
|
||||||
random1 = new ModelRenderer(this, 35, 32);
|
|
||||||
random1.addBox(0F, 0F, 0F, 1, 1, 1);
|
|
||||||
random1.setRotationPoint(-7.5F, 15F, 3F);
|
|
||||||
random1.setTextureSize(128, 128);
|
|
||||||
random1.mirror = true;
|
|
||||||
setRotation(random1, 0F, 0F, 0F);
|
|
||||||
random2 = new ModelRenderer(this, 35, 32);
|
|
||||||
random2.addBox(0F, 0F, 0F, 1, 1, 1);
|
|
||||||
random2.setRotationPoint(-7.5F, 15F, -4F);
|
|
||||||
random2.setTextureSize(128, 128);
|
|
||||||
random2.mirror = true;
|
|
||||||
setRotation(random2, 0F, 0F, 0F);
|
|
||||||
random3 = new ModelRenderer(this, 35, 32);
|
|
||||||
random3.addBox(0F, 0F, 0F, 1, 1, 1);
|
|
||||||
random3.setRotationPoint(6.5F, 15F, 3F);
|
|
||||||
random3.setTextureSize(128, 128);
|
|
||||||
random3.mirror = true;
|
|
||||||
setRotation(random3, 0F, 0F, 0F);
|
|
||||||
random4 = new ModelRenderer(this, 35, 32);
|
|
||||||
random4.addBox(0F, 0F, 0F, 1, 1, 1);
|
|
||||||
random4.setRotationPoint(6.5F, 15F, -4F);
|
|
||||||
random4.setTextureSize(128, 128);
|
|
||||||
random4.mirror = true;
|
|
||||||
setRotation(random4, 0F, 0F, 0F);
|
|
||||||
random5 = new ModelRenderer(this, 55, 0);
|
|
||||||
random5.addBox(0F, 0F, 0F, 1, 2, 1);
|
|
||||||
random5.setRotationPoint(-5F, 1F, 6F);
|
|
||||||
random5.setTextureSize(128, 128);
|
|
||||||
random5.mirror = true;
|
|
||||||
setRotation(random5, 0.5235988F, 0F, 0F);
|
|
||||||
random6 = new ModelRenderer(this, 55, 0);
|
|
||||||
random6.addBox(0F, 0F, 0F, 1, 2, 1);
|
|
||||||
random6.setRotationPoint(4F, 1F, 6F);
|
|
||||||
random6.setTextureSize(128, 128);
|
|
||||||
random6.mirror = true;
|
|
||||||
setRotation(random6, 0.5235988F, 0F, 0F);
|
|
||||||
random7 = new ModelRenderer(this, 0, 64);
|
|
||||||
random7.addBox(0F, 0F, 0F, 11, 1, 4);
|
|
||||||
random7.setRotationPoint(-5.5F, 0F, 3.5F);
|
|
||||||
random7.setTextureSize(128, 128);
|
|
||||||
random7.mirror = true;
|
|
||||||
setRotation(random7, 0F, 0F, 0F);
|
|
||||||
random8 = new ModelRenderer(this, 35, 35);
|
|
||||||
random8.addBox(0F, 0F, 0F, 1, 1, 1);
|
|
||||||
random8.setRotationPoint(-3F, 3F, 6F);
|
|
||||||
random8.setTextureSize(128, 128);
|
|
||||||
random8.mirror = true;
|
|
||||||
setRotation(random8, 0F, 0F, 0F);
|
|
||||||
random9 = new ModelRenderer(this, 35, 35);
|
|
||||||
random9.addBox(0F, 0F, 0F, 1, 1, 1);
|
|
||||||
random9.setRotationPoint(2F, 3F, 6F);
|
|
||||||
random9.setTextureSize(128, 128);
|
|
||||||
random9.mirror = true;
|
|
||||||
setRotation(random9, 0F, 0F, 0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(float f){
|
|
||||||
leg1.render(f);
|
|
||||||
leg2.render(f);
|
|
||||||
leg3.render(f);
|
|
||||||
lag4.render(f);
|
|
||||||
tableTop.render(f);
|
|
||||||
back1.render(f);
|
|
||||||
back2.render(f);
|
|
||||||
side1.render(f);
|
|
||||||
side2.render(f);
|
|
||||||
bottom.render(f);
|
|
||||||
side3.render(f);
|
|
||||||
onTop.render(f);
|
|
||||||
random1.render(f);
|
|
||||||
random2.render(f);
|
|
||||||
random3.render(f);
|
|
||||||
random4.render(f);
|
|
||||||
random5.render(f);
|
|
||||||
random6.render(f);
|
|
||||||
random7.render(f);
|
|
||||||
random8.render(f);
|
|
||||||
random9.render(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
|
||||||
model.rotateAngleX = x;
|
|
||||||
model.rotateAngleY = y;
|
|
||||||
model.rotateAngleZ = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean doesRotate(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(){
|
|
||||||
return "modelToolTable";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderExtra(float f, TileEntity tile){
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
{
|
|
||||||
GL11.glTranslated(-7.25*f, 17.75*f, 2.25*f);
|
|
||||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
|
||||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
|
||||||
GL11.glRotatef(-40F, 0F, 0F, 1F);
|
|
||||||
AssetUtil.renderItem(new ItemStack(Items.shears), 0);
|
|
||||||
}
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
{
|
|
||||||
GL11.glTranslated(5*f, 10.65*f, 4.5*f);
|
|
||||||
GL11.glScalef(0.15F, 0.15F, 0.15F);
|
|
||||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
|
||||||
GL11.glRotatef(45F, 0F, 0F, 1F);
|
|
||||||
AssetUtil.renderBlock(InitBlocks.blockPhantomLiquiface, 0);
|
|
||||||
}
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
{
|
|
||||||
GL11.glTranslated(-3.25*f, 11.35*f, -1*f);
|
|
||||||
GL11.glScalef(0.35F, 0.35F, 0.35F);
|
|
||||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
|
||||||
AssetUtil.renderItem(new ItemStack(Items.stick), 0);
|
|
||||||
}
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
{
|
|
||||||
GL11.glTranslated(-2.25*f, 11.35*f, -4.5*f);
|
|
||||||
GL11.glScalef(0.25F, 0.25F, 0.25F);
|
|
||||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
|
||||||
GL11.glRotatef(75F, 0F, 0F, 1F);
|
|
||||||
AssetUtil.renderItem(new ItemStack(Items.iron_ingot), 0);
|
|
||||||
}
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,131 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ContainerToolTable.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
|
||||||
import ellpeck.actuallyadditions.recipe.ToolTableHandler;
|
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityToolTable;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import invtweaks.api.container.InventoryContainer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
@InventoryContainer
|
|
||||||
public class ContainerToolTable extends Container{
|
|
||||||
|
|
||||||
private TileEntityToolTable table;
|
|
||||||
|
|
||||||
public ContainerToolTable(InventoryPlayer inventory, TileEntityBase tile){
|
|
||||||
this.table = (TileEntityToolTable)tile;
|
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++){
|
|
||||||
for(int j = 0; j < 2; j++){
|
|
||||||
this.addSlotToContainer(new Slot(this.table, j+i*2, 35+j*18, 7+i*18){
|
|
||||||
@Override
|
|
||||||
public void onSlotChanged(){
|
|
||||||
if(this.inventory instanceof TileEntityToolTable){
|
|
||||||
TileEntityToolTable table = (TileEntityToolTable)this.inventory;
|
|
||||||
ItemStack stack = ToolTableHandler.getResultFromSlots(table.slots);
|
|
||||||
table.slots[TileEntityToolTable.SLOT_OUTPUT] = stack == null ? null : stack.copy();
|
|
||||||
}
|
|
||||||
super.onSlotChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addSlotToContainer(new SlotOutput(this.table, TileEntityToolTable.SLOT_OUTPUT, 115, 25){
|
|
||||||
@Override
|
|
||||||
public void onPickupFromSlot(EntityPlayer player, ItemStack stack){
|
|
||||||
if(this.inventory instanceof TileEntityToolTable){
|
|
||||||
TileEntityToolTable table = (TileEntityToolTable)this.inventory;
|
|
||||||
ToolTableHandler.Recipe recipe = ToolTableHandler.getRecipeFromSlots(table.slots);
|
|
||||||
if(recipe != null){
|
|
||||||
ItemStack[] stacks = recipe.itemsNeeded.clone();
|
|
||||||
for(int i = 0; i < TileEntityToolTable.INPUT_SLOT_AMOUNT; i++){
|
|
||||||
int place = ItemUtil.getPlaceAt(stacks, table.getStackInSlot(i), false);
|
|
||||||
if(place != -1){
|
|
||||||
table.decrStackSize(i, 1);
|
|
||||||
stacks[place] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack newOutput = ToolTableHandler.getResultFromSlots(table.slots);
|
|
||||||
table.slots[TileEntityToolTable.SLOT_OUTPUT] = newOutput == null ? null : newOutput.copy();
|
|
||||||
}
|
|
||||||
super.onPickupFromSlot(player, stack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++){
|
|
||||||
for(int j = 0; j < 9; j++){
|
|
||||||
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 69+i*18));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int i = 0; i < 9; i++){
|
|
||||||
this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 127));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInteractWith(EntityPlayer player){
|
|
||||||
return this.table.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
|
||||||
final int inventoryStart = 7;
|
|
||||||
final int inventoryEnd = inventoryStart+26;
|
|
||||||
final int hotbarStart = inventoryEnd+1;
|
|
||||||
final int hotbarEnd = hotbarStart+8;
|
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
|
||||||
|
|
||||||
if (theSlot != null && theSlot.getHasStack()){
|
|
||||||
ItemStack newStack = theSlot.getStack();
|
|
||||||
ItemStack currentStack = newStack.copy();
|
|
||||||
|
|
||||||
//Slots in Inventory to shift from
|
|
||||||
if(slot == TileEntityToolTable.SLOT_OUTPUT){
|
|
||||||
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
|
||||||
theSlot.onSlotChange(newStack, currentStack);
|
|
||||||
}
|
|
||||||
//Other Slots in Inventory excluded
|
|
||||||
else if(slot >= inventoryStart){
|
|
||||||
//Shift from Inventory
|
|
||||||
if(ToolTableHandler.isIngredient(newStack)){
|
|
||||||
if(!this.mergeItemStack(newStack, 0, TileEntityToolTable.INPUT_SLOT_AMOUNT, false)) return null;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
|
||||||
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
|
||||||
}
|
|
||||||
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
|
||||||
}
|
|
||||||
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null;
|
|
||||||
|
|
||||||
if (newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
|
|
||||||
if (newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -77,8 +77,6 @@ public class GuiHandler implements IGuiHandler{
|
||||||
return new ContainerOreMagnet(entityPlayer.inventory, tile);
|
return new ContainerOreMagnet(entityPlayer.inventory, tile);
|
||||||
case CLOUD:
|
case CLOUD:
|
||||||
return new ContainerSmileyCloud();
|
return new ContainerSmileyCloud();
|
||||||
case TOOL_TABLE:
|
|
||||||
return new ContainerToolTable(entityPlayer.inventory, tile);
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -141,8 +139,6 @@ public class GuiHandler implements IGuiHandler{
|
||||||
return new GuiSmileyCloud(tile, x, y, z, world);
|
return new GuiSmileyCloud(tile, x, y, z, world);
|
||||||
case BOOK:
|
case BOOK:
|
||||||
return new GuiBooklet(null);
|
return new GuiBooklet(null);
|
||||||
case TOOL_TABLE:
|
|
||||||
return new GuiToolTable(entityPlayer.inventory, tile);
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -173,8 +169,7 @@ public class GuiHandler implements IGuiHandler{
|
||||||
XP_SOLIDIFIER,
|
XP_SOLIDIFIER,
|
||||||
ORE_MAGNET,
|
ORE_MAGNET,
|
||||||
CLOUD,
|
CLOUD,
|
||||||
BOOK(false),
|
BOOK(false);
|
||||||
TOOL_TABLE;
|
|
||||||
|
|
||||||
public boolean checkTileEntity;
|
public boolean checkTileEntity;
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("GuiToolTable.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.inventory.gui;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.inventory.ContainerToolTable;
|
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityToolTable;
|
|
||||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public class GuiToolTable extends GuiContainer{
|
|
||||||
|
|
||||||
private TileEntityToolTable table;
|
|
||||||
|
|
||||||
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiToolTable");
|
|
||||||
|
|
||||||
public GuiToolTable(InventoryPlayer inventory, TileEntityBase tile){
|
|
||||||
super(new ContainerToolTable(inventory, tile));
|
|
||||||
this.table = (TileEntityToolTable)tile;
|
|
||||||
this.xSize = 176;
|
|
||||||
this.ySize = 65+86;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
|
||||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.table.getInventoryName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
|
|
||||||
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
|
|
||||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop+65, 0, 0, 176, 86);
|
|
||||||
|
|
||||||
this.mc.getTextureManager().bindTexture(resLoc);
|
|
||||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 65);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen(int x, int y, float f){
|
|
||||||
super.drawScreen(x, y, f);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("EnchantmentCombo.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
|
|
||||||
public class EnchantmentCombo{
|
|
||||||
|
|
||||||
public Enchantment enchantment;
|
|
||||||
public int level;
|
|
||||||
|
|
||||||
public EnchantmentCombo(Enchantment ench, int level){
|
|
||||||
this.enchantment = ench;
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IToolTableRepairItem.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public interface IToolTableRepairItem{
|
|
||||||
|
|
||||||
ItemStack getRepairStack();
|
|
||||||
|
|
||||||
int repairPerStack();
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("InitToolTableTools.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class InitToolTableTools{
|
|
||||||
|
|
||||||
public static Item itemMinersPickaxe;
|
|
||||||
public static Item itemSilkyMinersPickaxe;
|
|
||||||
|
|
||||||
public static Item itemDiggersShovel;
|
|
||||||
public static Item itemFastDiggersShovel;
|
|
||||||
|
|
||||||
public static void init(){
|
|
||||||
itemMinersPickaxe = new ItemPickaxeFixedEnchants(Item.ToolMaterial.EMERALD, "itemMinersPickaxe", EnumRarity.rare, new ItemStack(Items.diamond), 400, new EnchantmentCombo(Enchantment.fortune, 2), new EnchantmentCombo(Enchantment.efficiency, 2), new EnchantmentCombo(Enchantment.unbreaking, 1));
|
|
||||||
ItemUtil.register(itemMinersPickaxe);
|
|
||||||
itemSilkyMinersPickaxe = new ItemPickaxeFixedEnchants(Item.ToolMaterial.EMERALD, "itemSilkyMinersPickaxe", EnumRarity.epic, new ItemStack(Items.diamond), 400, new EnchantmentCombo(Enchantment.silkTouch, 1), new EnchantmentCombo(Enchantment.efficiency, 2), new EnchantmentCombo(Enchantment.unbreaking, 1));
|
|
||||||
ItemUtil.register(itemSilkyMinersPickaxe);
|
|
||||||
|
|
||||||
itemDiggersShovel = new ItemShovelFixedEnchants(Item.ToolMaterial.EMERALD, "itemDiggersShovel", EnumRarity.rare, new ItemStack(Items.diamond), 400, new EnchantmentCombo(Enchantment.efficiency, 2), new EnchantmentCombo(Enchantment.unbreaking, 2));
|
|
||||||
ItemUtil.register(itemDiggersShovel);
|
|
||||||
itemFastDiggersShovel = new ItemShovelFixedEnchants(Item.ToolMaterial.EMERALD, "itemFastDiggersShovel", EnumRarity.epic, new ItemStack(Items.diamond), 400, new EnchantmentCombo(Enchantment.efficiency, 4), new EnchantmentCombo(Enchantment.unbreaking, 1));
|
|
||||||
ItemUtil.register(itemFastDiggersShovel);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ItemAllToolFixedEnchants.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemAllToolAA;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemAllToolFixedEnchants extends ItemAllToolAA implements IToolTableRepairItem{
|
|
||||||
|
|
||||||
private final int maxToolDamage;
|
|
||||||
private final EnchantmentCombo[] enchantments;
|
|
||||||
|
|
||||||
private ItemStack repairStack;
|
|
||||||
private int repairPerStack;
|
|
||||||
|
|
||||||
private IIcon iconBroken;
|
|
||||||
|
|
||||||
public ItemAllToolFixedEnchants(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity, ItemStack repairStack, int repairPerStack, EnchantmentCombo... enchantments){
|
|
||||||
super(toolMat, "", unlocalizedName, rarity);
|
|
||||||
this.enchantments = enchantments;
|
|
||||||
this.maxToolDamage = this.getMaxDamage();
|
|
||||||
this.setMaxDamage(this.maxToolDamage+1);
|
|
||||||
this.repairStack = repairStack;
|
|
||||||
this.repairPerStack = repairPerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroken(ItemStack stack){
|
|
||||||
return this.isBroken(stack.getItemDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBroken(int damage){
|
|
||||||
return damage > this.maxToolDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack stack1, ItemStack stack2){
|
|
||||||
return this.isRepairable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemEnchantability(ItemStack stack){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
if(!ItemUtil.hasEnchantment(stack, combo.enchantment)){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list){
|
|
||||||
ItemStack stack = new ItemStack(item);
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
list.add(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
|
||||||
return super.getItemStackDisplayName(stack)+(this.isBroken(stack) ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".broken.desc")+")" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
|
||||||
return this.isBroken(stack) ? 0.0F : super.getDigSpeed(stack, block, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
|
||||||
return !this.isBroken(stack) && super.canHarvestBlock(block, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack useItem, int useRemaining){
|
|
||||||
return this.isBroken(stack) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int damage){
|
|
||||||
return this.isBroken(damage) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister iconReg){
|
|
||||||
this.iconBroken = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Broken");
|
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRepairStack(){
|
|
||||||
return this.repairStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int repairPerStack(){
|
|
||||||
return this.repairPerStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ItemAxeFixedEnchants.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemAxeAA;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemAxeFixedEnchants extends ItemAxeAA implements IToolTableRepairItem{
|
|
||||||
|
|
||||||
private final int maxToolDamage;
|
|
||||||
private final EnchantmentCombo[] enchantments;
|
|
||||||
|
|
||||||
private ItemStack repairStack;
|
|
||||||
private int repairPerStack;
|
|
||||||
|
|
||||||
private IIcon iconBroken;
|
|
||||||
|
|
||||||
public ItemAxeFixedEnchants(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity, ItemStack repairStack, int repairPerStack, EnchantmentCombo... enchantments){
|
|
||||||
super(toolMat, "", unlocalizedName, rarity);
|
|
||||||
this.enchantments = enchantments;
|
|
||||||
this.maxToolDamage = this.getMaxDamage();
|
|
||||||
this.setMaxDamage(this.maxToolDamage+1);
|
|
||||||
this.repairStack = repairStack;
|
|
||||||
this.repairPerStack = repairPerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroken(ItemStack stack){
|
|
||||||
return this.isBroken(stack.getItemDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBroken(int damage){
|
|
||||||
return damage > this.maxToolDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack stack1, ItemStack stack2){
|
|
||||||
return this.isRepairable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemEnchantability(ItemStack stack){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
if(!ItemUtil.hasEnchantment(stack, combo.enchantment)){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list){
|
|
||||||
ItemStack stack = new ItemStack(item);
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
list.add(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
|
||||||
return super.getItemStackDisplayName(stack)+(this.isBroken(stack) ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".broken.desc")+")" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
|
||||||
return this.isBroken(stack) ? 0.0F : super.getDigSpeed(stack, block, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
|
||||||
return !this.isBroken(stack) && super.canHarvestBlock(block, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack useItem, int useRemaining){
|
|
||||||
return this.isBroken(stack) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int damage){
|
|
||||||
return this.isBroken(damage) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister iconReg){
|
|
||||||
this.iconBroken = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Broken");
|
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRepairStack(){
|
|
||||||
return this.repairStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int repairPerStack(){
|
|
||||||
return this.repairPerStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,139 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ItemLumberAxe.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemAxeAA;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.WorldPos;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ItemLumberAxe extends ItemAxeAA implements IToolTableRepairItem{
|
|
||||||
|
|
||||||
private final int maxToolDamage;
|
|
||||||
|
|
||||||
private ItemStack repairStack;
|
|
||||||
private int repairPerStack;
|
|
||||||
|
|
||||||
private IIcon iconBroken;
|
|
||||||
|
|
||||||
public ItemLumberAxe(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity, ItemStack repairStack, int repairPerStack){
|
|
||||||
super(toolMat, "", unlocalizedName, rarity);
|
|
||||||
this.maxToolDamage = this.getMaxDamage();
|
|
||||||
this.setMaxDamage(this.maxToolDamage+1);
|
|
||||||
this.repairStack = repairStack;
|
|
||||||
this.repairPerStack = repairPerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player){
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<WorldPos> getTreeBlocksToBreak(World world, int startX, int startY, int startZ){
|
|
||||||
ArrayList<WorldPos> positions = new ArrayList<WorldPos>();
|
|
||||||
int range = 3;
|
|
||||||
for(int x = -range; x < range+1; x++){
|
|
||||||
for(int z = -range; z < range+1; z++){
|
|
||||||
for(int y = -range; y < range+1; y++){
|
|
||||||
int theX = startX+x;
|
|
||||||
int theY = startY+y;
|
|
||||||
int theZ = startZ+z;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return positions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroken(ItemStack stack){
|
|
||||||
return this.isBroken(stack.getItemDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBroken(int damage){
|
|
||||||
return damage > this.maxToolDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack stack1, ItemStack stack2){
|
|
||||||
return this.isRepairable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemEnchantability(ItemStack stack){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
|
||||||
return super.getItemStackDisplayName(stack)+(this.isBroken(stack) ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".broken.desc")+")" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
|
||||||
return this.isBroken(stack) ? 0.0F : super.getDigSpeed(stack, block, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
|
||||||
return !this.isBroken(stack) && super.canHarvestBlock(block, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack useItem, int useRemaining){
|
|
||||||
return this.isBroken(stack) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int damage){
|
|
||||||
return this.isBroken(damage) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister iconReg){
|
|
||||||
this.iconBroken = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Broken");
|
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRepairStack(){
|
|
||||||
return this.repairStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int repairPerStack(){
|
|
||||||
return this.repairPerStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ItemPickaxeNoEnchants.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemPickaxeAA;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemPickaxeFixedEnchants extends ItemPickaxeAA implements IToolTableRepairItem{
|
|
||||||
|
|
||||||
private final int maxToolDamage;
|
|
||||||
private final EnchantmentCombo[] enchantments;
|
|
||||||
|
|
||||||
private ItemStack repairStack;
|
|
||||||
private int repairPerStack;
|
|
||||||
|
|
||||||
private IIcon iconBroken;
|
|
||||||
|
|
||||||
public ItemPickaxeFixedEnchants(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity, ItemStack repairStack, int repairPerStack, EnchantmentCombo... enchantments){
|
|
||||||
super(toolMat, "", unlocalizedName, rarity);
|
|
||||||
this.enchantments = enchantments;
|
|
||||||
this.maxToolDamage = this.getMaxDamage();
|
|
||||||
this.setMaxDamage(this.maxToolDamage+1);
|
|
||||||
this.repairStack = repairStack;
|
|
||||||
this.repairPerStack = repairPerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroken(ItemStack stack){
|
|
||||||
return this.isBroken(stack.getItemDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBroken(int damage){
|
|
||||||
return damage > this.maxToolDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack stack1, ItemStack stack2){
|
|
||||||
return this.isRepairable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemEnchantability(ItemStack stack){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
if(!ItemUtil.hasEnchantment(stack, combo.enchantment)){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list){
|
|
||||||
ItemStack stack = new ItemStack(item);
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
list.add(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
|
||||||
return super.getItemStackDisplayName(stack)+(this.isBroken(stack) ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".broken.desc")+")" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
|
||||||
return this.isBroken(stack) ? 0.0F : super.getDigSpeed(stack, block, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
|
||||||
return !this.isBroken(stack) && super.canHarvestBlock(block, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack useItem, int useRemaining){
|
|
||||||
return this.isBroken(stack) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int damage){
|
|
||||||
return this.isBroken(damage) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister iconReg){
|
|
||||||
this.iconBroken = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Broken");
|
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRepairStack(){
|
|
||||||
return this.repairStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int repairPerStack(){
|
|
||||||
return this.repairPerStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ItemShovelFixedEnchants.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemShovelAA;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemShovelFixedEnchants extends ItemShovelAA implements IToolTableRepairItem{
|
|
||||||
|
|
||||||
private final int maxToolDamage;
|
|
||||||
private final EnchantmentCombo[] enchantments;
|
|
||||||
|
|
||||||
private ItemStack repairStack;
|
|
||||||
private int repairPerStack;
|
|
||||||
|
|
||||||
private IIcon iconBroken;
|
|
||||||
|
|
||||||
public ItemShovelFixedEnchants(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity, ItemStack repairStack, int repairPerStack, EnchantmentCombo... enchantments){
|
|
||||||
super(toolMat, "", unlocalizedName, rarity);
|
|
||||||
this.enchantments = enchantments;
|
|
||||||
this.maxToolDamage = this.getMaxDamage();
|
|
||||||
this.setMaxDamage(this.maxToolDamage+1);
|
|
||||||
this.repairStack = repairStack;
|
|
||||||
this.repairPerStack = repairPerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroken(ItemStack stack){
|
|
||||||
return this.isBroken(stack.getItemDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBroken(int damage){
|
|
||||||
return damage > this.maxToolDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack stack1, ItemStack stack2){
|
|
||||||
return this.isRepairable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemEnchantability(ItemStack stack){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
if(!ItemUtil.hasEnchantment(stack, combo.enchantment)){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list){
|
|
||||||
ItemStack stack = new ItemStack(item);
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
list.add(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
|
||||||
return super.getItemStackDisplayName(stack)+(this.isBroken(stack) ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".broken.desc")+")" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
|
||||||
return this.isBroken(stack) ? 0.0F : super.getDigSpeed(stack, block, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
|
||||||
return !this.isBroken(stack) && super.canHarvestBlock(block, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack useItem, int useRemaining){
|
|
||||||
return this.isBroken(stack) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int damage){
|
|
||||||
return this.isBroken(damage) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister iconReg){
|
|
||||||
this.iconBroken = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Broken");
|
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRepairStack(){
|
|
||||||
return this.repairStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int repairPerStack(){
|
|
||||||
return this.repairPerStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ItemSwordFixedEnchants.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.items.tools.table;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import ellpeck.actuallyadditions.items.tools.ItemSwordAA;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemSwordFixedEnchants extends ItemSwordAA implements IToolTableRepairItem{
|
|
||||||
|
|
||||||
private final int maxToolDamage;
|
|
||||||
private final EnchantmentCombo[] enchantments;
|
|
||||||
|
|
||||||
private ItemStack repairStack;
|
|
||||||
private int repairPerStack;
|
|
||||||
|
|
||||||
private IIcon iconBroken;
|
|
||||||
|
|
||||||
public ItemSwordFixedEnchants(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity, ItemStack repairStack, int repairPerStack, EnchantmentCombo... enchantments){
|
|
||||||
super(toolMat, "", unlocalizedName, rarity);
|
|
||||||
this.enchantments = enchantments;
|
|
||||||
this.maxToolDamage = this.getMaxDamage();
|
|
||||||
this.setMaxDamage(this.maxToolDamage+1);
|
|
||||||
this.repairStack = repairStack;
|
|
||||||
this.repairPerStack = repairPerStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBroken(ItemStack stack){
|
|
||||||
return this.isBroken(stack.getItemDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBroken(int damage){
|
|
||||||
return damage > this.maxToolDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack, int pass){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getIsRepairable(ItemStack stack1, ItemStack stack2){
|
|
||||||
return this.isRepairable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemEnchantability(ItemStack stack){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
if(!ItemUtil.hasEnchantment(stack, combo.enchantment)){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list){
|
|
||||||
ItemStack stack = new ItemStack(item);
|
|
||||||
for(EnchantmentCombo combo : this.enchantments){
|
|
||||||
ItemUtil.addEnchantment(stack, combo.enchantment, combo.level);
|
|
||||||
}
|
|
||||||
list.add(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
|
||||||
return super.getItemStackDisplayName(stack)+(this.isBroken(stack) ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".broken.desc")+")" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
|
||||||
return this.isBroken(stack) ? 0.0F : super.getDigSpeed(stack, block, meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
|
||||||
return !this.isBroken(stack) && super.canHarvestBlock(block, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack useItem, int useRemaining){
|
|
||||||
return this.isBroken(stack) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(int damage){
|
|
||||||
return this.isBroken(damage) ? this.iconBroken : this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister iconReg){
|
|
||||||
this.iconBroken = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Broken");
|
|
||||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRepairStack(){
|
|
||||||
return this.repairStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int repairPerStack(){
|
|
||||||
return this.repairPerStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -83,9 +83,6 @@ public class ClientProxy implements IProxy{
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud(new ModelSmileyCloud()));
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud(new ModelSmileyCloud()));
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockSmileyCloud), new RenderItems(new ModelSmileyCloud()));
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockSmileyCloud), new RenderItems(new ModelSmileyCloud()));
|
||||||
|
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityToolTable.class, new RenderTileEntity(new ModelToolTable()));
|
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockToolTable), new RenderItems(new ModelToolTable()));
|
|
||||||
|
|
||||||
VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png"));
|
VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png"));
|
||||||
|
|
||||||
Util.registerEvent(new TooltipEvent());
|
Util.registerEvent(new TooltipEvent());
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ToolTableHandler.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.recipe;
|
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.items.tools.table.IToolTableRepairItem;
|
|
||||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ToolTableHandler{
|
|
||||||
|
|
||||||
public static ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
|
||||||
|
|
||||||
public static void addRecipe(ItemStack output, ItemStack... itemsNeeded){
|
|
||||||
recipes.add(new Recipe(output, itemsNeeded));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getResultFromSlots(ItemStack[] slots){
|
|
||||||
Recipe recipe = getRecipeFromSlots(slots);
|
|
||||||
return recipe == null ? null : recipe.output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Recipe getRecipeFromSlots(ItemStack[] slots){
|
|
||||||
//Normal Recipes
|
|
||||||
for(Recipe recipe : recipes){
|
|
||||||
if(ItemUtil.containsAll(slots, recipe.itemsNeeded, false)){
|
|
||||||
return recipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Repair Recipes
|
|
||||||
for(ItemStack slot : slots){
|
|
||||||
if(slot != null && slot.getItem() instanceof IToolTableRepairItem){
|
|
||||||
if(ItemUtil.contains(slots, ((IToolTableRepairItem)slot.getItem()).getRepairStack(), false) && slot.getItemDamage() > 0){
|
|
||||||
ItemStack returnStack = slot.copy();
|
|
||||||
returnStack.setItemDamage(Math.max(0, returnStack.getItemDamage()-((IToolTableRepairItem)returnStack.getItem()).repairPerStack()));
|
|
||||||
return new Recipe(returnStack, slot, ((IToolTableRepairItem)returnStack.getItem()).getRepairStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isIngredient(ItemStack stack){
|
|
||||||
for(Recipe recipe : recipes){
|
|
||||||
if(stack != null){
|
|
||||||
for(ItemStack aStack : recipe.itemsNeeded){
|
|
||||||
if(aStack != null && stack.isItemEqual(aStack)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Recipe{
|
|
||||||
|
|
||||||
public ItemStack[] itemsNeeded;
|
|
||||||
public ItemStack output;
|
|
||||||
|
|
||||||
public Recipe(ItemStack output, ItemStack... itemsNeeded){
|
|
||||||
this.output = output;
|
|
||||||
this.itemsNeeded = itemsNeeded;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -71,7 +71,6 @@ public class TileEntityBase extends TileEntity{
|
||||||
GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier");
|
GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier");
|
||||||
GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet");
|
GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet");
|
||||||
GameRegistry.registerTileEntity(TileEntitySmileyCloud.class, ModUtil.MOD_ID_LOWER+":tileEntityCloud");
|
GameRegistry.registerTileEntity(TileEntitySmileyCloud.class, ModUtil.MOD_ID_LOWER+":tileEntityCloud");
|
||||||
GameRegistry.registerTileEntity(TileEntityToolTable.class, ModUtil.MOD_ID_LOWER+":tileEntityToolTable");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("TileEntityToolTable.java") is part of the Actually Additions Mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.tile;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class TileEntityToolTable extends TileEntityInventoryBase{
|
|
||||||
|
|
||||||
public static final int SLOT_OUTPUT = 6;
|
|
||||||
public static final int INPUT_SLOT_AMOUNT = 6;
|
|
||||||
|
|
||||||
public TileEntityToolTable(){
|
|
||||||
super(7, "toolTable");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canUpdate(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 979 B |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
Loading…
Reference in a new issue