Item Repairer & Bug Fixes

This commit is contained in:
Ellpeck 2015-04-02 12:06:42 +02:00
parent 0d090f1d2c
commit 9eb6f3a88c
30 changed files with 586 additions and 93 deletions

View file

@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-0.0.3.2"
version = "1.7.10-0.0.3.3"
group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions"

View file

@ -44,7 +44,7 @@ public class BlockCompost extends BlockContainerBase implements IName{
ItemStack stackPlayer = player.getCurrentEquippedItem();
TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(x, y, z);
//Add items to be composted
if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < ConfigValues.tileEntityCompostAmountNeededToConvert))){
if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < ConfigValues.compostAmountNeededToConvert))){
if(tile.slots[0] == null) tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal());
else tile.slots[0].stackSize++;
if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--;

View file

@ -0,0 +1,132 @@
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.TileEntityItemRepairer;
import ellpeck.actuallyadditions.util.IName;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
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.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockItemRepairer extends BlockContainerBase implements IName{
private IIcon topIcon;
private IIcon onIcon;
private IIcon bottomIcon;
public BlockItemRepairer(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
this.setTickRandomly(true);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityItemRepairer();
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z){
return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0;
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 1 && meta != 1) return this.topIcon;
if(side == 1) return this.onIcon;
if(side == 0) return this.bottomIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "On");
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom");
}
@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){
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(x, y, z);
if (repairer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.REPAIRER_ID, world, x, y, z);
return true;
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
public String getName(){
return "blockItemRepairer";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc"));
}
else list.add(ItemUtil.shiftForInfo());
}
@Override
public int getMetadata(int meta){
return meta;
}
}
}

View file

@ -18,6 +18,7 @@ public class InitBlocks{
public static Block blockFishingNet;
public static Block blockFurnaceSolar;
public static Block blockHeatCollector;
public static Block blockItemRepairer;
public static void init(){
Util.logInfo("Initializing Blocks...");
@ -54,5 +55,8 @@ public class InitBlocks{
blockHeatCollector = new BlockHeatCollector();
BlockUtil.register(blockHeatCollector, BlockHeatCollector.TheItemBlock.class);
blockItemRepairer = new BlockItemRepairer();
BlockUtil.register(blockItemRepairer, BlockItemRepairer.TheItemBlock.class);
}
}

View file

@ -12,6 +12,8 @@ public class ConfigValues{
public static boolean[] enablePotionRingRecipes = new boolean[ThePotionRings.values().length];
public static boolean enableCompostRecipe;
public static boolean enableKnifeRecipe;
public static boolean enableLeafBlowerRecipe;
public static boolean enableLeafBlowerAdvancedRecipe;
public static boolean enableCrusherRecipe;
public static boolean enableCrusherDoubleRecipe;
public static boolean enableFurnaceDoubleRecipe;
@ -19,42 +21,42 @@ public class ConfigValues{
public static boolean enableFeederRecipe;
public static boolean enableCrafterRecipe;
public static boolean enableInputterRecipe;
public static int tileEntityCompostAmountNeededToConvert;
public static int tileEntityCompostConversionTimeNeeded;
public static int tileEntityFeederReach;
public static int tileEntityFeederTimeNeeded;
public static int tileEntityFeederThreshold;
public static int tileFishingNetTime;
public static int itemKnifeMaxDamage;
public static int toolEmeraldHarvestLevel;
public static int toolEmeraldMaxUses;
public static float toolEmeraldEfficiency;
public static float toolEmeraldDamage;
public static int toolEmeraldEnchantability;
public static boolean enableRepairerRecipe;
public static boolean enableSolarRecipe;
public static boolean enableFishingNetRecipe;
public static boolean enableHeatCollectorRecipe;
public static boolean enableToolEmeraldRecipe;
public static int toolObsidianHarvestLevel;
public static int toolObsidianMaxUses;
public static float toolObsidianEfficiency;
public static float toolObsidianDamage;
public static int toolObsidianEnchantability;
public static boolean enableToolObsidianRecipe;
public static int knifeMaxDamage;
public static int toolEmeraldHarvestLevel;
public static int toolEmeraldMaxUses;
public static int toolEmeraldEnchantability;
public static int toolObsidianHarvestLevel;
public static int toolObsidianMaxUses;
public static int toolObsidianEnchantability;
public static float toolObsidianEfficiency;
public static float toolObsidianDamage;
public static float toolEmeraldEfficiency;
public static float toolEmeraldDamage;
public static int compostAmountNeededToConvert;
public static int compostConversionTimeNeeded;
public static int feederReach;
public static int feederTimeNeeded;
public static int feederThreshold;
public static int fishingNetTime;
public static int furnaceDoubleSmeltTime;
public static int grinderDoubleCrushTime;
public static int grinderCrushTime;
public static boolean enableExperienceDrop;
public static boolean enableBloodDrop;
public static boolean enableHeartDrop;
public static boolean enableSubstanceDrop;
public static boolean enablePearlShardDrop;
public static boolean enableEmeraldShardDrop;
public static int leafBlowerRangeSides;
public static int leafBlowerRangeUp;
public static int heatCollectorRandomChance;
public static int heatCollectorBlocksNeeded;
public static int repairerSpeedSlowdown;
public static boolean leafBlowerDropItems;
public static boolean leafBlowerParticles;
public static boolean leafBlowerHasSound;
public static boolean generateBlackQuartz;
public static int blackQuartzBaseAmount;
@ -63,20 +65,12 @@ public class ConfigValues{
public static int blackQuartzMinHeight;
public static int blackQuartzMaxHeight;
public static boolean enableLeafBlowerRecipe;
public static boolean enableLeafBlowerAdvancedRecipe;
public static int leafBlowerRangeSides;
public static int leafBlowerRangeUp;
public static boolean leafBlowerDropItems;
public static boolean leafBlowerParticles;
public static boolean leafBlowerHasSound;
public static boolean enableSolarRecipe;
public static boolean enableFishingNetRecipe;
public static boolean enableHeatCollectorRecipe;
public static int heatCollectorRandomChance;
public static int heatCollectorBlocksNeeded;
public static boolean enableExperienceDrop;
public static boolean enableBloodDrop;
public static boolean enableHeartDrop;
public static boolean enableSubstanceDrop;
public static boolean enablePearlShardDrop;
public static boolean enableEmeraldShardDrop;
public static void defineConfigValues(Configuration config){
@ -86,7 +80,6 @@ public class ConfigValues{
for(int i = 0; i < enabledMiscRecipes.length; i++){
enabledMiscRecipes[i] = config.getBoolean(TheMiscItems.values()[i].name, ConfigurationHandler.CATEGORY_MISC_CRAFTING, true, "If the Crafting Recipe for " + TheMiscItems.values()[i].name + " is Enabled");
}
for(int i = 0; i < enablePotionRingRecipes.length; i++){
enablePotionRingRecipes[i] = config.getBoolean(ThePotionRings.values()[i].name, ConfigurationHandler.CATEGORY_POTION_RING_CRAFTING, i != ThePotionRings.SATURATION.ordinal(), "If the Crafting Recipe for the Ring of " + ThePotionRings.values()[i].name + " is Enabled");
}
@ -114,6 +107,7 @@ public class ConfigValues{
enableEmeraldShardDrop = config.getBoolean("Emerald Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Emerald Shard drops from Mobs");
enableCompostRecipe = config.getBoolean("Compost", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Compost is Enabled");
enableRepairerRecipe = config.getBoolean("Item Repairer", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Item Repairer is Enabled");
enableKnifeRecipe = config.getBoolean("Knife", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Knife is Enabled");
enableCrusherDoubleRecipe = config.getBoolean("Double Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Crusher is Enabled");
enableCrusherRecipe = config.getBoolean("Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Crusher is Enabled");
@ -127,16 +121,16 @@ public class ConfigValues{
enableFishingNetRecipe = config.getBoolean("Fishing Net", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Fishing Net is Enabled");
enableHeatCollectorRecipe = config.getBoolean("Heat Collector", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Heat Collector is Enabled");
tileEntityCompostAmountNeededToConvert = config.getInt("Compost: Amount Needed To Convert", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer");
tileEntityCompostConversionTimeNeeded = config.getInt("Compost: Conversion Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer");
compostAmountNeededToConvert = config.getInt("Compost: Amount Needed To Convert", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer");
compostConversionTimeNeeded = config.getInt("Compost: Conversion Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer");
tileFishingNetTime = config.getInt("Fishing Net: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish");
fishingNetTime = config.getInt("Fishing Net: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish");
tileEntityFeederReach = config.getInt("Feeder: Reach", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder");
tileEntityFeederTimeNeeded = config.getInt("Feeder: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder");
tileEntityFeederThreshold = config.getInt("Feeder: Threshold", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop");
feederReach = config.getInt("Feeder: Reach", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder");
feederTimeNeeded = config.getInt("Feeder: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder");
feederThreshold = config.getInt("Feeder: Threshold", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop");
itemKnifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with");
knifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with");
toolEmeraldHarvestLevel = config.getInt("Emerald: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolEmeraldMaxUses = config.getInt("Emerald: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used");
@ -156,7 +150,8 @@ public class ConfigValues{
grinderDoubleCrushTime = config.getInt("Double Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item");
furnaceDoubleSmeltTime = config.getInt("Double Furnace: Smelt Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item");
repairerSpeedSlowdown = config.getInt("Item Repairer: Speed Slowdown", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs");
heatCollectorBlocksNeeded = config.getInt("Heat Collector: Blocks Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it");
heatCollectorRandomChance = config.getInt("Heat Collector: Random Chance", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)");
heatCollectorRandomChance = config.getInt("Heat Collector: Random Chance", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)");
}
}

View file

@ -34,6 +34,14 @@ public class BlockCrafting{
'D', new ItemStack(Items.diamond),
'S', new ItemStack(Items.string));
//Repairer
if(ConfigValues.enableRepairerRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockItemRepairer),
"DID", "DCD", "DID",
'D', new ItemStack(Items.diamond),
'I', new ItemStack(Items.iron_ingot),
'C', new ItemStack(Blocks.crafting_table));
//Solar Panel
if(ConfigValues.enableSolarRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceSolar),

View file

@ -33,6 +33,7 @@ public class CreativeTab extends CreativeTabs{
this.addBlock(InitBlocks.blockFurnaceSolar);
this.addBlock(InitBlocks.blockFishingNet);
this.addBlock(InitBlocks.blockHeatCollector);
this.addBlock(InitBlocks.blockItemRepairer);
this.addBlock(InitBlocks.blockMisc);
this.addBlock(InitBlocks.blockFeeder);

View file

@ -22,7 +22,7 @@ public class RenderSpecial{
public void render(EntityPlayer player, float renderTick, float size, float offsetUp){
int bobHeight = 70;
double rotationModifier = 3;
double rotationModifier = 2;
long time = player.worldObj.getTotalWorldTime();
if(time-bobHeight >= lastTimeForBobbing){
@ -49,7 +49,7 @@ public class RenderSpecial{
GL11.glTranslated(0, -((double)time-lastTimeForBobbing)/100+(double)bobHeight/100, 0);
}
GL11.glRotated(time * rotationModifier, 0, 1, 0);
GL11.glRotated((double)time*rotationModifier, 0, 1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F);

View file

@ -0,0 +1,117 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityItemRepairer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
public class ContainerRepairer extends Container{
private TileEntityItemRepairer tileRepairer;
private int lastCoalTime;
private int lastCoalTimeLeft;
public ContainerRepairer(InventoryPlayer inventory, TileEntityBase tile){
this.tileRepairer = (TileEntityItemRepairer)tile;
this.addSlotToContainer(new Slot(this.tileRepairer, TileEntityItemRepairer.SLOT_COAL, 80, 21));
this.addSlotToContainer(new Slot(this.tileRepairer, TileEntityItemRepairer.SLOT_INPUT, 47, 53));
this.addSlotToContainer(new SlotOutput(this.tileRepairer, TileEntityItemRepairer.SLOT_OUTPUT, 109, 53));
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, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.coalTime);
iCraft.sendProgressBarUpdate(this, 1, this.tileRepairer.coalTimeLeft);
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastCoalTime != this.tileRepairer.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.coalTime);
if(this.lastCoalTimeLeft != this.tileRepairer.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileRepairer.coalTimeLeft);
}
this.lastCoalTime = this.tileRepairer.coalTime;
this.lastCoalTimeLeft = this.tileRepairer.coalTimeLeft;
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.tileRepairer.coalTime = par2;
if(par1 == 1) this.tileRepairer.coalTimeLeft = par2;
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.tileRepairer.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 3;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(slot <= hotbarEnd && slot >= inventoryStart){
if(TileEntityItemRepairer.canBeRepaired(currentStack)){
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false);
}
if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_COAL, TileEntityItemRepairer.SLOT_COAL+1, false);
}
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
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;
}
}

View file

@ -34,6 +34,9 @@ public class GuiHandler implements IGuiHandler{
case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerInputter(entityPlayer.inventory, tileInputter);
case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerRepairer(entityPlayer.inventory, tileRepairer);
default:
return null;
}
@ -62,6 +65,9 @@ public class GuiHandler implements IGuiHandler{
case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world);
case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiRepairer(entityPlayer.inventory, tileRepairer);
default:
return null;
}
@ -74,6 +80,7 @@ public class GuiHandler implements IGuiHandler{
public static final int GRINDER_DOUBLE_ID = 4;
public static final int FURNACE_DOUBLE_ID = 5;
public static final int INPUTTER_ID = 6;
public static final int REPAIRER_ID = 7;
public static void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -0,0 +1,50 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityItemRepairer;
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 GuiRepairer extends GuiContainer{
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiRepairer");
private TileEntityItemRepairer tileRepairer;
public GuiRepairer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerRepairer(inventory, tile));
this.tileRepairer = (TileEntityItemRepairer)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@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+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileRepairer.coalTime > 0){
int i = this.tileRepairer.getCoalTimeToScale(15);
this.drawTexturedModalRect(this.guiLeft+80, this.guiTop+5+14-i, 176, 44+14-i, 14, i);
}
if(TileEntityItemRepairer.canBeRepaired(this.tileRepairer.slots[TileEntityItemRepairer.SLOT_INPUT])){
int i = this.tileRepairer.getItemDamageToScale(22);
this.drawTexturedModalRect(this.guiLeft+73, this.guiTop+52, 176, 28, i, 16);
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -20,7 +20,7 @@ import java.util.List;
public class ItemKnife extends Item implements IName{
public ItemKnife(){
this.setMaxDamage(ConfigValues.itemKnifeMaxDamage);
this.setMaxDamage(ConfigValues.knifeMaxDamage);
this.setMaxStackSize(1);
this.setContainerItem(this);
}

View file

@ -0,0 +1,12 @@
package ellpeck.actuallyadditions.tile;
public interface IPowerAcceptor{
void setBlockMetadataToOn();
void setPower(int power);
void setItemPower(int power);
int getItemPower();
}

View file

@ -38,6 +38,7 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityFishingNet.class, ModUtil.MOD_ID_LOWER + ":tileEntityFishingNet");
GameRegistry.registerTileEntity(TileEntityFurnaceSolar.class, ModUtil.MOD_ID_LOWER + ":tileEntityFurnaceSolar");
GameRegistry.registerTileEntity(TileEntityHeatCollector.class, ModUtil.MOD_ID_LOWER + ":tileEntityHeatCollector");
GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID_LOWER + ":tileEntityRepairer");
}
@Override

View file

@ -10,8 +10,8 @@ import net.minecraft.nbt.NBTTagCompound;
public class TileEntityCompost extends TileEntityInventoryBase{
public final int amountNeededToConvert = ConfigValues.tileEntityCompostAmountNeededToConvert;
public final int conversionTimeNeeded = ConfigValues.tileEntityCompostConversionTimeNeeded;
public final int amountNeededToConvert = ConfigValues.compostAmountNeededToConvert;
public final int conversionTimeNeeded = ConfigValues.compostConversionTimeNeeded;
public int conversionTime;

View file

@ -16,9 +16,9 @@ import java.util.Random;
public class TileEntityFeeder extends TileEntityInventoryBase{
public int reach = ConfigValues.tileEntityFeederReach;
public int timerGoal = ConfigValues.tileEntityFeederTimeNeeded;
public int animalThreshold = ConfigValues.tileEntityFeederThreshold;
public int reach = ConfigValues.feederReach;
public int timerGoal = ConfigValues.feederTimeNeeded;
public int animalThreshold = ConfigValues.feederThreshold;
public int currentTimer;
public int currentAnimalAmount;

View file

@ -10,7 +10,7 @@ import java.util.Random;
public class TileEntityFishingNet extends TileEntityBase{
public int timeUntilNextDropToSet = ConfigValues.tileFishingNetTime;
public int timeUntilNextDropToSet = ConfigValues.fishingNetTime;
public int timeUntilNextDrop;

View file

@ -9,7 +9,7 @@ import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
public class TileEntityFurnaceDouble extends TileEntityInventoryBase{
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IPowerAcceptor{
public static final int SLOT_COAL = 0;
public static final int SLOT_INPUT_1 = 1;
@ -153,4 +153,25 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase{
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
}
@Override
public void setBlockMetadataToOn(){
int metaBefore = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metaBefore+4, 2);
}
@Override
public void setPower(int power){
this.coalTimeLeft = power;
}
@Override
public void setItemPower(int power){
this.coalTime = power;
}
@Override
public int getItemPower(){
return this.coalTime;
}
}

View file

@ -18,6 +18,16 @@ public class TileEntityFurnaceSolar extends TileEntityBase{
}
public static void givePowerTo(TileEntity tile){
if(tile instanceof IPowerAcceptor){
IPowerAcceptor acceptor = (IPowerAcceptor)tile;
int coalTimeBefore = acceptor.getItemPower();
acceptor.setItemPower(42);
acceptor.setPower(42);
if(coalTimeBefore == 0){
acceptor.setBlockMetadataToOn();
}
return;
}
if(tile instanceof TileEntityFurnace){
TileEntityFurnace furnaceBelow = (TileEntityFurnace)tile;
int burnTimeBefore = furnaceBelow.furnaceBurnTime;
@ -26,29 +36,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase{
if(burnTimeBefore == 0){
BlockFurnace.updateFurnaceBlockState(true, tile.getWorldObj(), furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord);
}
return;
}
if(tile instanceof TileEntityFurnaceDouble){
TileEntityFurnaceDouble doubleBelow = (TileEntityFurnaceDouble)tile;
int coalTimeBefore = doubleBelow.coalTime;
doubleBelow.coalTime = 42;
doubleBelow.coalTimeLeft = 42;
if(coalTimeBefore == 0){
int metaBefore = tile.getWorldObj().getBlockMetadata(doubleBelow.xCoord, doubleBelow.yCoord, doubleBelow.zCoord);
tile.getWorldObj().setBlockMetadataWithNotify(doubleBelow.xCoord, doubleBelow.yCoord, doubleBelow.zCoord, metaBefore+4, 2);
}
return;
}
if(tile instanceof TileEntityGrinder){
TileEntityGrinder grinderBelow = (TileEntityGrinder)tile;
int coalTimeBefore = grinderBelow.coalTime;
grinderBelow.coalTime = 42;
grinderBelow.coalTimeLeft = 42;
if(coalTimeBefore == 0){
tile.getWorldObj().setBlockMetadataWithNotify(grinderBelow.xCoord, grinderBelow.yCoord, grinderBelow.zCoord, 1, 2);
}
}
}
}

View file

@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntityFurnace;
import java.util.Random;
public class TileEntityGrinder extends TileEntityInventoryBase{
public class TileEntityGrinder extends TileEntityInventoryBase implements IPowerAcceptor{
public static final int SLOT_COAL = 0;
public static final int SLOT_INPUT_1 = 1;
@ -184,4 +184,24 @@ public class TileEntityGrinder extends TileEntityInventoryBase{
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
}
@Override
public void setBlockMetadataToOn(){
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
}
@Override
public void setPower(int power){
this.coalTimeLeft = power;
}
@Override
public void setItemPower(int power){
this.coalTime = power;
}
@Override
public int getItemPower(){
return this.coalTime;
}
}

View file

@ -0,0 +1,136 @@
package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IPowerAcceptor{
public static final int SLOT_COAL = 0;
public static final int SLOT_INPUT = 1;
public static final int SLOT_OUTPUT = 2;
private final int speedSlowdown = ConfigValues.repairerSpeedSlowdown;
public int coalTime;
public int coalTimeLeft;
public int nextRepairTick;
public TileEntityItemRepairer(){
super(3, "tileEntityItemRepairer");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean theFlag = this.coalTimeLeft > 0;
if(this.coalTimeLeft > 0) this.coalTimeLeft--;
if(this.slots[SLOT_OUTPUT] == null){
if(canBeRepaired(this.slots[SLOT_INPUT])){
if(this.slots[SLOT_INPUT].getItemDamage() <= 0){
this.slots[SLOT_OUTPUT] = this.slots[SLOT_INPUT].copy();
this.slots[SLOT_INPUT] = null;
}
else{
if(this.coalTimeLeft <= 0){
this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]);
this.coalTimeLeft = this.coalTime;
if(this.coalTime > 0){
this.slots[SLOT_COAL].stackSize--;
if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]);
}
}
if(this.coalTimeLeft > 0){
this.nextRepairTick++;
if(this.nextRepairTick >= this.speedSlowdown){
this.nextRepairTick = 0;
this.slots[SLOT_INPUT].setItemDamage(this.slots[SLOT_INPUT].getItemDamage() - 1);
}
}
}
}
}
if(theFlag != this.coalTimeLeft > 0){
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? 1 : 0), 2);
this.markDirty();
}
}
}
public static boolean canBeRepaired(ItemStack stack){
return stack != null && stack.getItem().isRepairable();
}
@Override
public void writeToNBT(NBTTagCompound compound){
compound.setInteger("CoalTime", this.coalTime);
compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
compound.setInteger("NextRepairTick", this.nextRepairTick);
super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound){
this.coalTime = compound.getInteger("CoalTime");
this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
this.nextRepairTick = compound.getInteger("NextRepairTick");
super.readFromNBT(compound);
}
@SideOnly(Side.CLIENT)
public int getCoalTimeToScale(int i){
return this.coalTimeLeft * i / this.coalTime;
}
@SideOnly(Side.CLIENT)
public int getItemDamageToScale(int i){
if(this.slots[SLOT_INPUT] != null){
return (this.slots[SLOT_INPUT].getMaxDamage()-this.slots[SLOT_INPUT].getItemDamage()) * i / this.slots[SLOT_INPUT].getMaxDamage();
}
return 0;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || i == SLOT_INPUT;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
}
@Override
public void setBlockMetadataToOn(){
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
}
@Override
public void setPower(int power){
this.coalTimeLeft = power;
}
@Override
public void setItemPower(int power){
this.coalTime = power;
}
@Override
public int getItemPower(){
return this.coalTime;
}
}

View file

@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
public class ModUtil{
public static final String VERSION = "1.7.10-0.0.3.2";
public static final String VERSION = "1.7.10-0.0.3.3";
public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions";

View file

@ -14,6 +14,7 @@ tile.actuallyadditions.blockFurnaceDouble.name=Double Furnace
tile.actuallyadditions.blockFishingNet.name=Fishing Net
tile.actuallyadditions.blockFurnaceSolar.name=Solar Panel
tile.actuallyadditions.blockHeatCollector.name=Heat Collector
tile.actuallyadditions.blockItemRepairer.name=Item Repairer
tile.actuallyadditions.blockInputter.name=ESD
tile.actuallyadditions.blockInputter.add.0.name=Ellpeck's Slot Device
@ -121,6 +122,7 @@ tooltip.actuallyadditions.blockFurnaceSolar.desc=Powers Furnaces and Crushers be
tooltip.actuallyadditions.blockHeatCollector.desc.1=Powers Furnaces and Crushers above it
tooltip.actuallyadditions.blockHeatCollector.desc.2=Needs a bunch of Lava around it
tooltip.actuallyadditions.blockHeatCollector.desc.3=Occasionally steals the Lava. Watch out!
tooltip.actuallyadditions.blockItemRepairer.desc=Repairs Tools and Armor automatically
tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer
tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost.

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -2,15 +2,15 @@
{
"modid": "ActuallyAdditions",
"name": "Actually Additions",
"description": "A bunch of random stuff added to your Game to make it even more fun, exciting and add some more variety!",
"version": "0.0.3.2",
"description": "Actually Additions is a mod that adds a lot of Random Things and Gadgets to your Minecraft, including better Furnaces, Crushers that double your Ores, Automation, a bunch of food and lots more!",
"version": "0.0.3.3",
"mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "",
"authorList": [
"Ellpeck"
],
"credits": "GlenthorLP for all of the awesome Graphics, xdqmhose for a bunch of Ideas",
"credits": "xdqmhose, GlenthorLP, Paktosan",
"logoFile": "assets/actuallyadditions/textures/logo.png",
"screenshots": [
],