From 5fb6d4bcdbdc7e3672cd85fa93e492092d649fe0 Mon Sep 17 00:00:00 2001 From: HenryLoenwind Date: Mon, 18 May 2015 22:29:50 +0200 Subject: [PATCH 01/33] Replace Conduits --- .../enderio/conduit/AbstractItemConduit.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/crazypants/enderio/conduit/AbstractItemConduit.java b/src/main/java/crazypants/enderio/conduit/AbstractItemConduit.java index 279f0e91..14c7b8b0 100644 --- a/src/main/java/crazypants/enderio/conduit/AbstractItemConduit.java +++ b/src/main/java/crazypants/enderio/conduit/AbstractItemConduit.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -103,6 +104,31 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem { } } return true; + } else { + // There's not really any good way to compare conduits... + IConduit existingConduit = bundle.getConduit(getBaseConduitType()); + ItemStack existingConduitAsItemStack = existingConduit.createItem(); + if (!crazypants.util.ItemUtil.areStacksEqual(existingConduitAsItemStack, stack)) { + if (!world.isRemote) { + IConduit newConduit = createConduit(stack, player); + if (newConduit == null) { + System.out.println("AbstractItemConduit.onItemUse: Conduit null."); + return false; + } + bundle.removeConduit(existingConduit); + bundle.addConduit(newConduit); + if (!player.capabilities.isCreativeMode) { + stack.stackSize--; + for (ItemStack drop : existingConduit.getDrops()) { + EntityItem entityitem = new EntityItem(world, x + hitX, y + hitY, z + hitZ, drop); + entityitem.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(entityitem); + } + } + } + return true; + } + } } } From 12c883c6fddafc67f0ea84da695518bdc6bad52c Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Fri, 29 May 2015 20:28:20 +0200 Subject: [PATCH 02/33] cleanup of powered spawner, don't show slots in capture mode --- .../crazypants/enderio/config/Config.java | 12 + .../spawner/ContainerPoweredSpawner.java | 11 +- .../machine/spawner/GuiPoweredSpawner.java | 59 ++-- .../machine/spawner/TilePoweredSpawner.java | 280 ++++++------------ 4 files changed, 156 insertions(+), 206 deletions(-) diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index 756b7754..78b94845 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -343,6 +343,10 @@ public final class Config { public static int poweredSpawnerLevelThreePowerPerTickRF = 1500; public static int poweredSpawnerMaxPlayerDistance = 0; public static int poweredSpawnerDespawnTimeSeconds = 120; + public static int poweredSpawnerSpawnCount = 4; + public static int poweredSpawnerSpawnRange = 4; + public static int poweredSpawnerMaxNearbyEntities = 6; + public static int poweredSpawnerMaxSpawnTries = 3; public static boolean poweredSpawnerUseVanillaSpawChecks = false; public static double brokenSpawnerDropChance = 1; public static String[] brokenSpawnerToolBlacklist = new String[] { @@ -1095,6 +1099,14 @@ public final class Config { "Max distance of the closest player for the spawner to be active. A zero value will remove the player check").getInt(poweredSpawnerMaxPlayerDistance); poweredSpawnerDespawnTimeSeconds = config.get(sectionSpawner.name, "poweredSpawnerDespawnTimeSeconds" , poweredSpawnerDespawnTimeSeconds, "Number of seconds in which spawned entities are protected from despawning").getInt(poweredSpawnerDespawnTimeSeconds); + poweredSpawnerSpawnCount = config.get(sectionSpawner.name, "poweredSpawnerSpawnCount" , poweredSpawnerSpawnCount, + "Number of entities to spawn each time").getInt(poweredSpawnerSpawnCount); + poweredSpawnerSpawnRange = config.get(sectionSpawner.name, "poweredSpawnerSpawnRange" , poweredSpawnerSpawnRange, + "Spawning range in X/Z").getInt(poweredSpawnerSpawnRange); + poweredSpawnerMaxNearbyEntities = config.get(sectionSpawner.name, "poweredSpawnerMaxNearbyEntities" , poweredSpawnerMaxNearbyEntities, + "Max number of entities in the nearby area until no more are spawned. A zero value will remove this check").getInt(poweredSpawnerMaxNearbyEntities); + poweredSpawnerMaxSpawnTries = config.get(sectionSpawner.name, "poweredSpawnerMaxSpawnTries" , poweredSpawnerMaxSpawnTries, + "Number of tries to find a suitable spawning location").getInt(poweredSpawnerMaxSpawnTries); poweredSpawnerUseVanillaSpawChecks = config.get(sectionSpawner.name, "poweredSpawnerUseVanillaSpawChecks", poweredSpawnerUseVanillaSpawChecks, "If true, regular spawn checks such as lighting level and dimension will be made before spawning mobs").getBoolean(poweredSpawnerUseVanillaSpawChecks); brokenSpawnerDropChance = (float) config.get(sectionSpawner.name, "brokenSpawnerDropChance", brokenSpawnerDropChance, diff --git a/src/main/java/crazypants/enderio/machine/spawner/ContainerPoweredSpawner.java b/src/main/java/crazypants/enderio/machine/spawner/ContainerPoweredSpawner.java index b6fe7de9..5b0f6b63 100644 --- a/src/main/java/crazypants/enderio/machine/spawner/ContainerPoweredSpawner.java +++ b/src/main/java/crazypants/enderio/machine/spawner/ContainerPoweredSpawner.java @@ -8,19 +8,22 @@ import crazypants.enderio.machine.gui.AbstractMachineContainer; public class ContainerPoweredSpawner extends AbstractMachineContainer { + private Slot slotInput; + private Slot slotOutput; + public ContainerPoweredSpawner(InventoryPlayer playerInv, AbstractMachineEntity te) { super(playerInv, te); } @Override protected void addMachineSlots(InventoryPlayer playerInv) { - addSlotToContainer(new Slot(tileEntity, 0, 54, 42) { + slotInput = addSlotToContainer(new Slot(tileEntity, 0, 54, 42) { @Override public boolean isItemValid(ItemStack itemStack) { return tileEntity.isItemValidForSlot(0, itemStack); } }); - addSlotToContainer(new Slot(tileEntity, 1, 105, 42) { + slotOutput = addSlotToContainer(new Slot(tileEntity, 1, 105, 42) { @Override public boolean isItemValid(ItemStack itemStack) { return false; @@ -28,5 +31,9 @@ public class ContainerPoweredSpawner extends AbstractMachineContainer { }); } + public void setSlotVisibility(boolean visible) { + slotInput.yDisplayPosition = visible ? 42 : -3000; + slotOutput.yDisplayPosition = visible ? 42 : -3000; + } } diff --git a/src/main/java/crazypants/enderio/machine/spawner/GuiPoweredSpawner.java b/src/main/java/crazypants/enderio/machine/spawner/GuiPoweredSpawner.java index 1db1cede..9f6d3e38 100644 --- a/src/main/java/crazypants/enderio/machine/spawner/GuiPoweredSpawner.java +++ b/src/main/java/crazypants/enderio/machine/spawner/GuiPoweredSpawner.java @@ -1,6 +1,7 @@ package crazypants.enderio.machine.spawner; import java.awt.Color; +import java.awt.Rectangle; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; @@ -18,12 +19,20 @@ import crazypants.util.Lang; public class GuiPoweredSpawner extends GuiPoweredMachineBase { private final MultiIconButtonEIO modeB; + private final Rectangle progressTooltipRect; + private boolean wasSpawnMode; + private String header; public GuiPoweredSpawner(InventoryPlayer par1InventoryPlayer, TilePoweredSpawner te) { super(te, new ContainerPoweredSpawner(par1InventoryPlayer, te)); modeB = MultiIconButtonEIO.createRightArrowButton(this, 8888, 115, 10); modeB.setSize(10, 16); + + addProgressTooltip(80, 34, 14, 14); + progressTooltipRect = progressTooltips.get(0).getBounds(); + + updateSpawnMode(te.isSpawnMode()); } @Override @@ -42,6 +51,25 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase } } + private void updateSpawnMode(boolean spawnMode) { + wasSpawnMode = spawnMode; + ((ContainerPoweredSpawner) inventorySlots).setSlotVisibility(!spawnMode); + + if(spawnMode) { + header = Lang.localize("gui.machine.poweredspawner.spawn"); + progressTooltipRect.x = 80; + progressTooltipRect.y = 34; + progressTooltipRect.width = 14; + progressTooltipRect.height = 14; + } else { + header = Lang.localize("gui.machine.poweredspawner.capture"); + progressTooltipRect.x = 52; + progressTooltipRect.y = 40; + progressTooltipRect.width = 72; + progressTooltipRect.height = 21; + } + } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -54,33 +82,30 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase super.drawGuiContainerBackgroundLayer(par1, par2, par3); TilePoweredSpawner spawner = getTileEntity(); - - int left = getGuiLeft(); - int top = getGuiTop(); + boolean spawnMode = spawner.isSpawnMode(); - String txt = Lang.localize("gui.machine.poweredspawner.spawn"); - if(!spawner.isSpawnMode()) { - txt = Lang.localize("gui.machine.poweredspawner.capture"); + if(spawnMode != wasSpawnMode) { + updateSpawnMode(spawnMode); } + FontRenderer fr = getFontRenderer(); - int x = left + xSize / 2 - fr.getStringWidth(txt) / 2; - int y = top + fr.FONT_HEIGHT + 6; - fr.drawStringWithShadow(txt, x, y, ColorUtil.getRGB(Color.WHITE)); + int x = sx + xSize / 2 - fr.getStringWidth(header) / 2; + int y = sy + fr.FONT_HEIGHT + 6; + fr.drawStringWithShadow(header, x, y, ColorUtil.getRGB(Color.WHITE)); RenderUtil.bindTexture("enderio:textures/gui/poweredSpawner.png"); - if(spawner.isSpawnMode()) { - int yOff = 34; - drawTexturedModalRect(left + 80, top + yOff, 207, 0, 17, 15); - if(spawner.getProgress() < 1 && spawner.getProgress() > 0) { + if(spawnMode) { + drawTexturedModalRect(sx + 80, sy + 34, 207, 0, 17, 15); + if(shouldRenderProgress()) { int scaled = getProgressScaled(14) + 1; - drawTexturedModalRect(left + 81, top + yOff + 14 - scaled, 176, 14 - scaled, 14, scaled); + drawTexturedModalRect(sx + 81, sy + 34 + 14 - scaled, 176, 14 - scaled, 14, scaled); } } else { - drawTexturedModalRect(left + 52, top + 40, 52, 170, 72, 21); - if(spawner.getProgress() < 1 && spawner.getProgress() > 0) { + drawTexturedModalRect(sx + 52, sy + 40, 52, 170, 72, 21); + if(shouldRenderProgress()) { int scaled = getProgressScaled(24); - drawTexturedModalRect(left + 76, top + 43, 176, 14, scaled + 1, 16); + drawTexturedModalRect(sx + 76, sy + 43, 176, 14, scaled + 1, 16); } } diff --git a/src/main/java/crazypants/enderio/machine/spawner/TilePoweredSpawner.java b/src/main/java/crazypants/enderio/machine/spawner/TilePoweredSpawner.java index 54b18f22..ece33b17 100644 --- a/src/main/java/crazypants/enderio/machine/spawner/TilePoweredSpawner.java +++ b/src/main/java/crazypants/enderio/machine/spawner/TilePoweredSpawner.java @@ -6,9 +6,7 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.MobSpawnerBaseLogic; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.config.Config; @@ -40,15 +38,16 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { public static final int MIN_PLAYER_DISTANCE = Config.poweredSpawnerMaxPlayerDistance; public static final boolean USE_VANILLA_SPAWN_CHECKS = Config.poweredSpawnerUseVanillaSpawChecks; - private final SpawnerLogic logic = new SpawnerLogic(); - private static final String NULL_ENTITY_NAME = "None"; + private String entityTypeName; private boolean isSpawnMode = true; + private int powerUsePerTick; + private int remainingSpawnTries; public TilePoweredSpawner() { super(new SlotDefinition(1, 1, 1)); - logic.setEntityName(NULL_ENTITY_NAME); + entityTypeName = NULL_ENTITY_NAME; } public boolean isSpawnMode() { @@ -66,16 +65,17 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { protected void taskComplete() { super.taskComplete(); if(isSpawnMode) { - logic.spawnDelay = 0; + remainingSpawnTries = Config.poweredSpawnerSpawnCount + Config.poweredSpawnerMaxSpawnTries; + for (int i = 0; i < Config.poweredSpawnerSpawnCount && remainingSpawnTries > 0; ++i) { + if(!trySpawnEntity()) { + break; + } + } } else { - if(getStackInSlot(0) == null || getStackInSlot(1) != null) { + if(getStackInSlot(0) == null || getStackInSlot(1) != null || !hasEntityName()) { return; } - String name = logic.getEntityNameToSpawn(); - if(NULL_ENTITY_NAME.equals(name)) { - return; - } - ItemStack res = EnderIO.itemSoulVessel.createVesselWithEntityStub(logic.getEntityNameToSpawn()); + ItemStack res = EnderIO.itemSoulVessel.createVesselWithEntityStub(getEntityName()); decrStackSize(0, 1); setInventorySlotContents(1, res); } @@ -83,20 +83,26 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { @Override public void onCapacitorTypeChange() { - ICapacitor refCap = null; + ICapacitor refCap; + int basePowerUse; switch (getCapacitorType()) { + default: case BASIC_CAPACITOR: refCap = CAP_ONE; + basePowerUse = POWER_PER_TICK_ONE; break; case ACTIVATED_CAPACITOR: refCap = CAP_TWO; + basePowerUse = POWER_PER_TICK_TWO; break; case ENDER_CAPACITOR: refCap = CAP_THREE; + basePowerUse = POWER_PER_TICK_THREE; break; } - double multuplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(logic.getEntityNameToSpawn()); - setCapacitor(new BasicCapacitor((int) (refCap.getMaxEnergyExtracted() * multuplier), refCap.getMaxEnergyStored())); + double multiplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(getEntityName()); + setCapacitor(new BasicCapacitor((int) (refCap.getMaxEnergyExtracted() * multiplier), refCap.getMaxEnergyStored())); + powerUsePerTick = (int) Math.ceil(basePowerUse * multiplier); forceClientUpdate = true; } @@ -118,9 +124,14 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { @Override protected IMachineRecipe canStartNextTask(float chance) { + if(!hasEntityName()) { + return null; + } if(isSpawnMode) { - if(logic.getEntityNameToSpawn() == null || logic.getEntityNameToSpawn().equals(NULL_ENTITY_NAME)) { - return null; + if(MIN_PLAYER_DISTANCE > 0) { + if(worldObj.getClosestPlayer(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, MIN_PLAYER_DISTANCE) == null) { + return null; + } } } else { if(getStackInSlot(0) == null || getStackInSlot(1) != null) { @@ -137,13 +148,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { @Override public int getPowerUsePerTick() { - double multuplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(logic.getEntityNameToSpawn()); - if(getCapacitorType().ordinal() == 0) { - return (int) Math.round(POWER_PER_TICK_ONE * multuplier); - } else if(getCapacitorType().ordinal() == 1) { - return (int) Math.round(POWER_PER_TICK_TWO * multuplier); - } - return (int) Math.round(POWER_PER_TICK_THREE * multuplier); + return powerUsePerTick; } @Override @@ -156,29 +161,14 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { return true; } - @Override - public void readCustomNBT(NBTTagCompound nbtRoot) { - logic.readFromNBT(nbtRoot); - super.readCustomNBT(nbtRoot); - - } - - @Override - public void writeCustomNBT(NBTTagCompound nbtRoot) { - logic.writeToNBT(nbtRoot); - super.writeCustomNBT(nbtRoot); - - } - @Override public void readCommon(NBTTagCompound nbtRoot) { - //Must read the mob type first so we no the multiplier to be used when calculating input/output power + //Must read the mob type first so we know the multiplier to be used when calculating input/output power String mobType = BlockPoweredSpawner.readMobTypeFromNBT(nbtRoot); if(mobType == null) { mobType = NULL_ENTITY_NAME; } - logic.setEntityName(mobType); - logic.resetTimer(); + entityTypeName = mobType; if(!nbtRoot.hasKey("isSpawnMode")) { isSpawnMode = true; } else { @@ -189,29 +179,25 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { @Override public void writeCommon(NBTTagCompound nbtRoot) { - String mobType = logic.getEntityNameToSpawn(); - if(mobType == null || mobType.equals(NULL_ENTITY_NAME)) { - BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, null); + if(hasEntityName()) { + BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, getEntityName()); } else { - BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, mobType); + BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, null); } nbtRoot.setBoolean("isSpawnMode", isSpawnMode); super.writeCommon(nbtRoot); } @Override - public void doUpdate() { - logic.updateSpawner(); - super.doUpdate(); - } - - /** - * Called when a client event is received with the event number and argument, - * see World.sendClientEvent - */ - @Override - public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { - return logic.setDelayToMin(p_145842_1_) ? true : super.receiveClientEvent(p_145842_1_, p_145842_2_); + protected void updateEntityClient() { + if(isActive()) { + double x = xCoord + worldObj.rand.nextFloat(); + double y = yCoord + worldObj.rand.nextFloat(); + double z = zCoord + worldObj.rand.nextFloat(); + worldObj.spawnParticle("smoke", x, y, z, 0.0D, 0.0D, 0.0D); + worldObj.spawnParticle("flame", x, y, z, 0.0D, 0.0D, 0.0D); + } + super.updateEntityClient(); } @Override @@ -246,138 +232,58 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity { return spaceClear; } + Entity createEntity(boolean forceAlive) { + Entity ent = EntityList.createEntityByName(getEntityName(), worldObj); + if(forceAlive && MIN_PLAYER_DISTANCE <= 0 && Config.poweredSpawnerDespawnTimeSeconds > 0 && ent instanceof EntityLiving) { + ent.getEntityData().setLong(BlockPoweredSpawner.KEY_SPAWNED_BY_POWERED_SPAWNER, worldObj.getTotalWorldTime()); + ((EntityLiving) ent).func_110163_bv(); + } + return ent; + } + + protected boolean trySpawnEntity() { + Entity entity = createEntity(true); + if(!(entity instanceof EntityLiving)) { + return false; + } + EntityLiving entityliving = (EntityLiving) entity; + int spawnRange = Config.poweredSpawnerSpawnRange; + + if(Config.poweredSpawnerMaxNearbyEntities > 0) { + int nearbyEntities = worldObj.getEntitiesWithinAABB( + entity.getClass(), + AxisAlignedBB.getBoundingBox( + xCoord - spawnRange*2, yCoord - 4, zCoord - spawnRange*2, + xCoord + spawnRange*2, yCoord + 4, zCoord + spawnRange*2)).size(); + + if(nearbyEntities >= Config.poweredSpawnerMaxNearbyEntities) { + return false; + } + } + + while(remainingSpawnTries-- > 0) { + double x = xCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * spawnRange; + double y = yCoord + worldObj.rand.nextInt(3) - 1; + double z = zCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * spawnRange; + entity.setLocationAndAngles(x, y, z, worldObj.rand.nextFloat() * 360.0F, 0.0F); + + if(canSpawnEntity(entityliving)) { + entityliving.onSpawnWithEgg(null); + worldObj.spawnEntityInWorld(entityliving); + worldObj.playAuxSFX(2004, xCoord, yCoord, zCoord, 0); + entityliving.spawnExplosionParticle(); + return true; + } + } + + return false; + } + public String getEntityName() { - return logic.getEntityNameToSpawn(); + return entityTypeName; } - class SpawnerLogic extends MobSpawnerBaseLogic { - - private int spawnCount = 4; - private int maxNearbyEntities = 6; - private int spawnRange = 4; - - @Override - public void func_98267_a(int par1) { - worldObj.addBlockEvent(xCoord, yCoord, zCoord, EnderIO.blockPoweredSpawner, par1, 0); - } - - @Override - public World getSpawnerWorld() { - return worldObj; - } - - @Override - public int getSpawnerX() { - return xCoord; - } - - @Override - public int getSpawnerY() { - return yCoord; - } - - @Override - public int getSpawnerZ() { - return zCoord; - } - - @Override - public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart par1WeightedRandomMinecart) { - super.setRandomEntity(par1WeightedRandomMinecart); - if(getSpawnerWorld() != null) { - getSpawnerWorld().markBlockForUpdate(xCoord, yCoord, zCoord); - } - } - - /** - * Returns true if there's a player close enough to this mob spawner to - * activate it. - */ - @Override - public boolean isActivated() { - if(MIN_PLAYER_DISTANCE > 0) { - //TODO: Add this to main 'hasPower' like check so turn of the machine if the player is out of range? - boolean playerInRange = worldObj.getClosestPlayer(getSpawnerX() + 0.5D, getSpawnerY() + 0.5D, getSpawnerZ() + 0.5D, - MIN_PLAYER_DISTANCE) != null; - if(!playerInRange) { - return false; - } - } - return isActive(); - } - - @Override - public void updateSpawner() { - - if(isActivated()) { - double d2; - - if(getSpawnerWorld().isRemote) { - double d0 = getSpawnerX() + getSpawnerWorld().rand.nextFloat(); - double d1 = getSpawnerY() + getSpawnerWorld().rand.nextFloat(); - d2 = getSpawnerZ() + getSpawnerWorld().rand.nextFloat(); - getSpawnerWorld().spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); - getSpawnerWorld().spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); - - field_98284_d = field_98287_c; - field_98287_c = (field_98287_c + 1000.0F / (spawnDelay + 200.0F)) % 360.0D; - } else { - - if(spawnDelay > 0) { - return; - } - resetTimer(); - - for (int i = 0; i < spawnCount; ++i) { - - Entity entity = createEntity(true); - if(entity == null) { - return; - } - - int j = getSpawnerWorld().getEntitiesWithinAABB( - entity.getClass(), - AxisAlignedBB.getBoundingBox(getSpawnerX(), getSpawnerY(), getSpawnerZ(), getSpawnerX() + 1, - getSpawnerY() + 1, getSpawnerZ() + 1).expand(spawnRange * 2, 4.0D, spawnRange * 2)).size(); - - if(j >= maxNearbyEntities) { - resetTimer(); - return; - } - - d2 = getSpawnerX() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange; - double d3 = getSpawnerY() + getSpawnerWorld().rand.nextInt(3) - 1; - double d4 = getSpawnerZ() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange; - EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null; - entity.setLocationAndAngles(d2, d3, d4, getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); - - if(entityliving != null && canSpawnEntity(entityliving)) { - func_98265_a(entity); - getSpawnerWorld().playAuxSFX(2004, getSpawnerX(), getSpawnerY(), getSpawnerZ(), 0); - - if(entityliving != null) - { - entityliving.spawnExplosionParticle(); - } - } - } - } - } - } - - Entity createEntity(boolean forceAlive) { - Entity ent = EntityList.createEntityByName(getEntityNameToSpawn(), getSpawnerWorld()); - if(forceAlive && MIN_PLAYER_DISTANCE <= 0 && Config.poweredSpawnerDespawnTimeSeconds > 0 && ent instanceof EntityLiving) { - ent.getEntityData().setLong(BlockPoweredSpawner.KEY_SPAWNED_BY_POWERED_SPAWNER, getSpawnerWorld().getTotalWorldTime()); - ((EntityLiving) ent).func_110163_bv(); - } - return ent; - } - - void resetTimer() { - spawnDelay = Integer.MAX_VALUE; - } - + public boolean hasEntityName() { + return !NULL_ENTITY_NAME.equals(entityTypeName); } - } From 84343561ae96f3a383f7671b630b2c2b4ef8a959 Mon Sep 17 00:00:00 2001 From: tgstyle Date: Thu, 21 May 2015 12:11:49 -0600 Subject: [PATCH 03/33] Fixed spelling, some grammer, and a lot of formatting Formating, spelling changes to be consistent with the SAGMill xml Formatting, spelling, and grammar to be consistent with other updated xml Formatting, spelling, and grammar to be consistent with other xml Update CrusherRecipeManager.java Spelling, Formatting, grammar, and ignore nuggets on bonus --- .../config/AlloySmelterRecipes_Core.xml | 179 ++--- .../config/AlloySmelterRecipes_User.xml | 20 +- .../enderio/config/SAGMillRecipes_Core.xml | 625 ++++++------------ .../enderio/config/SAGMillRecipes_User.xml | 124 ++-- .../machine/crusher/CrusherRecipeManager.java | 2 +- 5 files changed, 346 insertions(+), 604 deletions(-) diff --git a/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml b/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml index 08d6164f..f3f6a97d 100644 --- a/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml +++ b/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml @@ -1,73 +1,60 @@ - - @@ -78,7 +65,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -89,7 +75,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -99,7 +84,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -109,7 +93,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -119,7 +102,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -129,7 +111,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -140,7 +121,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -150,7 +130,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -159,7 +138,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -169,7 +147,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -180,7 +157,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -189,7 +165,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -199,7 +174,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -210,8 +184,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - @@ -221,7 +193,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -231,7 +202,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -241,7 +211,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -251,7 +220,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -260,7 +228,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -270,7 +237,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -280,7 +246,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -290,7 +255,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -300,8 +264,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - @@ -311,7 +273,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -321,7 +282,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -331,8 +291,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - @@ -342,7 +300,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -352,12 +309,9 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - - @@ -367,7 +321,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -377,7 +330,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -387,18 +339,15 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - + - - @@ -409,30 +358,26 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - - + - - - + + - @@ -443,7 +388,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -454,7 +398,6 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - @@ -465,8 +408,14 @@ To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt - - - - - - - - +--> diff --git a/resources/assets/enderio/config/AlloySmelterRecipes_User.xml b/resources/assets/enderio/config/AlloySmelterRecipes_User.xml index 4cafc4cd..9cbc1fd5 100644 --- a/resources/assets/enderio/config/AlloySmelterRecipes_User.xml +++ b/resources/assets/enderio/config/AlloySmelterRecipes_User.xml @@ -1,19 +1,18 @@ diff --git a/resources/assets/enderio/config/SAGMillRecipes_Core.xml b/resources/assets/enderio/config/SAGMillRecipes_Core.xml index f466da70..c3b61584 100644 --- a/resources/assets/enderio/config/SAGMillRecipes_Core.xml +++ b/resources/assets/enderio/config/SAGMillRecipes_Core.xml @@ -1,64 +1,59 @@ - - @@ -153,7 +142,6 @@ addOreDictionaryTooltips=true - @@ -162,120 +150,107 @@ addOreDictionaryTooltips=true - - + - - - - - + + + + - - + - + - - - - + + + - - + - - - + + - - + - - + - - - + - - + - - + - @@ -284,7 +259,6 @@ addOreDictionaryTooltips=true - @@ -294,7 +268,6 @@ addOreDictionaryTooltips=true - @@ -302,11 +275,9 @@ addOreDictionaryTooltips=true - + - - @@ -315,7 +286,6 @@ addOreDictionaryTooltips=true - @@ -326,7 +296,6 @@ addOreDictionaryTooltips=true - @@ -335,7 +304,6 @@ addOreDictionaryTooltips=true - @@ -345,7 +313,6 @@ addOreDictionaryTooltips=true - @@ -355,7 +322,6 @@ addOreDictionaryTooltips=true - @@ -365,7 +331,6 @@ addOreDictionaryTooltips=true - @@ -376,7 +341,6 @@ addOreDictionaryTooltips=true - @@ -386,7 +350,6 @@ addOreDictionaryTooltips=true - @@ -396,7 +359,6 @@ addOreDictionaryTooltips=true - @@ -408,7 +370,6 @@ addOreDictionaryTooltips=true - @@ -418,7 +379,6 @@ addOreDictionaryTooltips=true - @@ -428,7 +388,6 @@ addOreDictionaryTooltips=true - @@ -439,7 +398,6 @@ addOreDictionaryTooltips=true - @@ -449,7 +407,6 @@ addOreDictionaryTooltips=true - @@ -459,8 +416,6 @@ addOreDictionaryTooltips=true - - @@ -470,7 +425,6 @@ addOreDictionaryTooltips=true - @@ -480,50 +434,44 @@ addOreDictionaryTooltips=true - - - - + + - - + - - + - - + - @@ -534,7 +482,6 @@ addOreDictionaryTooltips=true - @@ -543,7 +490,6 @@ addOreDictionaryTooltips=true - @@ -553,7 +499,6 @@ addOreDictionaryTooltips=true - @@ -562,7 +507,6 @@ addOreDictionaryTooltips=true - @@ -571,7 +515,6 @@ addOreDictionaryTooltips=true - @@ -580,7 +523,6 @@ addOreDictionaryTooltips=true - @@ -590,7 +532,6 @@ addOreDictionaryTooltips=true - @@ -599,7 +540,6 @@ addOreDictionaryTooltips=true - @@ -608,7 +548,6 @@ addOreDictionaryTooltips=true - @@ -617,7 +556,6 @@ addOreDictionaryTooltips=true - @@ -626,7 +564,6 @@ addOreDictionaryTooltips=true - @@ -635,7 +572,6 @@ addOreDictionaryTooltips=true - @@ -644,11 +580,9 @@ addOreDictionaryTooltips=true - - @@ -657,11 +591,9 @@ addOreDictionaryTooltips=true - - @@ -673,7 +605,6 @@ addOreDictionaryTooltips=true - @@ -682,7 +613,6 @@ addOreDictionaryTooltips=true - @@ -691,7 +621,6 @@ addOreDictionaryTooltips=true - @@ -700,7 +629,6 @@ addOreDictionaryTooltips=true - @@ -709,7 +637,6 @@ addOreDictionaryTooltips=true - @@ -718,12 +645,9 @@ addOreDictionaryTooltips=true - - - @@ -733,7 +657,6 @@ addOreDictionaryTooltips=true - @@ -743,7 +666,6 @@ addOreDictionaryTooltips=true - @@ -752,7 +674,6 @@ addOreDictionaryTooltips=true - @@ -761,7 +682,6 @@ addOreDictionaryTooltips=true - @@ -770,7 +690,6 @@ addOreDictionaryTooltips=true - @@ -782,7 +701,6 @@ addOreDictionaryTooltips=true - @@ -791,7 +709,6 @@ addOreDictionaryTooltips=true - @@ -801,11 +718,9 @@ addOreDictionaryTooltips=true - - - + @@ -814,7 +729,6 @@ addOreDictionaryTooltips=true - @@ -823,7 +737,6 @@ addOreDictionaryTooltips=true - @@ -832,7 +745,6 @@ addOreDictionaryTooltips=true - @@ -841,7 +753,6 @@ addOreDictionaryTooltips=true - @@ -850,7 +761,6 @@ addOreDictionaryTooltips=true - @@ -859,7 +769,6 @@ addOreDictionaryTooltips=true - @@ -868,7 +777,6 @@ addOreDictionaryTooltips=true - @@ -877,7 +785,6 @@ addOreDictionaryTooltips=true - @@ -886,7 +793,6 @@ addOreDictionaryTooltips=true - @@ -895,7 +801,6 @@ addOreDictionaryTooltips=true - @@ -904,7 +809,6 @@ addOreDictionaryTooltips=true - @@ -913,7 +817,6 @@ addOreDictionaryTooltips=true - @@ -922,7 +825,6 @@ addOreDictionaryTooltips=true - @@ -931,7 +833,6 @@ addOreDictionaryTooltips=true - @@ -940,7 +841,6 @@ addOreDictionaryTooltips=true - @@ -949,7 +849,6 @@ addOreDictionaryTooltips=true - @@ -958,12 +857,9 @@ addOreDictionaryTooltips=true - - - @@ -972,7 +868,6 @@ addOreDictionaryTooltips=true - @@ -981,7 +876,6 @@ addOreDictionaryTooltips=true - @@ -990,99 +884,89 @@ addOreDictionaryTooltips=true - - + - - + - - + - - + - - + - - + - - + - - + - - - + @@ -1092,7 +976,6 @@ addOreDictionaryTooltips=true - @@ -1102,7 +985,6 @@ addOreDictionaryTooltips=true - @@ -1112,7 +994,6 @@ addOreDictionaryTooltips=true - @@ -1122,7 +1003,6 @@ addOreDictionaryTooltips=true - @@ -1132,7 +1012,6 @@ addOreDictionaryTooltips=true - @@ -1142,7 +1021,6 @@ addOreDictionaryTooltips=true - @@ -1152,7 +1030,6 @@ addOreDictionaryTooltips=true - @@ -1162,7 +1039,6 @@ addOreDictionaryTooltips=true - @@ -1172,7 +1048,6 @@ addOreDictionaryTooltips=true - @@ -1182,7 +1057,6 @@ addOreDictionaryTooltips=true - @@ -1192,7 +1066,6 @@ addOreDictionaryTooltips=true - @@ -1202,7 +1075,6 @@ addOreDictionaryTooltips=true - @@ -1212,7 +1084,6 @@ addOreDictionaryTooltips=true - @@ -1222,7 +1093,6 @@ addOreDictionaryTooltips=true - @@ -1232,7 +1102,6 @@ addOreDictionaryTooltips=true - @@ -1242,7 +1111,6 @@ addOreDictionaryTooltips=true - @@ -1252,7 +1120,6 @@ addOreDictionaryTooltips=true - @@ -1262,7 +1129,6 @@ addOreDictionaryTooltips=true - @@ -1272,7 +1138,6 @@ addOreDictionaryTooltips=true - @@ -1282,7 +1147,6 @@ addOreDictionaryTooltips=true - @@ -1292,11 +1156,9 @@ addOreDictionaryTooltips=true - - + - @@ -1490,7 +1352,6 @@ addOreDictionaryTooltips=true - @@ -1804,7 +1665,6 @@ addOreDictionaryTooltips=true - @@ -2118,11 +1978,9 @@ addOreDictionaryTooltips=true - - @@ -2133,7 +1991,6 @@ addOreDictionaryTooltips=true - @@ -2143,8 +2000,6 @@ addOreDictionaryTooltips=true - - @@ -2154,11 +2009,9 @@ addOreDictionaryTooltips=true - - @@ -2169,7 +2022,6 @@ addOreDictionaryTooltips=true - @@ -2179,7 +2031,6 @@ addOreDictionaryTooltips=true - @@ -2188,7 +2039,6 @@ addOreDictionaryTooltips=true - @@ -2197,7 +2047,6 @@ addOreDictionaryTooltips=true - @@ -2206,11 +2055,9 @@ addOreDictionaryTooltips=true - - - + @@ -2220,7 +2067,6 @@ addOreDictionaryTooltips=true - @@ -2229,7 +2075,6 @@ addOreDictionaryTooltips=true - @@ -2239,7 +2084,6 @@ addOreDictionaryTooltips=true - @@ -2248,7 +2092,6 @@ addOreDictionaryTooltips=true - @@ -2257,7 +2100,6 @@ addOreDictionaryTooltips=true - @@ -2266,7 +2108,6 @@ addOreDictionaryTooltips=true - @@ -2278,7 +2119,6 @@ addOreDictionaryTooltips=true - @@ -2287,7 +2127,6 @@ addOreDictionaryTooltips=true - @@ -2296,7 +2135,6 @@ addOreDictionaryTooltips=true - @@ -2305,7 +2143,6 @@ addOreDictionaryTooltips=true - @@ -2314,7 +2151,6 @@ addOreDictionaryTooltips=true - @@ -2323,7 +2159,6 @@ addOreDictionaryTooltips=true - @@ -2332,7 +2167,6 @@ addOreDictionaryTooltips=true - @@ -2341,7 +2175,6 @@ addOreDictionaryTooltips=true - @@ -2350,7 +2183,6 @@ addOreDictionaryTooltips=true - @@ -2359,7 +2191,6 @@ addOreDictionaryTooltips=true - @@ -2368,7 +2199,6 @@ addOreDictionaryTooltips=true - @@ -2377,7 +2207,6 @@ addOreDictionaryTooltips=true - @@ -2386,7 +2215,6 @@ addOreDictionaryTooltips=true - @@ -2395,7 +2223,6 @@ addOreDictionaryTooltips=true - @@ -2404,7 +2231,6 @@ addOreDictionaryTooltips=true - @@ -2413,7 +2239,6 @@ addOreDictionaryTooltips=true - @@ -2422,7 +2247,6 @@ addOreDictionaryTooltips=true - @@ -2431,7 +2255,6 @@ addOreDictionaryTooltips=true - @@ -2440,7 +2263,6 @@ addOreDictionaryTooltips=true - @@ -2449,7 +2271,6 @@ addOreDictionaryTooltips=true - @@ -2458,7 +2279,6 @@ addOreDictionaryTooltips=true - @@ -2467,7 +2287,6 @@ addOreDictionaryTooltips=true - @@ -2476,7 +2295,6 @@ addOreDictionaryTooltips=true - @@ -2485,7 +2303,6 @@ addOreDictionaryTooltips=true - @@ -2494,7 +2311,6 @@ addOreDictionaryTooltips=true - @@ -2503,7 +2319,6 @@ addOreDictionaryTooltips=true - @@ -2512,7 +2327,6 @@ addOreDictionaryTooltips=true - @@ -2521,7 +2335,6 @@ addOreDictionaryTooltips=true - @@ -2530,7 +2343,6 @@ addOreDictionaryTooltips=true - @@ -2539,7 +2351,6 @@ addOreDictionaryTooltips=true - @@ -2548,7 +2359,6 @@ addOreDictionaryTooltips=true - @@ -2561,240 +2371,239 @@ addOreDictionaryTooltips=true - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - @@ -2807,12 +2616,10 @@ addOreDictionaryTooltips=true - + - + @@ -2822,12 +2629,10 @@ addOreDictionaryTooltips=true - - diff --git a/resources/assets/enderio/config/SAGMillRecipes_User.xml b/resources/assets/enderio/config/SAGMillRecipes_User.xml index fe870d9f..2e0ca2c3 100644 --- a/resources/assets/enderio/config/SAGMillRecipes_User.xml +++ b/resources/assets/enderio/config/SAGMillRecipes_User.xml @@ -1,107 +1,101 @@ + Disable all recipes in the group 'Vanilla': - + - + To disable individual recipes, simply provide an invalid recipe for them: + + + + + + Disable the glass recipes in the group 'Vanilla': + + + + + + Modifying Recipes: + Modify a core recipe definition, in this case, make glass give diamonds: + + + + + + + + + + + + + Add this block to change the default TE obsidian -> dust recipe to the railcraft recipe. - + Grinding Balls: + Adding a new grinding ball: - - - - - - - - - - +--> + + diff --git a/src/main/java/crazypants/enderio/machine/crusher/CrusherRecipeManager.java b/src/main/java/crazypants/enderio/machine/crusher/CrusherRecipeManager.java index 72e8b2be..787b291e 100644 --- a/src/main/java/crazypants/enderio/machine/crusher/CrusherRecipeManager.java +++ b/src/main/java/crazypants/enderio/machine/crusher/CrusherRecipeManager.java @@ -64,7 +64,7 @@ public class CrusherRecipeManager { int id = OreDictionary.getOreID(input.item); if(id >= 0) { String name = OreDictionary.getOreName(id); - if(name.startsWith("ingot") || name.startsWith("block")) { + if(name.startsWith("ingot") || name.startsWith("block") || name.startsWith("nugget")) { addExcludedStack(input.item); return true; } From 731bd624d3ccacc7534300b8a906ff6aad87b38a Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Tue, 2 Jun 2015 21:21:53 -0400 Subject: [PATCH 04/33] Add Farming Station support for B0bGary's Growable Ores Closes #2412 --- .../enderio/machine/farm/FarmersRegistry.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java b/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java index b3dcd95a..b47672e7 100644 --- a/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java +++ b/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java @@ -1,5 +1,8 @@ package crazypants.enderio.machine.farm; +import java.util.Iterator; +import java.util.regex.Pattern; + import crazypants.enderio.config.Config; import crazypants.enderio.machine.farm.farmers.*; import net.minecraft.block.Block; @@ -23,6 +26,7 @@ public final class FarmersRegistry { addMFR(); addThaumcraft(); addFlowers(); + addGrowableOres(); FarmersCommune.joinCommune(new StemFarmer(Blocks.reeds, new ItemStack(Items.reeds))); FarmersCommune.joinCommune(new StemFarmer(Blocks.cactus, new ItemStack(Blocks.cactus))); @@ -201,6 +205,25 @@ public final class FarmersRegistry { GameRegistry.findBlock("Botany", "flower"), GameRegistry.findBlock("Botania", "flower") ) ); } + + @SuppressWarnings("unchecked") + private static void addGrowableOres() { + String mod = "B0bGrowsOre"; + String[] growableOres = { "(.+)Reed", "oreGrowable(.+)" }; + + Iterator blockIter = Block.blockRegistry.iterator(); + while (blockIter.hasNext()) { + Block block = blockIter.next(); + String name = Block.blockRegistry.getNameForObject(block); + if (name.startsWith(mod)) { + for (String blockName : growableOres) { + if (Pattern.compile(blockName).matcher(name).find()) { + FarmersCommune.joinCommune(new StemFarmer(block, new ItemStack(block))); + } + } + } + } + } private FarmersRegistry() { } From 1f862e7d1a855cd271db1ac4db19abecc97a661e Mon Sep 17 00:00:00 2001 From: tgstyle Date: Wed, 3 Jun 2015 15:50:32 -0600 Subject: [PATCH 05/33] A bit more cleanup, formatting, and consistency in XMLs. Finishing up all files and fixed a few missed items in others. Missed a couple items Squash commits. --- .../config/AlloySmelterRecipes_Core.xml | 105 +-- .../config/AlloySmelterRecipes_User.xml | 7 +- .../enderio/config/EnchanterRecipes_Core.xml | 224 +++--- .../enderio/config/EnchanterRecipes_User.xml | 28 +- .../config/OreDictionaryPreferences_Core.xml | 98 ++- .../config/OreDictionaryPreferences_User.xml | 6 +- .../config/PainterPaintSources_Core.xml | 42 +- .../config/PainterPaintSources_User.xml | 7 +- .../config/PoweredSpawnerConfig_Core.json | 32 +- .../config/PoweredSpawnerConfig_User.json | 2 +- .../enderio/config/SAGMillRecipes_Core.xml | 653 +++++++++--------- .../enderio/config/SAGMillRecipes_User.xml | 20 +- .../config/SliceAndSpliceRecipes_Core.xml | 83 ++- .../assets/enderio/config/VatRecipes_Core.xml | 173 +++-- .../assets/enderio/config/VatRecipes_User.xml | 2 +- 15 files changed, 713 insertions(+), 769 deletions(-) diff --git a/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml b/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml index f3f6a97d..cf30500a 100644 --- a/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml +++ b/resources/assets/enderio/config/AlloySmelterRecipes_Core.xml @@ -1,14 +1,14 @@ - - + + @@ -65,7 +72,7 @@ - + @@ -75,7 +82,7 @@ - + @@ -84,7 +91,7 @@ - + @@ -93,7 +100,7 @@ - + @@ -102,7 +109,7 @@ - + @@ -111,7 +118,7 @@ - + @@ -121,7 +128,7 @@ - + @@ -130,7 +137,7 @@ - + @@ -138,7 +145,7 @@ - + @@ -147,7 +154,7 @@ - + @@ -157,7 +164,7 @@ - + @@ -165,7 +172,7 @@ - + @@ -174,7 +181,7 @@ - + @@ -184,7 +191,7 @@ - + @@ -193,7 +200,7 @@ - + @@ -202,7 +209,7 @@ - + @@ -211,7 +218,7 @@ - + @@ -220,7 +227,7 @@ - + @@ -228,7 +235,7 @@ - + @@ -237,7 +244,7 @@ - + @@ -246,7 +253,7 @@ - + @@ -255,7 +262,7 @@ - + @@ -264,7 +271,7 @@ - + @@ -273,7 +280,7 @@ - + @@ -282,7 +289,7 @@ - + @@ -291,7 +298,7 @@ - + @@ -300,7 +307,7 @@ - + @@ -311,8 +318,8 @@ - - + + @@ -321,7 +328,7 @@ - + @@ -330,7 +337,7 @@ - + @@ -339,7 +346,7 @@ - + @@ -348,7 +355,7 @@ - + @@ -358,7 +365,7 @@ - + @@ -368,7 +375,7 @@ - + @@ -378,7 +385,7 @@ - + @@ -388,7 +395,7 @@ - + @@ -398,7 +405,7 @@ - + @@ -416,7 +423,7 @@ +--> \ No newline at end of file diff --git a/resources/assets/enderio/config/AlloySmelterRecipes_User.xml b/resources/assets/enderio/config/AlloySmelterRecipes_User.xml index 9cbc1fd5..02fb561d 100644 --- a/resources/assets/enderio/config/AlloySmelterRecipes_User.xml +++ b/resources/assets/enderio/config/AlloySmelterRecipes_User.xml @@ -5,7 +5,7 @@ As well as adding custom recipes to the operation of the Alloy Smelter, a vanilla furnace recipe can be controlled. It can be disabled completely by simply adding this line: - + It is also possible to selectively disable vanilla furnace recipes. The following example disables the smelting of iron ingots, ender pearls, and any form of iron ore registered in the ore dictionary. @@ -22,9 +22,10 @@ Add this line to disable the creation of TE alloys using the Alloy Smelter. - + + --> - + \ No newline at end of file diff --git a/resources/assets/enderio/config/EnchanterRecipes_Core.xml b/resources/assets/enderio/config/EnchanterRecipes_Core.xml index a2d06626..a277ee5e 100644 --- a/resources/assets/enderio/config/EnchanterRecipes_Core.xml +++ b/resources/assets/enderio/config/EnchanterRecipes_Core.xml @@ -1,137 +1,109 @@ + + level = enchantmentItem.stackSize + levelCost = Config.enchanterBaseLevelCost; + for (int i = 0; i < level; i++) { + levelCost += costPerLevel * level; + } + +--> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + + + - - - - - + \ No newline at end of file diff --git a/resources/assets/enderio/config/EnchanterRecipes_User.xml b/resources/assets/enderio/config/EnchanterRecipes_User.xml index 152f3f8e..d6a9a39a 100644 --- a/resources/assets/enderio/config/EnchanterRecipes_User.xml +++ b/resources/assets/enderio/config/EnchanterRecipes_User.xml @@ -1,27 +1,27 @@ - - + +--> + + \ No newline at end of file diff --git a/resources/assets/enderio/config/OreDictionaryPreferences_Core.xml b/resources/assets/enderio/config/OreDictionaryPreferences_Core.xml index dac71171..64cf0b37 100644 --- a/resources/assets/enderio/config/OreDictionaryPreferences_Core.xml +++ b/resources/assets/enderio/config/OreDictionaryPreferences_Core.xml @@ -1,120 +1,100 @@ + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - - + - - + - - + - - + - - + - - + + + + - - - - - - + \ No newline at end of file diff --git a/resources/assets/enderio/config/OreDictionaryPreferences_User.xml b/resources/assets/enderio/config/OreDictionaryPreferences_User.xml index f735f22b..c8581360 100644 --- a/resources/assets/enderio/config/OreDictionaryPreferences_User.xml +++ b/resources/assets/enderio/config/OreDictionaryPreferences_User.xml @@ -1,5 +1,7 @@ - +--> + + \ No newline at end of file diff --git a/resources/assets/enderio/config/PainterPaintSources_Core.xml b/resources/assets/enderio/config/PainterPaintSources_Core.xml index b8c72325..a158eeb9 100644 --- a/resources/assets/enderio/config/PainterPaintSources_Core.xml +++ b/resources/assets/enderio/config/PainterPaintSources_Core.xml @@ -1,28 +1,24 @@ - +--> @@ -30,13 +26,11 @@ For example, to remove Silverwood planks from the whitelist, the user file would - + - - \ No newline at end of file diff --git a/resources/assets/enderio/config/PainterPaintSources_User.xml b/resources/assets/enderio/config/PainterPaintSources_User.xml index fb46e182..be23cf84 100644 --- a/resources/assets/enderio/config/PainterPaintSources_User.xml +++ b/resources/assets/enderio/config/PainterPaintSources_User.xml @@ -1,9 +1,10 @@ - +--> + - + diff --git a/resources/assets/enderio/config/PoweredSpawnerConfig_Core.json b/resources/assets/enderio/config/PoweredSpawnerConfig_Core.json index 0f8a22e5..2bd70925 100644 --- a/resources/assets/enderio/config/PoweredSpawnerConfig_Core.json +++ b/resources/assets/enderio/config/PoweredSpawnerConfig_Core.json @@ -1,40 +1,40 @@ { - + // This is the CORE FILE. Do not edit. The RF cost per tick for spawners of each entity type is multiplied by these values "costMultiplier": { - + "Zombie" : "1", - "Creeper" : "1.5", + "Creeper" : "1.5", "Skeleton" : "2", "Spider" : "1", "CaveSpider" : "1", - "Silverfish" : "1", - "Witch" : "5", - "Slime" : "5", + "Silverfish" : "1", + "Witch" : "5", + "Slime" : "5", "Enderman" : "10", "SpecialMobs.SpecialEnderman" : "10", - + "LavaSlime" : "2", "PigZombie" : "5", "Ghast" : "10", "Blaze" : "5", - + "SnowMan" : "1", "VillagerGolem" : "10", "Villager" : "1", - + "Wolf" : "1", "Ozelot" : "1", "EntityHorse" : "1", "Bat" : "0.5", - - "Squid" : "0.5", - "Chicken" : "0.5", + + "Squid" : "0.5", + "Chicken" : "0.5", "Sheep" : "0.5", "Cow" : "0.5", - "Pig" : "0.5", + "Pig" : "0.5", "MushroomCow" : "1", - + "enderzoo.Enderminy" : "10", "enderzoo.ConcussionCreeper" : "1.5", "enderzoo.enderzoo.FallenKnight" : "1", @@ -42,9 +42,9 @@ "enderio.witherSkeleton" : "20" }, - + "blackList": [ "VillagerGolem", "Villager" ] -} +} \ No newline at end of file diff --git a/resources/assets/enderio/config/PoweredSpawnerConfig_User.json b/resources/assets/enderio/config/PoweredSpawnerConfig_User.json index 5430aa05..f8f2e222 100644 --- a/resources/assets/enderio/config/PoweredSpawnerConfig_User.json +++ b/resources/assets/enderio/config/PoweredSpawnerConfig_User.json @@ -3,7 +3,7 @@ // New entities are added, one already in _Core will have their values replaced with those in this file "costMultiplier": { } - + // Adding a blackList section will completely replace the one in the core file. } \ No newline at end of file diff --git a/resources/assets/enderio/config/SAGMillRecipes_Core.xml b/resources/assets/enderio/config/SAGMillRecipes_Core.xml index c3b61584..50c76cc5 100644 --- a/resources/assets/enderio/config/SAGMillRecipes_Core.xml +++ b/resources/assets/enderio/config/SAGMillRecipes_Core.xml @@ -9,11 +9,11 @@ Examples: - + ... ... - + ... ... @@ -24,7 +24,7 @@ Examples: - + @@ -32,7 +32,7 @@ - + @@ -78,8 +78,8 @@ Recipes can also be added using forge IMC messages. For example, in the init method of a mod: String recipe = - "" + - "" + + "" + + "" + "" + "" + "" + @@ -97,15 +97,17 @@ processed. Examples: - + - Adding a new grinding ball: - + + - Removing an existing grinding ball: + @@ -120,21 +122,28 @@ Item Information and data dumps: + To write all registered items to config/modObjectsRegistery.txt include: - + To write the contents of the ore dictionary to config/oreDictionaryRegistery.txt include: + + To show ore dictionary and/or registered names, in the EnderIO config set: + addRegisterdNameTooltip=true addOreDictionaryTooltips=true + --> - + - + @@ -142,7 +151,7 @@ - + @@ -150,7 +159,7 @@ - + @@ -161,7 +170,7 @@ - + @@ -171,7 +180,7 @@ - + @@ -179,7 +188,7 @@ - + @@ -190,7 +199,7 @@ - + @@ -198,7 +207,7 @@ - + @@ -208,7 +217,7 @@ - + @@ -216,7 +225,7 @@ - + @@ -226,8 +235,8 @@ - - + + @@ -235,7 +244,7 @@ - + @@ -243,7 +252,7 @@ - + @@ -251,7 +260,7 @@ - + @@ -259,7 +268,7 @@ - + @@ -268,7 +277,7 @@ - + @@ -278,7 +287,7 @@ - + @@ -286,7 +295,7 @@ - + @@ -296,7 +305,7 @@ - + @@ -304,7 +313,7 @@ - + @@ -313,7 +322,7 @@ - + @@ -322,7 +331,7 @@ - + @@ -331,7 +340,7 @@ - + @@ -341,7 +350,7 @@ - + @@ -350,7 +359,7 @@ - + @@ -359,7 +368,7 @@ - + @@ -370,7 +379,7 @@ - + @@ -379,7 +388,7 @@ - + @@ -388,7 +397,7 @@ - + @@ -398,7 +407,7 @@ - + @@ -407,7 +416,7 @@ - + @@ -416,7 +425,7 @@ - + @@ -425,7 +434,7 @@ - + @@ -436,8 +445,8 @@ - - + + @@ -447,7 +456,7 @@ - + @@ -455,7 +464,7 @@ - + @@ -464,7 +473,7 @@ - + @@ -472,7 +481,7 @@ - + @@ -482,7 +491,7 @@ - + @@ -490,7 +499,7 @@ - + @@ -499,7 +508,7 @@ - + @@ -507,7 +516,7 @@ - + @@ -515,7 +524,7 @@ - + @@ -523,7 +532,7 @@ - + @@ -532,7 +541,7 @@ - + @@ -540,7 +549,7 @@ - + @@ -548,7 +557,7 @@ - + @@ -556,7 +565,7 @@ - + @@ -564,7 +573,7 @@ - + @@ -572,7 +581,7 @@ - + @@ -582,8 +591,8 @@ - - + + @@ -593,8 +602,8 @@ - - + + @@ -605,7 +614,7 @@ - + @@ -613,7 +622,7 @@ - + @@ -621,7 +630,7 @@ - + @@ -629,7 +638,7 @@ - + @@ -637,7 +646,7 @@ - + @@ -647,8 +656,8 @@ - - + + @@ -657,7 +666,7 @@ - + @@ -666,7 +675,7 @@ - + @@ -674,7 +683,7 @@ - + @@ -682,7 +691,7 @@ - + @@ -690,7 +699,7 @@ - + @@ -700,8 +709,8 @@ - - + + @@ -709,7 +718,7 @@ - + @@ -720,8 +729,8 @@ - - + + @@ -729,7 +738,7 @@ - + @@ -737,7 +746,7 @@ - + @@ -745,7 +754,7 @@ - + @@ -753,7 +762,7 @@ - + @@ -761,7 +770,7 @@ - + @@ -769,7 +778,7 @@ - + @@ -777,7 +786,7 @@ - + @@ -785,7 +794,7 @@ - + @@ -793,7 +802,7 @@ - + @@ -801,7 +810,7 @@ - + @@ -809,7 +818,7 @@ - + @@ -817,7 +826,7 @@ - + @@ -825,7 +834,7 @@ - + @@ -833,7 +842,7 @@ - + @@ -841,7 +850,7 @@ - + @@ -849,7 +858,7 @@ - + @@ -859,8 +868,8 @@ - - + + @@ -868,7 +877,7 @@ - + @@ -876,7 +885,7 @@ - + @@ -884,7 +893,7 @@ - + @@ -894,7 +903,7 @@ - + @@ -904,7 +913,7 @@ - + @@ -914,7 +923,7 @@ - + @@ -924,7 +933,7 @@ - + @@ -934,7 +943,7 @@ - + @@ -944,7 +953,7 @@ - + @@ -954,7 +963,7 @@ - + @@ -966,8 +975,8 @@ - - + + @@ -976,7 +985,7 @@ - + @@ -985,7 +994,7 @@ - + @@ -994,7 +1003,7 @@ - + @@ -1003,7 +1012,7 @@ - + @@ -1012,7 +1021,7 @@ - + @@ -1021,7 +1030,7 @@ - + @@ -1030,7 +1039,7 @@ - + @@ -1039,7 +1048,7 @@ - + @@ -1048,7 +1057,7 @@ - + @@ -1057,7 +1066,7 @@ - + @@ -1066,7 +1075,7 @@ - + @@ -1075,7 +1084,7 @@ - + @@ -1084,7 +1093,7 @@ - + @@ -1093,7 +1102,7 @@ - + @@ -1102,7 +1111,7 @@ - + @@ -1111,7 +1120,7 @@ - + @@ -1120,7 +1129,7 @@ - + @@ -1129,7 +1138,7 @@ - + @@ -1138,7 +1147,7 @@ - + @@ -1147,7 +1156,7 @@ - + @@ -1158,9 +1167,9 @@ - + - + @@ -1168,7 +1177,7 @@ - + @@ -1176,7 +1185,7 @@ - + @@ -1184,7 +1193,7 @@ - + @@ -1192,7 +1201,7 @@ - + @@ -1200,7 +1209,7 @@ - + @@ -1208,7 +1217,7 @@ - + @@ -1216,7 +1225,7 @@ - + @@ -1224,7 +1233,7 @@ - + @@ -1232,7 +1241,7 @@ - + @@ -1240,7 +1249,7 @@ - + @@ -1248,7 +1257,7 @@ - + @@ -1256,7 +1265,7 @@ - + @@ -1264,7 +1273,7 @@ - + @@ -1272,7 +1281,7 @@ - + @@ -1280,7 +1289,7 @@ - + @@ -1288,7 +1297,7 @@ - + @@ -1296,7 +1305,7 @@ - + @@ -1304,7 +1313,7 @@ - + @@ -1312,7 +1321,7 @@ - + @@ -1320,7 +1329,7 @@ - + @@ -1328,7 +1337,7 @@ - + @@ -1336,7 +1345,7 @@ - + @@ -1344,7 +1353,7 @@ - + @@ -1353,7 +1362,7 @@ - + @@ -1361,7 +1370,7 @@ - + @@ -1369,7 +1378,7 @@ - + @@ -1377,7 +1386,7 @@ - + @@ -1385,7 +1394,7 @@ - + @@ -1393,7 +1402,7 @@ - + @@ -1401,7 +1410,7 @@ - + @@ -1409,7 +1418,7 @@ - + @@ -1417,7 +1426,7 @@ - + @@ -1425,7 +1434,7 @@ - + @@ -1433,7 +1442,7 @@ - + @@ -1441,7 +1450,7 @@ - + @@ -1449,7 +1458,7 @@ - + @@ -1457,7 +1466,7 @@ - + @@ -1465,7 +1474,7 @@ - + @@ -1473,7 +1482,7 @@ - + @@ -1481,7 +1490,7 @@ - + @@ -1489,7 +1498,7 @@ - + @@ -1497,7 +1506,7 @@ - + @@ -1505,7 +1514,7 @@ - + @@ -1513,7 +1522,7 @@ - + @@ -1521,7 +1530,7 @@ - + @@ -1529,7 +1538,7 @@ - + @@ -1537,7 +1546,7 @@ - + @@ -1545,7 +1554,7 @@ - + @@ -1553,7 +1562,7 @@ - + @@ -1561,7 +1570,7 @@ - + @@ -1569,7 +1578,7 @@ - + @@ -1577,7 +1586,7 @@ - + @@ -1585,7 +1594,7 @@ - + @@ -1593,7 +1602,7 @@ - + @@ -1601,7 +1610,7 @@ - + @@ -1609,7 +1618,7 @@ - + @@ -1617,7 +1626,7 @@ - + @@ -1625,7 +1634,7 @@ - + @@ -1633,7 +1642,7 @@ - + @@ -1641,7 +1650,7 @@ - + @@ -1649,7 +1658,7 @@ - + @@ -1657,7 +1666,7 @@ - + @@ -1666,7 +1675,7 @@ - + @@ -1674,7 +1683,7 @@ - + @@ -1682,7 +1691,7 @@ - + @@ -1690,7 +1699,7 @@ - + @@ -1698,7 +1707,7 @@ - + @@ -1706,7 +1715,7 @@ - + @@ -1714,7 +1723,7 @@ - + @@ -1722,7 +1731,7 @@ - + @@ -1730,7 +1739,7 @@ - + @@ -1738,7 +1747,7 @@ - + @@ -1746,7 +1755,7 @@ - + @@ -1754,7 +1763,7 @@ - + @@ -1762,7 +1771,7 @@ - + @@ -1770,7 +1779,7 @@ - + @@ -1778,7 +1787,7 @@ - + @@ -1786,7 +1795,7 @@ - + @@ -1794,7 +1803,7 @@ - + @@ -1802,7 +1811,7 @@ - + @@ -1810,7 +1819,7 @@ - + @@ -1818,7 +1827,7 @@ - + @@ -1826,7 +1835,7 @@ - + @@ -1834,7 +1843,7 @@ - + @@ -1842,7 +1851,7 @@ - + @@ -1850,7 +1859,7 @@ - + @@ -1858,7 +1867,7 @@ - + @@ -1866,7 +1875,7 @@ - + @@ -1874,7 +1883,7 @@ - + @@ -1882,7 +1891,7 @@ - + @@ -1890,7 +1899,7 @@ - + @@ -1898,7 +1907,7 @@ - + @@ -1906,7 +1915,7 @@ - + @@ -1914,7 +1923,7 @@ - + @@ -1922,7 +1931,7 @@ - + @@ -1930,7 +1939,7 @@ - + @@ -1938,7 +1947,7 @@ - + @@ -1946,7 +1955,7 @@ - + @@ -1954,7 +1963,7 @@ - + @@ -1962,7 +1971,7 @@ - + @@ -1970,7 +1979,7 @@ - + @@ -1980,9 +1989,9 @@ - + - + @@ -1992,7 +2001,7 @@ - + @@ -2001,7 +2010,7 @@ - + @@ -2011,9 +2020,9 @@ - + - + @@ -2023,7 +2032,7 @@ - + @@ -2031,7 +2040,7 @@ - + @@ -2039,7 +2048,7 @@ - + @@ -2047,7 +2056,7 @@ - + @@ -2057,9 +2066,9 @@ - + - + @@ -2067,7 +2076,7 @@ - + @@ -2076,7 +2085,7 @@ - + @@ -2084,7 +2093,7 @@ - + @@ -2092,7 +2101,7 @@ - + @@ -2100,7 +2109,7 @@ - + @@ -2110,8 +2119,8 @@ - - + + @@ -2119,7 +2128,7 @@ - + @@ -2127,7 +2136,7 @@ - + @@ -2135,7 +2144,7 @@ - + @@ -2143,7 +2152,7 @@ - + @@ -2151,7 +2160,7 @@ - + @@ -2159,7 +2168,7 @@ - + @@ -2167,7 +2176,7 @@ - + @@ -2175,7 +2184,7 @@ - + @@ -2183,7 +2192,7 @@ - + @@ -2191,7 +2200,7 @@ - + @@ -2199,7 +2208,7 @@ - + @@ -2207,7 +2216,7 @@ - + @@ -2215,7 +2224,7 @@ - + @@ -2223,7 +2232,7 @@ - + @@ -2231,7 +2240,7 @@ - + @@ -2239,7 +2248,7 @@ - + @@ -2247,7 +2256,7 @@ - + @@ -2255,7 +2264,7 @@ - + @@ -2263,7 +2272,7 @@ - + @@ -2271,7 +2280,7 @@ - + @@ -2279,7 +2288,7 @@ - + @@ -2287,7 +2296,7 @@ - + @@ -2295,7 +2304,7 @@ - + @@ -2303,7 +2312,7 @@ - + @@ -2311,7 +2320,7 @@ - + @@ -2319,7 +2328,7 @@ - + @@ -2327,7 +2336,7 @@ - + @@ -2335,7 +2344,7 @@ - + @@ -2343,7 +2352,7 @@ - + @@ -2351,7 +2360,7 @@ - + @@ -2359,7 +2368,7 @@ - + @@ -2369,8 +2378,8 @@ - - + + @@ -2378,7 +2387,7 @@ - + @@ -2386,7 +2395,7 @@ - + @@ -2394,7 +2403,7 @@ - + @@ -2402,7 +2411,7 @@ - + @@ -2410,7 +2419,7 @@ - + @@ -2418,7 +2427,7 @@ - + @@ -2426,7 +2435,7 @@ - + @@ -2434,7 +2443,7 @@ - + @@ -2442,7 +2451,7 @@ - + @@ -2450,7 +2459,7 @@ - + @@ -2458,7 +2467,7 @@ - + @@ -2466,7 +2475,7 @@ - + @@ -2474,7 +2483,7 @@ - + @@ -2482,7 +2491,7 @@ - + @@ -2490,7 +2499,7 @@ - + @@ -2498,7 +2507,7 @@ - + @@ -2506,7 +2515,7 @@ - + @@ -2514,7 +2523,7 @@ - + @@ -2522,7 +2531,7 @@ - + @@ -2531,70 +2540,70 @@ - + - + - + - + - + - + - + - + - + - + @@ -2603,8 +2612,8 @@ - - + + @@ -2616,10 +2625,10 @@ - + - + @@ -2635,4 +2644,4 @@ - + \ No newline at end of file diff --git a/resources/assets/enderio/config/SAGMillRecipes_User.xml b/resources/assets/enderio/config/SAGMillRecipes_User.xml index 2e0ca2c3..20ad9a48 100644 --- a/resources/assets/enderio/config/SAGMillRecipes_User.xml +++ b/resources/assets/enderio/config/SAGMillRecipes_User.xml @@ -9,8 +9,8 @@ Adding a new recipe to a new group: - - + + @@ -31,21 +31,21 @@ To disable individual recipes, simply provide an invalid recipe for them: - + Disable the glass recipes in the group 'Vanilla': - + Modifying Recipes: Modify a core recipe definition, in this case, make glass give diamonds: - - + + @@ -57,8 +57,8 @@ Add this block to change the default TE obsidian -> dust recipe to the railcraft recipe. - - + + @@ -74,7 +74,7 @@ Adding a new grinding ball: - + @@ -98,4 +98,4 @@ - + \ No newline at end of file diff --git a/resources/assets/enderio/config/SliceAndSpliceRecipes_Core.xml b/resources/assets/enderio/config/SliceAndSpliceRecipes_Core.xml index 2ab71020..75101bac 100644 --- a/resources/assets/enderio/config/SliceAndSpliceRecipes_Core.xml +++ b/resources/assets/enderio/config/SliceAndSpliceRecipes_Core.xml @@ -1,72 +1,67 @@ - - - + + - - - - - - + + + + + + - + - - + - - - - - - + + + + + + - + - - + - - - - - - + + + + + + - + - - + - - - - - - + + + + + + - + - - + \ No newline at end of file diff --git a/resources/assets/enderio/config/VatRecipes_Core.xml b/resources/assets/enderio/config/VatRecipes_Core.xml index b4f61cbe..e20c75d7 100644 --- a/resources/assets/enderio/config/VatRecipes_Core.xml +++ b/resources/assets/enderio/config/VatRecipes_Core.xml @@ -1,113 +1,96 @@ - - --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + - + - - - + - - - - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/resources/assets/enderio/config/VatRecipes_User.xml b/resources/assets/enderio/config/VatRecipes_User.xml index f9d777e3..57f05f18 100644 --- a/resources/assets/enderio/config/VatRecipes_User.xml +++ b/resources/assets/enderio/config/VatRecipes_User.xml @@ -1,3 +1,3 @@ - + \ No newline at end of file From 6d85216bdcb29516de9824ce2acf97059fd6e735 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 4 Jun 2015 20:03:01 -0400 Subject: [PATCH 06/33] #2541 Crafter should post craft event, clean up fake player classes --- .../enderio/machine/FakePlayerEIO.java | 40 +++++++++++++++++++ .../enderio/machine/crafter/TileCrafter.java | 17 ++++++++ .../machine/killera/TileKillerJoe.java | 25 ++---------- 3 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 src/main/java/crazypants/enderio/machine/FakePlayerEIO.java diff --git a/src/main/java/crazypants/enderio/machine/FakePlayerEIO.java b/src/main/java/crazypants/enderio/machine/FakePlayerEIO.java new file mode 100644 index 00000000..c2a1ad28 --- /dev/null +++ b/src/main/java/crazypants/enderio/machine/FakePlayerEIO.java @@ -0,0 +1,40 @@ +package crazypants.enderio.machine; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; +import crazypants.util.BlockCoord; + +public class FakePlayerEIO extends FakePlayer { + + ItemStack prevWeapon; + + public FakePlayerEIO(World world, BlockCoord pos, GameProfile profile) { + super(MinecraftServer.getServer().worldServerForDimension(world.provider.dimensionId), profile); + posX = pos.x + 0.5; + posY = pos.y + 0.5; + posZ = pos.z + 0.5; + } + + // These do things with packets...which crash since the net handler is null. Potion effects are not needed anyways. + @Override + protected void onNewPotionEffect(PotionEffect p_70670_1_) { + } + + @Override + protected void onChangedPotionEffect(PotionEffect p_70695_1_, boolean p_70695_2_) { + } + + @Override + protected void onFinishedPotionEffect(PotionEffect p_70688_1_) { + } + + @Override + public void addChatMessage(IChatComponent p_145747_1_) { + } +} diff --git a/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java b/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java index 2e96cb3c..37723567 100644 --- a/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java +++ b/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java @@ -3,6 +3,7 @@ package crazypants.enderio.machine.crafter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.UUID; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -10,9 +11,16 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.FakePlayer; + +import com.mojang.authlib.GameProfile; + +import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; import crazypants.enderio.ModObject; import crazypants.enderio.config.Config; import crazypants.enderio.machine.AbstractPowerConsumerEntity; +import crazypants.enderio.machine.FakePlayerEIO; import crazypants.enderio.machine.IItemBuffer; import crazypants.enderio.machine.SlotDefinition; import crazypants.enderio.power.BasicCapacitor; @@ -29,6 +37,8 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf private boolean bufferStacks = true; private long ticksSinceLastCraft = 0; + + private FakePlayer playerInst; public TileCrafter() { super(new SlotDefinition(9, 1)); @@ -123,6 +133,9 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf } } + private static final UUID uuid = UUID.fromString("9b381cae-3c95-4a64-b958-1e25b0a4c790"); + private static final GameProfile DUMMY_PROFILE = new GameProfile(uuid, "[EioCrafter]"); + private void craftRecipe() { // (1) Find the items to craft with and put a copy into a temp crafting grid; @@ -157,6 +170,10 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf // (3) If we got a result, ... if (output != null) { + if (playerInst == null) { + playerInst = new FakePlayerEIO(worldObj, getLocation(), DUMMY_PROFILE); + } + MinecraftForge.EVENT_BUS.post(new ItemCraftedEvent(playerInst, output, inv)); // (3a) ... remove the used up items and ... for (int i = 0; i < 9; i++) { diff --git a/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java b/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java index 0fcb41b4..f9c03441 100644 --- a/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java +++ b/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java @@ -32,6 +32,7 @@ import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.config.Config; import crazypants.enderio.machine.AbstractMachineEntity; +import crazypants.enderio.machine.FakePlayerEIO; import crazypants.enderio.machine.SlotDefinition; import crazypants.enderio.machine.generator.zombie.IHasNutrientTank; import crazypants.enderio.machine.generator.zombie.PacketNutrientTank; @@ -496,15 +497,12 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle private static final UUID uuid = UUID.fromString("3baa66fa-a69a-11e4-89d3-123b93f75cba"); private static final GameProfile DUMMY_PROFILE = new GameProfile(uuid, "[EioKillera]"); - private class Attackera extends FakePlayer { + private class Attackera extends FakePlayerEIO { ItemStack prevWeapon; public Attackera() { - super(MinecraftServer.getServer().worldServerForDimension(getWorldObj().provider.dimensionId), DUMMY_PROFILE); - posX = xCoord + 0.5; - posY = yCoord + 0.5; - posZ = zCoord + 0.5; + super(MinecraftServer.getServer().worldServerForDimension(getWorldObj().provider.dimensionId), getLocation(), DUMMY_PROFILE); } @Override @@ -527,23 +525,6 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle getChargedLocation().chargeItems(inventory.mainInventory); } - - // These do things with packets...which crash since the net handler is null. Potion effects are not needed anyways. - @Override - protected void onNewPotionEffect(PotionEffect p_70670_1_) { - } - - @Override - protected void onChangedPotionEffect(PotionEffect p_70695_1_, boolean p_70695_2_) { - } - - @Override - protected void onFinishedPotionEffect(PotionEffect p_70688_1_) { - } - - @Override - public void addChatMessage(IChatComponent p_145747_1_) { - } } @Override From f24bf6b25c16418b556b9145333f42bafd28ba14 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 4 Jun 2015 20:04:33 -0400 Subject: [PATCH 07/33] This is done in the superclass... --- .../java/crazypants/enderio/machine/killera/TileKillerJoe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java b/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java index f9c03441..c088f36e 100644 --- a/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java +++ b/src/main/java/crazypants/enderio/machine/killera/TileKillerJoe.java @@ -502,7 +502,7 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle ItemStack prevWeapon; public Attackera() { - super(MinecraftServer.getServer().worldServerForDimension(getWorldObj().provider.dimensionId), getLocation(), DUMMY_PROFILE); + super(getWorldObj(), getLocation(), DUMMY_PROFILE); } @Override From 9aa903f19649f7ea547771eb36ebc990b670227a Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 5 Jun 2015 15:53:08 -0400 Subject: [PATCH 08/33] Fix farm station GUI y size --- .../java/crazypants/enderio/machine/farm/GuiFarmStation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java b/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java index dce74f51..190d1bcd 100644 --- a/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java +++ b/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java @@ -23,6 +23,7 @@ public class GuiFarmStation extends GuiPoweredMachineBase { public GuiFarmStation(InventoryPlayer par1InventoryPlayer, TileFarmStation machine) { super(machine, new FarmStationContainer(par1InventoryPlayer, machine)); + setYSize(ySize + 3); } @SuppressWarnings("unchecked") @@ -102,5 +103,4 @@ public class GuiFarmStation extends GuiPoweredMachineBase { protected int getPowerHeight() { return super.getPowerHeight() + 3; } - } From 6f5f9651dcc895e1a310e1c90ac465e3c29a6c5f Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sat, 6 Jun 2015 22:48:19 +0200 Subject: [PATCH 09/33] don't crash for unnamed inventories or when the name contains special characters --- .../enderio/conduit/item/ItemConduitNetwork.java | 5 ++--- .../enderio/conduit/item/NetworkedInventory.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/item/ItemConduitNetwork.java b/src/main/java/crazypants/enderio/conduit/item/ItemConduitNetwork.java index e9b99a4b..9d5c6e02 100644 --- a/src/main/java/crazypants/enderio/conduit/item/ItemConduitNetwork.java +++ b/src/main/java/crazypants/enderio/conduit/item/ItemConduitNetwork.java @@ -14,7 +14,6 @@ import crazypants.enderio.conduit.item.NetworkedInventory.Target; import crazypants.enderio.conduit.item.filter.IItemFilter; import crazypants.enderio.machine.invpanel.server.InventoryDatabaseServer; import crazypants.util.BlockCoord; -import crazypants.util.Lang; public class ItemConduitNetwork extends AbstractConduitNetwork { @@ -180,7 +179,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork { NetworkedInventory inv; int distance; From 508e06323ce077adca2760d10879d6cb689aae49 Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sun, 7 Jun 2015 19:00:54 +0200 Subject: [PATCH 10/33] #2552 prevent endless loops in crafting --- .../machine/crafter/ContainerCrafter.java | 2 +- .../machine/crafter/DummyCraftingGrid.java | 13 --- .../enderio/machine/crafter/TileCrafter.java | 90 +++++++++---------- 3 files changed, 42 insertions(+), 63 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/crafter/ContainerCrafter.java b/src/main/java/crazypants/enderio/machine/crafter/ContainerCrafter.java index a2c03fb7..e31bf47f 100644 --- a/src/main/java/crazypants/enderio/machine/crafter/ContainerCrafter.java +++ b/src/main/java/crazypants/enderio/machine/crafter/ContainerCrafter.java @@ -82,7 +82,7 @@ public class ContainerCrafter extends AbstractMachineContainer { if(refStack == null || itemStack == null) { return false; } - return refStack.isItemEqual(itemStack); + return TileCrafter.compareDamageable(itemStack, refStack); } } diff --git a/src/main/java/crazypants/enderio/machine/crafter/DummyCraftingGrid.java b/src/main/java/crazypants/enderio/machine/crafter/DummyCraftingGrid.java index c8ce0268..019b4574 100644 --- a/src/main/java/crazypants/enderio/machine/crafter/DummyCraftingGrid.java +++ b/src/main/java/crazypants/enderio/machine/crafter/DummyCraftingGrid.java @@ -1,7 +1,5 @@ package crazypants.enderio.machine.crafter; -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -20,17 +18,6 @@ public class DummyCraftingGrid implements IInventory { return inv[9]; } - public void copyRequiredInputs(List required) { - for (int i = 0; i < 9; i++) { - ItemStack is = inv[i]; - if(is != null) { - ItemStack copy = is.copy(); - copy.stackSize = 1; - required.add(copy); - } - } - } - @Override public int getSizeInventory() { return inv.length; diff --git a/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java b/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java index 37723567..7c470b56 100644 --- a/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java +++ b/src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java @@ -32,7 +32,7 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf DummyCraftingGrid craftingGrid = new DummyCraftingGrid(); - private List containerItems; + private final List containerItems; private boolean bufferStacks = true; @@ -63,7 +63,7 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf if(!slotDefinition.isInputSlot(slot)) { return false; } - return craftingGrid.inv[slot] != null && craftingGrid.inv[slot].isItemEqual(itemstack); + return craftingGrid.inv[slot] != null && compareDamageable(itemstack, craftingGrid.inv[slot]); } @Override @@ -99,10 +99,7 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf return false; } - List required = new ArrayList(); - craftingGrid.copyRequiredInputs(required); - if(hasRequiredInput(required)) { - craftRecipe(); + if(craftRecipe()) { int used = Math.min(getEnergyStored(), Config.crafterRfPerCraft); setEnergyStored(getEnergyStored() - used); } @@ -133,10 +130,20 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf } } + static boolean compareDamageable(ItemStack stack, ItemStack req) { + if(stack.isItemEqual(req)) { + return true; + } + if(stack.isItemStackDamageable() && stack.getItem() == req.getItem()) { + return stack.getItemDamage() < stack.getMaxDamage(); + } + return false; + } + private static final UUID uuid = UUID.fromString("9b381cae-3c95-4a64-b958-1e25b0a4c790"); private static final GameProfile DUMMY_PROFILE = new GameProfile(uuid, "[EioCrafter]"); - private void craftRecipe() { + private boolean craftRecipe() { // (1) Find the items to craft with and put a copy into a temp crafting grid; // also record what was used to destroy it later @@ -147,27 +154,30 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf } }, 3, 3); - ItemStack[] shadowInventory = new ItemStack[9]; - for (int i = 0; i < 9; i++) { - shadowInventory[i] = inventory[i] == null ? null : inventory[i].copy(); - } + int[] usedItems = new int[9]; for (int j = 0; j < 9; j++) { ItemStack req = craftingGrid.getStackInSlot(j); - for (int i = 0; i < 9 && req != null; i++) { - if (shadowInventory[i] != null && shadowInventory[i].stackSize > 0 && shadowInventory[i].isItemEqual(req)) { - req = null; - shadowInventory[i].stackSize--; - ItemStack craftingItem = shadowInventory[i].copy(); - craftingItem.stackSize = 1; - inv.setInventorySlotContents(j, craftingItem); + if (req != null) { + for (int i = 0; i < 9; i++) { + if (inventory[i] != null && inventory[i].stackSize > usedItems[i] && compareDamageable(inventory[i], req)) { + req = null; + usedItems[i]++; + ItemStack craftingItem = inventory[i].copy(); + craftingItem.stackSize = 1; + inv.setInventorySlotContents(j, craftingItem); + break; + } + } + if (req != null) { + return false; } } } // (2) Try to craft with the temp grid ItemStack output = CraftingManager.getInstance().findMatchingRecipe(inv, worldObj); - + // (3) If we got a result, ... if (output != null) { if (playerInst == null) { @@ -177,7 +187,7 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf // (3a) ... remove the used up items and ... for (int i = 0; i < 9; i++) { - while (shadowInventory[i] != null && inventory[i] != null && shadowInventory[i].stackSize < inventory[i].stackSize) { + for (int j = 0; j < usedItems[i] && inventory[i] != null; j++) { setInventorySlotContents(i, eatOneItemForCrafting(inventory[i].copy())); } } @@ -205,14 +215,20 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf // Crafting failed. This is not supposed to happen, but if a recipe is nbt-sensitive, it can. // To avoid being stuck in a dead loop, we flush the non-working input items. for (int j = 0; j < 9; j++) { - if (shadowInventory[j] != null) { - setInventorySlotContents(j, shadowInventory[j].stackSize > 0 ? shadowInventory[j] : null); - } - if (craftingGrid.getStackInSlot(j) != null) { - containerItems.add(craftingGrid.getStackInSlot(j)); + if (usedItems[j] > 0 && inventory[j] != null) { + ItemStack rejected = inventory[j].copy(); + rejected.stackSize = Math.min(inventory[j].stackSize, usedItems[j]); + containerItems.add(rejected); + if (inventory[j].stackSize <= usedItems[j]) { + inventory[j] = null; + } else { + inventory[j].stackSize -= usedItems[j]; + } } } } + + return true; } private ItemStack eatOneItemForCrafting(ItemStack avail) { @@ -269,30 +285,6 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf return output.getMaxStackSize() >= (inventory[9].stackSize + output.stackSize); } - private boolean hasRequiredInput(List required) { - List available = new ArrayList(); - for (int i = 0; i < 9; i++) { - ItemStack is = inventory[i]; - if(is != null) { - available.add(is.copy()); - } - } - for (ItemStack req : required) { - boolean foundReq = false; - for (ItemStack avail : available) { - if(req.isItemEqual(avail) && avail.stackSize > 0) { - avail.stackSize--; - foundReq = true; - break; - } - } - if(!foundReq) { - return false; - } - } - return true; - } - @Override public int getInventoryStackLimit() { return bufferStacks ? 64 : 1; From 34c7f19f3a14a9efed2f5cba76b42c1ac1d2a813 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 8 Jun 2015 02:41:03 -0400 Subject: [PATCH 11/33] Update CoFH API, implement IBlockAppearance --- src/main/java/cofh/api/CoFHAPIProps.java | 2 +- .../java/cofh/api/block/IBlockAppearance.java | 51 ++++++++ .../java/cofh/api/block/IBlockConfigGui.java | 31 +++++ src/main/java/cofh/api/block/IBlockDebug.java | 6 +- src/main/java/cofh/api/block/IBlockInfo.java | 6 +- .../java/cofh/api/block/IDismantleable.java | 4 +- .../java/cofh/api/energy/EnergyStorage.java | 8 +- .../cofh/api/energy/IEnergyConnection.java | 4 +- .../cofh/api/energy/IEnergyContainerItem.java | 8 +- .../java/cofh/api/energy/IEnergyHandler.java | 1 - .../java/cofh/api/energy/IEnergyStorage.java | 8 +- .../cofh/api/energy/ItemEnergyContainer.java | 4 +- .../cofh/api/inventory/IInventoryHandler.java | 12 +- .../api/inventory/IInventoryRetainer.java | 4 +- src/main/java/cofh/api/item/IAugmentItem.java | 4 +- .../java/cofh/api/item/IEmpowerableItem.java | 8 +- .../api/item/IInventoryContainerItem.java | 6 +- .../java/cofh/api/item/IMultiModeItem.java | 56 +++++++++ src/main/java/cofh/api/item/IToolHammer.java | 4 +- .../cofh/api/tileentity/IAugmentable.java | 4 +- .../java/cofh/api/tileentity/IEnergyInfo.java | 6 +- .../java/cofh/api/tileentity/IPlacedTile.java | 13 -- .../cofh/api/tileentity/IPortableData.java | 8 +- .../api/tileentity/IReconfigurableFacing.java | 10 +- .../api/tileentity/IReconfigurableSides.java | 14 +-- .../cofh/api/tileentity/IRedstoneCache.java | 6 +- .../cofh/api/tileentity/IRedstoneControl.java | 4 +- .../java/cofh/api/tileentity/ISecurable.java | 18 ++- .../cofh/api/tileentity/ISidedTexture.java | 6 +- .../java/cofh/api/tileentity/ITileInfo.java | 6 +- .../cofh/api/transport/IEnderDestination.java | 17 +++ .../api/transport/IEnderEnergyHandler.java | 8 +- .../api/transport/IEnderFluidHandler.java | 8 +- .../cofh/api/transport/IEnderItemHandler.java | 10 +- .../java/cofh/api/transport/IItemDuct.java | 6 +- .../api/transport/RegistryEnderAttuned.java | 118 ++++++++++++++++-- .../enderio/conduit/BlockConduitBundle.java | 15 +++ .../enderio/machine/buffer/BlockBuffer.java | 15 +++ .../painter/BlockPaintedGlowstone.java | 15 +++ .../teleport/anchor/BlockTravelAnchor.java | 65 ++++++---- src/main/java/crazypants/util/IFacade.java | 4 +- 41 files changed, 458 insertions(+), 145 deletions(-) create mode 100644 src/main/java/cofh/api/block/IBlockAppearance.java create mode 100644 src/main/java/cofh/api/block/IBlockConfigGui.java create mode 100644 src/main/java/cofh/api/item/IMultiModeItem.java delete mode 100644 src/main/java/cofh/api/tileentity/IPlacedTile.java create mode 100644 src/main/java/cofh/api/transport/IEnderDestination.java diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java index 775d8d22..06b5b183 100644 --- a/src/main/java/cofh/api/CoFHAPIProps.java +++ b/src/main/java/cofh/api/CoFHAPIProps.java @@ -6,6 +6,6 @@ public class CoFHAPIProps { } - public static final String VERSION = "1.7.10R1.0.3"; + public static final String VERSION = "1.7.10R1.0.12"; } diff --git a/src/main/java/cofh/api/block/IBlockAppearance.java b/src/main/java/cofh/api/block/IBlockAppearance.java new file mode 100644 index 00000000..558d348e --- /dev/null +++ b/src/main/java/cofh/api/block/IBlockAppearance.java @@ -0,0 +1,51 @@ +package cofh.api.block; + +import net.minecraft.block.Block; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be available server-side, so ensure the code is + * server-safe and doesn't use client-side code. + * + */ +public interface IBlockAppearance { + + /** + * This function returns the block that is being shown on a given side. + * + * @param world + * Reference to the world. + * @param x + * X coordinate of the block. + * @param y + * Y coordinate of the block. + * @param z + * Z coordinate of the block. + * @param side + * The side of the block. + */ + public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side); + + /** + * This function returns metadata of the block that is being shown on a given side. + * + * @param world + * Reference to the world. + * @param x + * X coordinate of the block. + * @param y + * Y coordinate of the block. + * @param z + * Z coordinate of the block. + * @param side + * The side of the block. + */ + public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side); + + /** + * This function returns whether the block's renderer will visually connect to other blocks implementing IBlockAppearance. + */ + public boolean supportsVisualConnections(); + +} diff --git a/src/main/java/cofh/api/block/IBlockConfigGui.java b/src/main/java/cofh/api/block/IBlockConfigGui.java new file mode 100644 index 00000000..9e00c87d --- /dev/null +++ b/src/main/java/cofh/api/block/IBlockConfigGui.java @@ -0,0 +1,31 @@ +package cofh.api.block; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Implement this interface on blocks which have a GUI that needs a tool (e.g., multimeter) to open. + * + */ +public interface IBlockConfigGui { + + /** + * This function will open a GUI if the player has permission. + * + * @param world + * Reference to the world. + * @param x + * X coordinate of the block. + * @param y + * Y coordinate of the block. + * @param z + * Z coordinate of the block. + * @param side + * The side of the block. + * @param player + * Player doing the configuring. + * @return True if the GUI was opened. + */ + public boolean openConfigGui(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player); +} diff --git a/src/main/java/cofh/api/block/IBlockDebug.java b/src/main/java/cofh/api/block/IBlockDebug.java index 091831c9..dc02f7f7 100644 --- a/src/main/java/cofh/api/block/IBlockDebug.java +++ b/src/main/java/cofh/api/block/IBlockDebug.java @@ -6,15 +6,15 @@ import net.minecraftforge.common.util.ForgeDirection; /** * Implement this interface on blocks which have some debug method which can be activated via a tool or other means. - * + * * @author King Lemming - * + * */ public interface IBlockDebug { /** * This function debugs a block. - * + * * @param world * Reference to the world. * @param x diff --git a/src/main/java/cofh/api/block/IBlockInfo.java b/src/main/java/cofh/api/block/IBlockInfo.java index 12d96f0b..8494243c 100644 --- a/src/main/java/cofh/api/block/IBlockInfo.java +++ b/src/main/java/cofh/api/block/IBlockInfo.java @@ -12,15 +12,15 @@ import net.minecraftforge.common.util.ForgeDirection; /** * Implement this interface on blocks which can provide information about themselves. If the block contains Tile Entities, then it is recommended that this * function serve as a passthrough for {@link ITileInfo}. - * + * * @author King Lemming - * + * */ public interface IBlockInfo { /** * This function appends information to a list provided to it. - * + * * @param world * Reference to the world. * @param x diff --git a/src/main/java/cofh/api/block/IDismantleable.java b/src/main/java/cofh/api/block/IDismantleable.java index 0e530a65..12c09e3a 100644 --- a/src/main/java/cofh/api/block/IDismantleable.java +++ b/src/main/java/cofh/api/block/IDismantleable.java @@ -8,9 +8,9 @@ import net.minecraft.world.World; /** * Implemented on Blocks which have some method of being instantly dismantled. - * + * * @author King Lemming - * + * */ public interface IDismantleable { diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java index 1674c189..25e0126a 100644 --- a/src/main/java/cofh/api/energy/EnergyStorage.java +++ b/src/main/java/cofh/api/energy/EnergyStorage.java @@ -4,9 +4,9 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class EnergyStorage implements IEnergyStorage { @@ -89,7 +89,7 @@ public class EnergyStorage implements IEnergyStorage { /** * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers * are guaranteed to have it. - * + * * @param energy */ public void setEnergyStored(int energy) { @@ -106,7 +106,7 @@ public class EnergyStorage implements IEnergyStorage { /** * This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this * externally, as not all IEnergyHandlers are guaranteed to have it. - * + * * @param energy */ public void modifyEnergyStored(int energy) { diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java index 79bdf77a..301271e5 100644 --- a/src/main/java/cofh/api/energy/IEnergyConnection.java +++ b/src/main/java/cofh/api/energy/IEnergyConnection.java @@ -7,9 +7,9 @@ import net.minecraftforge.common.util.ForgeDirection; * accept it; otherwise just use IEnergyHandler. *

* Note that {@link IEnergyHandler} is an extension of this. - * + * * @author King Lemming - * + * */ public interface IEnergyConnection { diff --git a/src/main/java/cofh/api/energy/IEnergyContainerItem.java b/src/main/java/cofh/api/energy/IEnergyContainerItem.java index c28455b1..3ef72576 100644 --- a/src/main/java/cofh/api/energy/IEnergyContainerItem.java +++ b/src/main/java/cofh/api/energy/IEnergyContainerItem.java @@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack; * Implement this interface on Item classes that support external manipulation of their internal energy storages. *

* A reference implementation is provided {@link ItemEnergyContainer}. - * + * * @author King Lemming - * + * */ public interface IEnergyContainerItem { /** * Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged. - * + * * @param container * ItemStack to be charged. * @param maxReceive @@ -28,7 +28,7 @@ public interface IEnergyContainerItem { /** * Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally * discharged. - * + * * @param container * ItemStack to be discharged. * @param maxExtract diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java index 22f2dbc6..6a4600a4 100644 --- a/src/main/java/cofh/api/energy/IEnergyHandler.java +++ b/src/main/java/cofh/api/energy/IEnergyHandler.java @@ -42,7 +42,6 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { @Override int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - /** * Returns the amount of energy currently stored. */ diff --git a/src/main/java/cofh/api/energy/IEnergyStorage.java b/src/main/java/cofh/api/energy/IEnergyStorage.java index bc206560..414b2656 100644 --- a/src/main/java/cofh/api/energy/IEnergyStorage.java +++ b/src/main/java/cofh/api/energy/IEnergyStorage.java @@ -5,15 +5,15 @@ package cofh.api.energy; * This is not to be implemented on TileEntities. This is for internal use only. *

* A reference implementation can be found at {@link EnergyStorage}. - * + * * @author King Lemming - * + * */ public interface IEnergyStorage { /** * Adds energy to the storage. Returns quantity of energy that was accepted. - * + * * @param maxReceive * Maximum amount of energy to be inserted. * @param simulate @@ -24,7 +24,7 @@ public interface IEnergyStorage { /** * Removes energy from the storage. Returns quantity of energy that was removed. - * + * * @param maxExtract * Maximum amount of energy to be extracted. * @param simulate diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java index 055ae45b..2d3659cb 100644 --- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java +++ b/src/main/java/cofh/api/energy/ItemEnergyContainer.java @@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { diff --git a/src/main/java/cofh/api/inventory/IInventoryHandler.java b/src/main/java/cofh/api/inventory/IInventoryHandler.java index 4cb753c9..344e8153 100644 --- a/src/main/java/cofh/api/inventory/IInventoryHandler.java +++ b/src/main/java/cofh/api/inventory/IInventoryHandler.java @@ -7,18 +7,18 @@ import net.minecraftforge.common.util.ForgeDirection; /** * Implement this interface on TileEntities which should handle items. - * + * * A reference implementation is provided {@link TileInventoryHandler}. - * + * * @author King Lemming - * + * */ public interface IInventoryHandler extends IInventoryConnection { /** * Insert an ItemStack into the IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns what is remaining of the * original stack - a null return means that the entire stack was accepted! - * + * * @param from * Orientation the item is inserted from. * @param item @@ -32,7 +32,7 @@ public interface IInventoryHandler extends IInventoryConnection { /** * Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a * null return means that nothing was extracted! - * + * * @param from * Orientation the item is extracted from. * @param item @@ -47,7 +47,7 @@ public interface IInventoryHandler extends IInventoryConnection { /** * Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a * null return means that nothing was extracted! - * + * * @param from * Orientation the item is extracted from. * @param maxExtract diff --git a/src/main/java/cofh/api/inventory/IInventoryRetainer.java b/src/main/java/cofh/api/inventory/IInventoryRetainer.java index 30309fb2..df79681e 100644 --- a/src/main/java/cofh/api/inventory/IInventoryRetainer.java +++ b/src/main/java/cofh/api/inventory/IInventoryRetainer.java @@ -2,9 +2,9 @@ package cofh.api.inventory; /** * Marks a block which will retain its inventory when broken. - * + * * @author King Lemming - * + * */ public interface IInventoryRetainer { diff --git a/src/main/java/cofh/api/item/IAugmentItem.java b/src/main/java/cofh/api/item/IAugmentItem.java index 497bace9..e17fa8de 100644 --- a/src/main/java/cofh/api/item/IAugmentItem.java +++ b/src/main/java/cofh/api/item/IAugmentItem.java @@ -8,7 +8,7 @@ public interface IAugmentItem { /** * Get the augmentation level for a given Augment and Augment Type. - * + * * @param stack * ItemStack representing the Augment. * @param type @@ -19,7 +19,7 @@ public interface IAugmentItem { /** * Get the Augment Types for a given Augment. Set ensure that there are no duplicates. - * + * * @param stack * ItemStack representing the Augment. * @return Set of the Augmentation Types. Should return an empty set if there are none (but this would be really stupid to make). DO NOT RETURN NULL. diff --git a/src/main/java/cofh/api/item/IEmpowerableItem.java b/src/main/java/cofh/api/item/IEmpowerableItem.java index f77c71f6..42877110 100644 --- a/src/main/java/cofh/api/item/IEmpowerableItem.java +++ b/src/main/java/cofh/api/item/IEmpowerableItem.java @@ -6,9 +6,9 @@ import net.minecraft.item.ItemStack; /** * Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with * them. - * + * * @author King Lemming - * + * */ public interface IEmpowerableItem { @@ -19,7 +19,7 @@ public interface IEmpowerableItem { /** * Attempt to set the empowered state of the item. - * + * * @param stack * ItemStack to be empowered/disempowered. * @param state @@ -30,7 +30,7 @@ public interface IEmpowerableItem { /** * Callback method for reacting to a state change. Useful in KeyBinding handlers. - * + * * @param player * Player holding the item, if applicable. * @param stack diff --git a/src/main/java/cofh/api/item/IInventoryContainerItem.java b/src/main/java/cofh/api/item/IInventoryContainerItem.java index b87896cc..adadf10a 100644 --- a/src/main/java/cofh/api/item/IInventoryContainerItem.java +++ b/src/main/java/cofh/api/item/IInventoryContainerItem.java @@ -4,11 +4,11 @@ import net.minecraft.item.ItemStack; /** * Implement this interface on Item classes that are themselves inventories. - * + * * A reference implementation is provided {@link ItemInventoryContainer}. - * + * * @author King Lemming - * + * */ public interface IInventoryContainerItem { diff --git a/src/main/java/cofh/api/item/IMultiModeItem.java b/src/main/java/cofh/api/item/IMultiModeItem.java new file mode 100644 index 00000000..c236bbfb --- /dev/null +++ b/src/main/java/cofh/api/item/IMultiModeItem.java @@ -0,0 +1,56 @@ +package cofh.api.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with + * them. + * + * @author King Lemming + * + */ +public interface IMultiModeItem { + + /** + * Get the current mode of an item. + */ + int getMode(ItemStack stack); + + /** + * Attempt to set the empowered state of the item. + * + * @param stack + * ItemStack to set the mode on. + * @param mode + * Desired mode. + * @return TRUE if the operation was successful, FALSE if it was not. + */ + boolean setMode(ItemStack stack, int mode); + + /** + * Increment the current mode of an item. + */ + boolean incrMode(ItemStack stack); + + /** + * Decrement the current mode of an item. + */ + boolean decrMode(ItemStack stack); + + /** + * Returns the number of possible modes. + */ + int getNumModes(ItemStack stack); + + /** + * Callback method for reacting to a state change. Useful in KeyBinding handlers. + * + * @param player + * Player holding the item, if applicable. + * @param stack + * The item being held. + */ + void onModeChange(EntityPlayer player, ItemStack stack); + +} diff --git a/src/main/java/cofh/api/item/IToolHammer.java b/src/main/java/cofh/api/item/IToolHammer.java index 1ffefe72..f7b3918f 100644 --- a/src/main/java/cofh/api/item/IToolHammer.java +++ b/src/main/java/cofh/api/item/IToolHammer.java @@ -10,7 +10,7 @@ public interface IToolHammer { /** * Called to ensure that the wrench can be used. - * + * * @param item * The itemstack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools) * @param user @@ -27,7 +27,7 @@ public interface IToolHammer { /** * Callback for when the tool has been used reactively. - * + * * @param item * The ItemStack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools) * @param user diff --git a/src/main/java/cofh/api/tileentity/IAugmentable.java b/src/main/java/cofh/api/tileentity/IAugmentable.java index 735ade14..5a99c598 100644 --- a/src/main/java/cofh/api/tileentity/IAugmentable.java +++ b/src/main/java/cofh/api/tileentity/IAugmentable.java @@ -4,9 +4,9 @@ import net.minecraft.item.ItemStack; /** * Implemented on objects which support Augments. - * + * * @author King Lemming - * + * */ public interface IAugmentable { diff --git a/src/main/java/cofh/api/tileentity/IEnergyInfo.java b/src/main/java/cofh/api/tileentity/IEnergyInfo.java index 72d553b3..6277a34c 100644 --- a/src/main/java/cofh/api/tileentity/IEnergyInfo.java +++ b/src/main/java/cofh/api/tileentity/IEnergyInfo.java @@ -2,11 +2,11 @@ package cofh.api.tileentity; /** * Implement this interface on objects which can report information about their energy usage. - * + * * This is used for reporting purposes - Energy transactions are handled through IEnergyHandler! - * + * * @author King Lemming - * + * */ public interface IEnergyInfo { diff --git a/src/main/java/cofh/api/tileentity/IPlacedTile.java b/src/main/java/cofh/api/tileentity/IPlacedTile.java deleted file mode 100644 index df54a969..00000000 --- a/src/main/java/cofh/api/tileentity/IPlacedTile.java +++ /dev/null @@ -1,13 +0,0 @@ -package cofh.api.tileentity; - -/** - * Implement this interface on Tile Entities which need to know when they are placed into the world. - * - * @author Zeldo - * - */ -public interface IPlacedTile { - - public void tilePlaced(); - -} diff --git a/src/main/java/cofh/api/tileentity/IPortableData.java b/src/main/java/cofh/api/tileentity/IPortableData.java index 13134dbd..81d42964 100644 --- a/src/main/java/cofh/api/tileentity/IPortableData.java +++ b/src/main/java/cofh/api/tileentity/IPortableData.java @@ -5,18 +5,18 @@ import net.minecraft.nbt.NBTTagCompound; /** * Implement this interface on Tile Entities which can write a limited amount of data about themselves. - * + * * This is typically for the purposes of being transferred to a similar tile entity. - * + * * @author King Lemming - * + * */ public interface IPortableData { /** * Data identifier of the Tile Entity/Block. Used for display as well as verification purposes. Tiles with completely interchangeable data should return the * same type. - * + * * @return */ String getDataType(); diff --git a/src/main/java/cofh/api/tileentity/IReconfigurableFacing.java b/src/main/java/cofh/api/tileentity/IReconfigurableFacing.java index 40efe7c3..e6972091 100644 --- a/src/main/java/cofh/api/tileentity/IReconfigurableFacing.java +++ b/src/main/java/cofh/api/tileentity/IReconfigurableFacing.java @@ -2,11 +2,11 @@ package cofh.api.tileentity; /** * Implement this interface on Tile Entities which allow for reconfiguration of their facing. - * + * * Coordination with the containing block is required. - * + * * @author King Lemming - * + * */ public interface IReconfigurableFacing { @@ -22,14 +22,14 @@ public interface IReconfigurableFacing { /** * Attempt to rotate the block. Arbitrary based on implementation. - * + * * @return True if rotation was successful, false otherwise. */ boolean rotateBlock(); /** * Set the facing of the block. - * + * * @param side * The side to set the facing to. * @return True if the facing was set, false otherwise. diff --git a/src/main/java/cofh/api/tileentity/IReconfigurableSides.java b/src/main/java/cofh/api/tileentity/IReconfigurableSides.java index 79c0f5bc..e3a708dd 100644 --- a/src/main/java/cofh/api/tileentity/IReconfigurableSides.java +++ b/src/main/java/cofh/api/tileentity/IReconfigurableSides.java @@ -2,17 +2,17 @@ package cofh.api.tileentity; /** * Implement this interface on Tile Entities which allow for reconfiguration of their sides. - * + * * Coordination with the containing block is required. - * + * * @author King Lemming - * + * */ public interface IReconfigurableSides { /** * Decrement the config for a given side. - * + * * @param side * The side to decrement. * @return True if config was changed, false otherwise. @@ -21,7 +21,7 @@ public interface IReconfigurableSides { /** * Increment the config for a given side. - * + * * @param side * The side to decrement. * @return True if config was changed, false otherwise. @@ -30,7 +30,7 @@ public interface IReconfigurableSides { /** * Set the config for a given side. - * + * * @param side * The side to set. * @param config @@ -41,7 +41,7 @@ public interface IReconfigurableSides { /** * Reset configs on all sides to their base values. - * + * * @return True if reset was successful, false otherwise. */ boolean resetSides(); diff --git a/src/main/java/cofh/api/tileentity/IRedstoneCache.java b/src/main/java/cofh/api/tileentity/IRedstoneCache.java index f1254d8d..1d873e53 100644 --- a/src/main/java/cofh/api/tileentity/IRedstoneCache.java +++ b/src/main/java/cofh/api/tileentity/IRedstoneCache.java @@ -2,11 +2,11 @@ package cofh.api.tileentity; /** * Implement this interface on Tile Entities which cache their redstone status. - * + * * Note that {@link IRedstoneControl} is an extension of this. - * + * * @author King Lemming - * + * */ public interface IRedstoneCache { diff --git a/src/main/java/cofh/api/tileentity/IRedstoneControl.java b/src/main/java/cofh/api/tileentity/IRedstoneControl.java index 11060325..f868affb 100644 --- a/src/main/java/cofh/api/tileentity/IRedstoneControl.java +++ b/src/main/java/cofh/api/tileentity/IRedstoneControl.java @@ -3,9 +3,9 @@ package cofh.api.tileentity; /** * Implement this interface on Tile Entities which have Redstone Control functionality. This means that a tile can be set to ignore redstone entirely, or * respond to a low or high redstone state. - * + * * @author King Lemming - * + * */ public interface IRedstoneControl extends IRedstoneCache { diff --git a/src/main/java/cofh/api/tileentity/ISecurable.java b/src/main/java/cofh/api/tileentity/ISecurable.java index 06018fa6..fd29f1e6 100644 --- a/src/main/java/cofh/api/tileentity/ISecurable.java +++ b/src/main/java/cofh/api/tileentity/ISecurable.java @@ -1,18 +1,22 @@ package cofh.api.tileentity; +import com.mojang.authlib.GameProfile; + +import net.minecraft.entity.player.EntityPlayer; + /** * Implement this interface on Tile Entities which can have access restrictions. - * + * * @author King Lemming - * + * */ public interface ISecurable { /** * Enum for Access Modes - Restricted is Friends Only, Private is Owner only. - * + * * @author King Lemming - * + * */ public static enum AccessMode { PUBLIC, RESTRICTED, PRIVATE; @@ -47,10 +51,14 @@ public interface ISecurable { boolean setOwnerName(String name); + boolean setOwner(GameProfile name); + AccessMode getAccess(); String getOwnerName(); - boolean canPlayerAccess(String name); + GameProfile getOwner(); + + boolean canPlayerAccess(EntityPlayer player); } diff --git a/src/main/java/cofh/api/tileentity/ISidedTexture.java b/src/main/java/cofh/api/tileentity/ISidedTexture.java index 1d5884f4..20be6dd6 100644 --- a/src/main/java/cofh/api/tileentity/ISidedTexture.java +++ b/src/main/java/cofh/api/tileentity/ISidedTexture.java @@ -5,15 +5,15 @@ import net.minecraft.util.IIcon; /** * Implement this interface on Tile Entities which can change their block's texture based on the current render pass. The block must defer the call to its Tile * Entity. - * + * * @author Zeldo Kavira - * + * */ public interface ISidedTexture { /** * Returns the icon to use for a given side and render pass. - * + * * @param side * Block side to get the texture for. * @param pass diff --git a/src/main/java/cofh/api/tileentity/ITileInfo.java b/src/main/java/cofh/api/tileentity/ITileInfo.java index f040694a..87e4ce8f 100644 --- a/src/main/java/cofh/api/tileentity/ITileInfo.java +++ b/src/main/java/cofh/api/tileentity/ITileInfo.java @@ -8,15 +8,15 @@ import net.minecraftforge.common.util.ForgeDirection; /** * Implement this interface on Tile Entities which can provide information about themselves. - * + * * @author King Lemming - * + * */ public interface ITileInfo { /** * This function appends information to a list provided to it. - * + * * @param info * The list that the information should be appended to. * @param side diff --git a/src/main/java/cofh/api/transport/IEnderDestination.java b/src/main/java/cofh/api/transport/IEnderDestination.java new file mode 100644 index 00000000..30153c0d --- /dev/null +++ b/src/main/java/cofh/api/transport/IEnderDestination.java @@ -0,0 +1,17 @@ +package cofh.api.transport; + +public interface IEnderDestination extends IEnderAttuned { + + public boolean isNotValid(); + + public int x(); + public int y(); + public int z(); + public int dimension(); + + public int getDestination(); + + public boolean setDestination(int frequency); + + public boolean clearDestination(); +} diff --git a/src/main/java/cofh/api/transport/IEnderEnergyHandler.java b/src/main/java/cofh/api/transport/IEnderEnergyHandler.java index 0886be76..892a5c66 100644 --- a/src/main/java/cofh/api/transport/IEnderEnergyHandler.java +++ b/src/main/java/cofh/api/transport/IEnderEnergyHandler.java @@ -2,9 +2,9 @@ package cofh.api.transport; /** * This interface is implemented on Ender Attuned objects which can receive Energy (Redstone Flux). - * + * * @author King Lemming - * + * */ public interface IEnderEnergyHandler extends IEnderAttuned { @@ -15,7 +15,7 @@ public interface IEnderEnergyHandler extends IEnderAttuned { /** * This should be checked to see if the Ender Attuned object can currently receive energy (Redstone Flux). - * + * * Note: In practice, this can (and should) be used to ensure that something does not send to itself. */ boolean canReceiveEnergy(); @@ -23,7 +23,7 @@ public interface IEnderEnergyHandler extends IEnderAttuned { /** * This tells the Ender Attuned object to receive energy. This returns the amount remaining, *not* the amount received - a return of 0 means that all energy * was received! - * + * * @param energy * Amount of energy to be received. * @param simulate diff --git a/src/main/java/cofh/api/transport/IEnderFluidHandler.java b/src/main/java/cofh/api/transport/IEnderFluidHandler.java index 3927fe1b..2f509e81 100644 --- a/src/main/java/cofh/api/transport/IEnderFluidHandler.java +++ b/src/main/java/cofh/api/transport/IEnderFluidHandler.java @@ -4,9 +4,9 @@ import net.minecraftforge.fluids.FluidStack; /** * This interface is implemented on Ender Attuned objects which can receive Fluid. - * + * * @author King Lemming - * + * */ public interface IEnderFluidHandler extends IEnderAttuned { @@ -17,7 +17,7 @@ public interface IEnderFluidHandler extends IEnderAttuned { /** * This should be checked to see if the Ender Attuned object can currently receive a FluidStack. - * + * * Note: In practice, this can (and should) be used to ensure that something does not send to itself. */ boolean canReceiveFluid(); @@ -25,7 +25,7 @@ public interface IEnderFluidHandler extends IEnderAttuned { /** * This tells the Ender Attuned object to receive a FluidStack. This returns what remains of the original stack, *not* the amount received - a null return * means that the entire stack was received! - * + * * @param fluid * FluidStack to be received. * @param simulate diff --git a/src/main/java/cofh/api/transport/IEnderItemHandler.java b/src/main/java/cofh/api/transport/IEnderItemHandler.java index 2944a001..d5dad8f3 100644 --- a/src/main/java/cofh/api/transport/IEnderItemHandler.java +++ b/src/main/java/cofh/api/transport/IEnderItemHandler.java @@ -4,9 +4,9 @@ import net.minecraft.item.ItemStack; /** * This interface is implemented on Ender Attuned objects which can receive Items. - * + * * @author King Lemming - * + * */ public interface IEnderItemHandler extends IEnderAttuned { @@ -17,7 +17,7 @@ public interface IEnderItemHandler extends IEnderAttuned { /** * This should be checked to see if the Ender Attuned object can currently receive an ItemStack. - * + * * Note: In practice, this can (and should) be used to ensure that something does not send to itself. */ boolean canReceiveItems(); @@ -25,10 +25,10 @@ public interface IEnderItemHandler extends IEnderAttuned { /** * This tells the Ender Attuned object to receive an ItemStack. This returns what remains of the original stack, *not* the amount received - a null return * means that the entire stack was received! - * + * * This function does not support simulation because Inventory manipulation in Minecraft is an absolute mess and it would be a computational liability to do * so. - * + * * @param item * ItemStack to be received. * @return An ItemStack representing how much is remaining. diff --git a/src/main/java/cofh/api/transport/IItemDuct.java b/src/main/java/cofh/api/transport/IItemDuct.java index 4c50c856..67338346 100644 --- a/src/main/java/cofh/api/transport/IItemDuct.java +++ b/src/main/java/cofh/api/transport/IItemDuct.java @@ -5,16 +5,16 @@ import net.minecraftforge.common.util.ForgeDirection; /** * This interface is implemented on ItemDucts. Use it to attempt to eject items into an entry point. - * + * * @author Zeldo Kavira, King Lemming - * + * */ public interface IItemDuct { /** * Insert an ItemStack into the IItemDuct. Will only accept items if there is a valid destination. This returns what is remaining of the original stack - a * null return means that the entire stack was accepted/routed! - * + * * @param from * Orientation the item is inserted from. * @param item diff --git a/src/main/java/cofh/api/transport/RegistryEnderAttuned.java b/src/main/java/cofh/api/transport/RegistryEnderAttuned.java index 0f91b215..9213d95f 100644 --- a/src/main/java/cofh/api/transport/RegistryEnderAttuned.java +++ b/src/main/java/cofh/api/transport/RegistryEnderAttuned.java @@ -1,7 +1,5 @@ package cofh.api.transport; -import gnu.trove.map.hash.THashMap; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -10,23 +8,69 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.Configuration; public final class RegistryEnderAttuned { - public static Map>> inputItem = new THashMap>>(); - public static Map>> inputFluid = new THashMap>>(); - public static Map>> inputEnergy = new THashMap>>(); + public static Map>> inputItem = new HashMap>>(); + public static Map>> inputFluid = new HashMap>>(); + public static Map>> inputEnergy = new HashMap>>(); - public static Map>> outputItem = new THashMap>>(); - public static Map>> outputFluid = new THashMap>>(); - public static Map>> outputEnergy = new THashMap>>(); + public static Map>> outputItem = new HashMap>>(); + public static Map>> outputFluid = new HashMap>>(); + public static Map>> outputEnergy = new HashMap>>(); + + public static Map> outputTeleport = new HashMap>(); public static Configuration linkConf; public static Map clientFrequencyNames = new LinkedHashMap(); public static Map clientFrequencyNamesReversed = new LinkedHashMap(); + private static class EnderDestination { + + private final int dimension; + private final int x, y, z; + private IEnderDestination output; + + public EnderDestination(IEnderDestination output) { + + x = output.x(); + y = output.y(); + z = output.z(); + dimension = output.dimension(); + this.output = output; + } + + public boolean hasOutput() { + + return DimensionManager.isDimensionRegistered(dimension); + } + + public IEnderDestination getOutput() { + + if (output == null || output.isNotValid()) { + output = null; + if (!DimensionManager.isDimensionRegistered(dimension)) { + return null; + } + WorldServer world = DimensionManager.getWorld(dimension); + if (world == null) { + DimensionManager.initDimension(dimension); + world = DimensionManager.getWorld(dimension); + } + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof IEnderDestination) { + output = (IEnderDestination) te; + } + } + return output; + } + } + public static void clear() { inputItem.clear(); @@ -85,6 +129,31 @@ public final class RegistryEnderAttuned { return outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); } + public static boolean hasDestination(IEnderDestination theAttuned) { + + return hasDestination(theAttuned, true); + } + + public static boolean hasDestination(IEnderDestination theAttuned, boolean to) { + + Map map = outputTeleport.get(theAttuned.getChannelString()); + if (map == null) { + return false; + } + EnderDestination dest = map.get(to ? theAttuned.getDestination() : theAttuned.getFrequency()); + return dest == null ? false : dest.hasOutput(); + } + + public static IEnderDestination getDestination(IEnderDestination theAttuned) { + + Map map = outputTeleport.get(theAttuned.getChannelString()); + if (map == null) { + return null; + } + EnderDestination dest = map.get(theAttuned.getDestination()); + return dest == null ? null : dest.getOutput(); + } + /* HELPER FUNCTIONS */ public static void addItemHandler(IEnderItemHandler theAttuned) { @@ -164,6 +233,16 @@ public final class RegistryEnderAttuned { } } + public static void addDestination(IEnderDestination theAttuned) { + + if (!hasDestination(theAttuned, false)) { + if (outputTeleport.get(theAttuned.getChannelString()) == null) { + outputTeleport.put(theAttuned.getChannelString(), new HashMap()); + } + outputTeleport.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new EnderDestination(theAttuned)); + } + } + public static void removeItemHandler(IEnderItemHandler theAttuned) { if (inputItem.get(theAttuned.getChannelString()) != null) { @@ -224,6 +303,23 @@ public final class RegistryEnderAttuned { } } + public static void removeDestination(IEnderDestination theAttuned) { + + Map map = outputTeleport.get(theAttuned.getChannelString()); + if (map == null) { + return; + } + EnderDestination dest = map.get(theAttuned.getFrequency()); + if (dest == null) { + return; + } + if (dest.dimension == theAttuned.dimension()) { + if (dest.x == theAttuned.x() && dest.y == theAttuned.x() && dest.z == theAttuned.x()) { + map.remove(theAttuned.getFrequency()); + } + } + } + public static void add(IEnderAttuned theAttuned) { if (theAttuned instanceof IEnderItemHandler) { @@ -235,6 +331,9 @@ public final class RegistryEnderAttuned { if (theAttuned instanceof IEnderEnergyHandler) { addEnergyHandler((IEnderEnergyHandler) theAttuned); } + if (theAttuned instanceof IEnderDestination) { + addDestination((IEnderDestination) theAttuned); + } } public static void remove(IEnderAttuned theAttuned) { @@ -248,6 +347,9 @@ public final class RegistryEnderAttuned { if (theAttuned instanceof IEnderEnergyHandler) { removeEnergyHandler((IEnderEnergyHandler) theAttuned); } + if (theAttuned instanceof IEnderDestination) { + removeDestination((IEnderDestination) theAttuned); + } } public static void sortClientNames() { diff --git a/src/main/java/crazypants/enderio/conduit/BlockConduitBundle.java b/src/main/java/crazypants/enderio/conduit/BlockConduitBundle.java index 9f570189..59d45ad9 100644 --- a/src/main/java/crazypants/enderio/conduit/BlockConduitBundle.java +++ b/src/main/java/crazypants/enderio/conduit/BlockConduitBundle.java @@ -962,6 +962,21 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade return res; } + @Override + public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacade(world, x, y, z, side.ordinal()); + } + + @Override + public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacadeMetadata(world, x, y, z, side.ordinal()); + } + + @Override + public boolean supportsVisualConnections() { + return true; + } + @Override public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues) { IRedstoneConduit conduit = getRedstoneConduit(world, x, y, z); diff --git a/src/main/java/crazypants/enderio/machine/buffer/BlockBuffer.java b/src/main/java/crazypants/enderio/machine/buffer/BlockBuffer.java index 8647fd5e..b7731771 100644 --- a/src/main/java/crazypants/enderio/machine/buffer/BlockBuffer.java +++ b/src/main/java/crazypants/enderio/machine/buffer/BlockBuffer.java @@ -11,6 +11,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -184,4 +185,18 @@ public class BlockBuffer extends AbstractMachineBlock implements IFa return this; } + @Override + public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacade(world, x, y, z, side.ordinal()); + } + + @Override + public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacadeMetadata(world, x, y, z, side.ordinal()); + } + + @Override + public boolean supportsVisualConnections() { + return true; + } } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockPaintedGlowstone.java b/src/main/java/crazypants/enderio/machine/painter/BlockPaintedGlowstone.java index 2f30b179..1748a7ca 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockPaintedGlowstone.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockPaintedGlowstone.java @@ -294,4 +294,19 @@ public class BlockPaintedGlowstone extends BlockEio implements ITileEntityProvid } return this; } + + @Override + public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacade(world, x, y, z, side.ordinal()); + } + + @Override + public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacadeMetadata(world, x, y, z, side.ordinal()); + } + + @Override + public boolean supportsVisualConnections() { + return true; + } } diff --git a/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java b/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java index 6f140eab..0d050766 100644 --- a/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java +++ b/src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java @@ -16,6 +16,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.UsernameCache; +import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -71,7 +72,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt private BlockTravelAnchor() { super(ModObject.blockTravelAnchor.unlocalisedName, TileTravelAnchor.class); - if(!Config.travelAnchorEnabled) { + if (!Config.travelAnchorEnabled) { setCreativeTab(null); } } @@ -92,9 +93,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileTravelAnchor) { + if (te instanceof TileTravelAnchor) { TileTravelAnchor tef = (TileTravelAnchor) te; - if(tef.getSourceBlock() != null) { + if (tef.getSourceBlock() != null) { return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata()); } } @@ -108,9 +109,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack par6ItemStack) { - if(entity instanceof EntityPlayer) { + if (entity instanceof EntityPlayer) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileTravelAnchor) { + if (te instanceof TileTravelAnchor) { TileTravelAnchor ta = (TileTravelAnchor) te; ta.setPlacedBy((EntityPlayer) entity); Block b = PainterUtil.getSourceBlock(par6ItemStack); @@ -124,9 +125,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @Override public boolean openGui(World world, int x, int y, int z, EntityPlayer entityPlayer, int side) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof ITravelAccessable) { + if (te instanceof ITravelAccessable) { ITravelAccessable ta = (ITravelAccessable) te; - if(ta.canUiBeAccessed(entityPlayer)) { + if (ta.canUiBeAccessed(entityPlayer)) { entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, world, x, y, z); } else { sendPrivateChatMessage(entityPlayer, ta.getPlacedBy()); @@ -134,20 +135,19 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt } return true; } - + public static void sendPrivateChatMessage(EntityPlayer player, UUID owner) { - if(player.worldObj.isRemote && !player.isSneaking()) { - player.addChatComponentMessage(new ChatComponentText(Lang.localize("gui.travelAccessable.privateBlock1") + " " - + EnumChatFormatting.RED + UsernameCache.getLastKnownUsername(owner) + EnumChatFormatting.WHITE + " " - + Lang.localize("gui.travelAccessable.privateBlock2"))); + if (player.worldObj.isRemote && !player.isSneaking()) { + player.addChatComponentMessage(new ChatComponentText(Lang.localize("gui.travelAccessable.privateBlock1") + " " + EnumChatFormatting.RED + + UsernameCache.getLastKnownUsername(owner) + EnumChatFormatting.WHITE + " " + Lang.localize("gui.travelAccessable.privateBlock2"))); } } - + @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof ITravelAccessable) { - if(ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) { + if (te instanceof ITravelAccessable) { + if (ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) { return new ContainerTravelAccessable(player.inventory, (ITravelAccessable) te, world); } else { return new ContainerTravelAuth(player.inventory); @@ -159,8 +159,8 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof ITravelAccessable) { - if(ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) { + if (te instanceof ITravelAccessable) { + if (ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) { return new GuiTravelAccessable(player.inventory, (ITravelAccessable) te, world); } else { return new GuiTravelAuth(player, (ITravelAccessable) te, world); @@ -173,13 +173,13 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt protected void processDrop(World world, int x, int y, int z, TileEntityEio te, ItemStack drop) { TileTravelAnchor anchor = (TileTravelAnchor) te; - if(anchor == null) { + if (anchor == null) { return; } ItemStack itemStack = new ItemStack(this); Block srcBlk = anchor.getSourceBlock(); - if(srcBlk != null) { + if (srcBlk != null) { itemStack = createItemStackForSourceBlock(anchor.getSourceBlock(), anchor.getSourceBlockMetadata()); drop.stackTagCompound = (NBTTagCompound) itemStack.stackTagCompound.copy(); } @@ -194,9 +194,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileTravelAnchor) { + if (te instanceof TileTravelAnchor) { TileTravelAnchor tef = (TileTravelAnchor) te; - if(tef.getSourceBlock() != null) { + if (tef.getSourceBlock() != null) { return tef.getSourceBlock().colorMultiplier(world, x, y, z); } } @@ -214,7 +214,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt } public ItemStack createItemStackForSourceBlock(Block block, int damage) { - if(block == this) { + if (block == this) { return new ItemStack(this); } ItemStack result = new ItemStack(this, 1, damage); @@ -236,7 +236,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @Override public ResultStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) { ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs); - if(paintSource == null) { + if (paintSource == null) { return new ResultStack[0]; } return new ResultStack[] { new ResultStack(createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage())) }; @@ -246,7 +246,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @Override public int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileTravelAnchor) { + if (te instanceof TileTravelAnchor) { return ((TileTravelAnchor) te).getSourceBlockMetadata(); } return 0; @@ -255,9 +255,24 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt @Override public Block getFacade(IBlockAccess world, int x, int y, int z, int side) { TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TileTravelAnchor) { + if (te instanceof TileTravelAnchor) { return ((TileTravelAnchor) te).getSourceBlock(); } return this; } + + @Override + public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacade(world, x, y, z, side.ordinal()); + } + + @Override + public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + return getFacadeMetadata(world, x, y, z, side.ordinal()); + } + + @Override + public boolean supportsVisualConnections() { + return true; + } } diff --git a/src/main/java/crazypants/util/IFacade.java b/src/main/java/crazypants/util/IFacade.java index adbeb429..c6975bf7 100644 --- a/src/main/java/crazypants/util/IFacade.java +++ b/src/main/java/crazypants/util/IFacade.java @@ -1,5 +1,7 @@ package crazypants.util; -public interface IFacade extends info.jbcs.minecraft.chisel.api.IFacade, com.cricketcraft.chisel.api.IFacade { +import cofh.api.block.IBlockAppearance; + +public interface IFacade extends info.jbcs.minecraft.chisel.api.IFacade, com.cricketcraft.chisel.api.IFacade, IBlockAppearance { // :( } From 57292ff0048a6a9185f4d63a2789e6518dbd58b8 Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Mon, 8 Jun 2015 21:58:21 +0200 Subject: [PATCH 12/33] cleanup DB slot tracking --- .../invpanel/server/AbstractInventory.java | 88 +++++++++---------- .../machine/invpanel/server/DSUInventory.java | 15 ++-- .../server/InventoryDatabaseServer.java | 2 +- .../machine/invpanel/server/ItemEntry.java | 33 +++---- .../invpanel/server/NormalInventory.java | 14 +-- .../machine/invpanel/server/SlotKey.java | 20 +++++ 6 files changed, 89 insertions(+), 83 deletions(-) create mode 100644 src/main/java/crazypants/enderio/machine/invpanel/server/SlotKey.java diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java b/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java index 484643e2..f38d03c1 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java @@ -3,68 +3,64 @@ package crazypants.enderio.machine.invpanel.server; import net.minecraft.item.ItemStack; abstract class AbstractInventory { - static final ItemEntry[] NO_SLOTS = new ItemEntry[0]; - ItemEntry[] slotItems = NO_SLOTS; - int[] itemCounts; + static final SlotKey[] NO_SLOTS = new SlotKey[0]; + SlotKey[] slotKeys = NO_SLOTS; - protected void setEmpty(InventoryDatabaseServer db, int aiIndex) { - if (slotItems.length != 0) { - reset(db, 0, aiIndex); + protected void setEmpty(InventoryDatabaseServer db) { + if (slotKeys.length != 0) { + reset(db, 0); } } - protected void reset(InventoryDatabaseServer db, int count, int aiIndex) { - for (int slot = 0; slot < slotItems.length; slot++) { - ItemEntry key = slotItems[slot]; - if (key != null) { - key.removeSlot(aiIndex, slot); - db.entryChanged(key); + protected void reset(InventoryDatabaseServer db, int count) { + for (SlotKey slotKey : slotKeys) { + if(slotKey != null) { + slotKey.remove(db); } } - slotItems = new ItemEntry[count]; - itemCounts = new int[count]; + slotKeys = new SlotKey[count]; } - protected void updateSlot(InventoryDatabaseServer db, int slot, int aiIndex, ItemStack stack) { - ItemEntry current = slotItems[slot]; - if (stack == null || stack.stackSize <= 0) { - if (current != null) { - slotItems[slot] = null; - itemCounts[slot] = 0; - current.removeSlot(aiIndex, slot); - db.entryChanged(current); - } - } else { - ItemEntry key = db.lookupItem(stack, current, true); - if (key != current) { - slotItems[slot] = key; - itemCounts[slot] = stack.stackSize; - key.addSlot(aiIndex, slot); - db.entryChanged(key); - if (current != null) { - current.removeSlot(aiIndex, slot); - db.entryChanged(current); - } - } else if (itemCounts[slot] != stack.stackSize) { - itemCounts[slot] = stack.stackSize; - db.entryChanged(current); - } + protected void updateSlot(InventoryDatabaseServer db, int slot, ItemStack stack) { + SlotKey slotKey = slotKeys[slot]; + ItemEntry current = slotKey != null ? slotKey.item : null; + ItemEntry key = db.lookupItem(stack, current, true); + if (key != current) { + updateSlotKey(db, slot, slotKey, key, stack); + } else if (slotKey != null && slotKey.count != stack.stackSize) { + slotKey.count = stack.stackSize; + db.entryChanged(current); } } - protected void updateCount(InventoryDatabaseServer db, int slot, int aiIndex, ItemEntry entry, int count) { - if (itemCounts[slot] != count) { - itemCounts[slot] = count; + private void updateSlotKey(InventoryDatabaseServer db, int slot, SlotKey slotKey, ItemEntry key, ItemStack stack) { + if (slotKey != null) { + slotKey.remove(db); + slotKey = null; + } + if (key != null) { + slotKey = new SlotKey(this, slot, key, stack.stackSize); + key.addSlot(slotKey); + db.entryChanged(key); + } + slotKeys[slot] = slotKey; + } + + protected void updateCount(InventoryDatabaseServer db, int slot, ItemEntry entry, int count) { + SlotKey slotKey = slotKeys[slot]; + if (slotKey != null && slotKey.count != count && slotKey.item == entry) { if (count == 0) { - slotItems[slot] = null; - entry.removeSlot(aiIndex, slot); + slotKey.remove(db); + slotKeys[slot] = null; + } else { + slotKey.count = count; + db.entryChanged(slotKey.item); } - db.entryChanged(entry); } } - abstract int scanInventory(InventoryDatabaseServer db, int aiIndex); + abstract int scanInventory(InventoryDatabaseServer db); - abstract int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int aiIndex, int count); + abstract int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count); } diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/DSUInventory.java b/src/main/java/crazypants/enderio/machine/invpanel/server/DSUInventory.java index 72ef0072..3bbe76ba 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/DSUInventory.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/DSUInventory.java @@ -8,23 +8,18 @@ class DSUInventory extends AbstractInventory { DSUInventory(IDeepStorageUnit dsu) { this.dsu = dsu; + this.slotKeys = new SlotKey[1]; } @Override - public int scanInventory(InventoryDatabaseServer db, int aiIndex) { - if (slotItems.length != 1) { - reset(db, 1, aiIndex); - } + public int scanInventory(InventoryDatabaseServer db) { ItemStack stack = dsu.getStoredItemType(); - updateSlot(db, 0, aiIndex, stack); + updateSlot(db, 0, stack); return 1; } @Override - public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int aiIndex, int count) { - if (slotItems.length != 1) { - return 0; - } + public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) { ItemStack stack = dsu.getStoredItemType(); if (db.lookupItem(stack, entry, false) != entry) { return 0; @@ -35,7 +30,7 @@ class DSUInventory extends AbstractInventory { } remaining -= count; dsu.setStoredItemCount(remaining); - updateCount(db, slot, aiIndex, entry, remaining); + updateCount(db, 0, entry, remaining); return count; } diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java b/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java index 9c7c825e..a55e0d22 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java @@ -234,7 +234,7 @@ public class InventoryDatabaseServer extends InventoryDatabase { } AbstractInventory inv = inventories[currentInventory]; - int slots = inv.scanInventory(this, currentInventory); + int slots = inv.scanInventory(this); currentInventory = (currentInventory+1) % inventories.length; tickPause += 1 + (slots + 8) / 9; diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/ItemEntry.java b/src/main/java/crazypants/enderio/machine/invpanel/server/ItemEntry.java index dcec327e..546897ae 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/ItemEntry.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/ItemEntry.java @@ -1,47 +1,42 @@ package crazypants.enderio.machine.invpanel.server; import crazypants.enderio.machine.invpanel.ItemEntryBase; -import java.util.HashSet; +import java.util.IdentityHashMap; import net.minecraft.nbt.NBTTagCompound; public class ItemEntry extends ItemEntryBase { - private final HashSet slots = new HashSet(); + private final IdentityHashMap slots = new IdentityHashMap(); public ItemEntry(int dbID, int hash, int itemID, int meta, NBTTagCompound nbt) { super(dbID, hash, itemID, meta, nbt); } - static int encodeAISlot(int aiIndex, int slot) { - return (aiIndex << 12) | slot; + void addSlot(SlotKey slotKey) { + slots.put(slotKey, slotKey); } - void addSlot(int aiIndex, int slot) { - slots.add(encodeAISlot(aiIndex, slot)); - } - - void removeSlot(int aiIndex, int slot) { - slots.remove(encodeAISlot(aiIndex, slot)); + void removeSlot(SlotKey slotKey) { + slots.remove(slotKey); } int countItems(InventoryDatabaseServer db) { int count = 0; - for (Integer idx : slots) { - AbstractInventory key = db.getInventory(idx >> 12); - count += key.itemCounts[idx & 4095]; + for (SlotKey slotKey : slots.values()) { + count += slotKey.count; } return count; } int extractItems(InventoryDatabaseServer db, int count) { int extracted = 0; - Integer[] copy = slots.toArray(new Integer[slots.size()]); - for (Integer idx : copy) { - int aiIndex = idx >> 12; - int slotIndex = idx & 4095; - AbstractInventory key = db.getInventory(aiIndex); - int amount = key.extractItem(db, this, slotIndex, aiIndex, count); + SlotKey[] copy = slots.values().toArray(new SlotKey[slots.size()]); + for (SlotKey slotKey : copy) { + int amount = slotKey.inv.extractItem(db, this, slotKey.slot, count); count -= amount; extracted += amount; + if (count <= 0) { + break; + } } return extracted; } diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/NormalInventory.java b/src/main/java/crazypants/enderio/machine/invpanel/server/NormalInventory.java index 87ca9423..cd6caa95 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/NormalInventory.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/NormalInventory.java @@ -12,17 +12,17 @@ class NormalInventory extends AbstractInventory { } @Override - int scanInventory(InventoryDatabaseServer db, int aiIndex) { + int scanInventory(InventoryDatabaseServer db) { ISidedInventory inv = ni.getInventoryRecheck(); int side = ni.getInventorySide(); int[] slotIndices = inv.getAccessibleSlotsFromSide(side); if (slotIndices == null || slotIndices.length == 0) { - setEmpty(db, aiIndex); + setEmpty(db); return 0; } int count = slotIndices.length; - if (count != slotItems.length) { - reset(db, count, aiIndex); + if (count != slotKeys.length) { + reset(db, count); } for (int slot = 0; slot < count; slot++) { int invSlot = slotIndices[slot]; @@ -30,13 +30,13 @@ class NormalInventory extends AbstractInventory { if (stack != null && !inv.canExtractItem(invSlot, stack, side)) { stack = null; } - updateSlot(db, slot, aiIndex, stack); + updateSlot(db, slot, stack); } return count; } @Override - public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int aiIndex, int count) { + public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) { ISidedInventory inv = ni.getInventoryRecheck(); int side = ni.getInventorySide(); int[] slotIndices = inv.getAccessibleSlotsFromSide(side); @@ -57,7 +57,7 @@ class NormalInventory extends AbstractInventory { } ni.itemExtracted(invSlot, count); remaining -= count; - updateCount(db, slot, aiIndex, entry, remaining); + updateCount(db, slot, entry, remaining); return count; } diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/SlotKey.java b/src/main/java/crazypants/enderio/machine/invpanel/server/SlotKey.java new file mode 100644 index 00000000..7c82979a --- /dev/null +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/SlotKey.java @@ -0,0 +1,20 @@ +package crazypants.enderio.machine.invpanel.server; + +public final class SlotKey { + final AbstractInventory inv; + final int slot; + final ItemEntry item; + int count; + + SlotKey(AbstractInventory inv, int slot, ItemEntry item, int count) { + this.inv = inv; + this.slot = slot; + this.item = item; + this.count = count; + } + + void remove(InventoryDatabaseServer db) { + item.removeSlot(this); + db.entryChanged(item); + } +} From f7b64b8d7f1d6428c954077d47aa026ec5485a3a Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Wed, 10 Jun 2015 20:56:58 +0200 Subject: [PATCH 13/33] #2557 only add the button tooltip to the GUI when the button had been added --- .../conduit/gui/item/BasicItemFilterGui.java | 2 +- .../crazypants/enderio/gui/IconButtonEIO.java | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java index 7daa8bcc..7e1a4803 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java @@ -163,7 +163,7 @@ public class BasicItemFilterGui implements IItemFilterGui { } @Override - public void deactivate() { + public void deactivate() { useNbtB.detach(); useMetaB.detach(); useOreDictB.detach(); diff --git a/src/main/java/crazypants/enderio/gui/IconButtonEIO.java b/src/main/java/crazypants/enderio/gui/IconButtonEIO.java index 747c6172..f43a904e 100644 --- a/src/main/java/crazypants/enderio/gui/IconButtonEIO.java +++ b/src/main/java/crazypants/enderio/gui/IconButtonEIO.java @@ -23,6 +23,7 @@ public class IconButtonEIO extends GuiButton { private int xOrigin; private int yOrigin; + protected boolean isOnGui; protected IGuiScreen gui; protected String[] toolTipText; @@ -51,11 +52,11 @@ public class IconButtonEIO extends GuiButton { } protected void setToolTip(GuiToolTip newToolTip) { - if (toolTip != null) { + if (isOnGui && toolTip != null) { gui.removeToolTip(toolTip); } toolTip = newToolTip; - if (toolTip != null) { + if (isOnGui && toolTip != null) { gui.addToolTip(toolTip); } } @@ -65,17 +66,23 @@ public class IconButtonEIO extends GuiButton { } public void onGuiInit() { - gui.addButton(this); - if(toolTip != null) { - gui.addToolTip(toolTip); + if(!isOnGui) { + gui.addButton(this); + if(toolTip != null) { + gui.addToolTip(toolTip); + } + isOnGui = true; } xPosition = xOrigin + gui.getGuiLeft(); yPosition = yOrigin + gui.getGuiTop(); } public void detach() { - gui.removeToolTip(toolTip); - gui.removeButton(this); + if(isOnGui) { + gui.removeToolTip(toolTip); + gui.removeButton(this); + isOnGui = false; + } } public void setSize(int width, int height) { From b6bd6dffaf2998759bf644e9227e94c3d7a7cc6d Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 11 Jun 2015 21:48:09 -0400 Subject: [PATCH 14/33] Fix enchanter GUI --- .../machine/enchanter/GuiEnchanter.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/enchanter/GuiEnchanter.java b/src/main/java/crazypants/enderio/machine/enchanter/GuiEnchanter.java index 69c78dca..b5aaeb72 100644 --- a/src/main/java/crazypants/enderio/machine/enchanter/GuiEnchanter.java +++ b/src/main/java/crazypants/enderio/machine/enchanter/GuiEnchanter.java @@ -1,29 +1,39 @@ package crazypants.enderio.machine.enchanter; -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - -import crazypants.enderio.EnderIO; -import crazypants.enderio.gui.IconEIO; -import crazypants.enderio.machine.vacuum.ContainerVacuumChest; -import crazypants.render.ColorUtil; -import crazypants.render.RenderUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -public class GuiEnchanter extends GuiContainer { +import org.lwjgl.opengl.GL11; + +import crazypants.enderio.EnderIO; +import crazypants.enderio.gui.IconButtonEIO; +import crazypants.enderio.gui.IconEIO; +import crazypants.gui.GuiContainerBase; +import crazypants.render.RenderUtil; + +public class GuiEnchanter extends GuiContainerBase { private TileEnchanter te; private ContainerEnchanter container; + private IconButtonEIO recipeButton; public GuiEnchanter(EntityPlayer player, InventoryPlayer inventory, TileEnchanter te) { super(new ContainerEnchanter(player, inventory, te)); container = (ContainerEnchanter)inventorySlots; this.te = te; + + recipeButton = new IconButtonEIO(this, 100, 154, 8, IconEIO.RECIPE); + recipeButton.visible = false; + recipeButton.setIconMargin(3, 3); + } + + @Override + public void initGui() { + super.initGui(); + recipeButton.onGuiInit(); + recipeButton.visible = EnderIO.proxy.isNeiInstalled(); } @Override @@ -34,10 +44,6 @@ public class GuiEnchanter extends GuiContainer { int sy = (height - ySize) / 2; drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize); - if(EnderIO.proxy.isNeiInstalled()) { - IconEIO.RECIPE.renderIcon(sx + 155, sy + 8, 16, 16, 0, true); - } - int curCost = te.getCurrentEnchantmentCost(); if(curCost > 0) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -54,5 +60,4 @@ public class GuiEnchanter extends GuiContainer { drawCenteredString(Minecraft.getMinecraft().fontRenderer, s, sx + xSize/2, sy + 57, col); } } - } From 8345969bddbaad12da9d65fb692e5215d2adced4 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 11:05:43 -0400 Subject: [PATCH 15/33] Revert "#2557 only add the button tooltip to the GUI when the button had been added" This reverts commit f7b64b8d7f1d6428c954077d47aa026ec5485a3a. --- .../conduit/gui/item/BasicItemFilterGui.java | 2 +- .../crazypants/enderio/gui/IconButtonEIO.java | 21 +++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java index 7e1a4803..7daa8bcc 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java @@ -163,7 +163,7 @@ public class BasicItemFilterGui implements IItemFilterGui { } @Override - public void deactivate() { + public void deactivate() { useNbtB.detach(); useMetaB.detach(); useOreDictB.detach(); diff --git a/src/main/java/crazypants/enderio/gui/IconButtonEIO.java b/src/main/java/crazypants/enderio/gui/IconButtonEIO.java index f43a904e..747c6172 100644 --- a/src/main/java/crazypants/enderio/gui/IconButtonEIO.java +++ b/src/main/java/crazypants/enderio/gui/IconButtonEIO.java @@ -23,7 +23,6 @@ public class IconButtonEIO extends GuiButton { private int xOrigin; private int yOrigin; - protected boolean isOnGui; protected IGuiScreen gui; protected String[] toolTipText; @@ -52,11 +51,11 @@ public class IconButtonEIO extends GuiButton { } protected void setToolTip(GuiToolTip newToolTip) { - if (isOnGui && toolTip != null) { + if (toolTip != null) { gui.removeToolTip(toolTip); } toolTip = newToolTip; - if (isOnGui && toolTip != null) { + if (toolTip != null) { gui.addToolTip(toolTip); } } @@ -66,23 +65,17 @@ public class IconButtonEIO extends GuiButton { } public void onGuiInit() { - if(!isOnGui) { - gui.addButton(this); - if(toolTip != null) { - gui.addToolTip(toolTip); - } - isOnGui = true; + gui.addButton(this); + if(toolTip != null) { + gui.addToolTip(toolTip); } xPosition = xOrigin + gui.getGuiLeft(); yPosition = yOrigin + gui.getGuiTop(); } public void detach() { - if(isOnGui) { - gui.removeToolTip(toolTip); - gui.removeButton(this); - isOnGui = false; - } + gui.removeToolTip(toolTip); + gui.removeButton(this); } public void setSize(int width, int height) { From 69c39c3bb9b9dc8aced46749491b84f6701482ce Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 11:20:51 -0400 Subject: [PATCH 16/33] Better fix for tooltip issues (#2557) --- .../enderio/conduit/gui/ExternalConnectionContainer.java | 1 - .../enderio/conduit/gui/item/BasicItemFilterGui.java | 5 ++++- .../enderio/conduit/gui/item/ExistingItemFilterGui.java | 2 ++ .../enderio/conduit/gui/item/PowerItemFilterGui.java | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/gui/ExternalConnectionContainer.java b/src/main/java/crazypants/enderio/conduit/gui/ExternalConnectionContainer.java index 0476818b..60c86937 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/ExternalConnectionContainer.java +++ b/src/main/java/crazypants/enderio/conduit/gui/ExternalConnectionContainer.java @@ -113,7 +113,6 @@ public class ExternalConnectionContainer extends Container { } protected void filterChanged() { - System.out.println("filterChanged " + filterListeners.size()); for (FilterChangeListener list : filterListeners) { list.onFilterChanged(); } diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java index 7daa8bcc..7cb79c64 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java @@ -52,7 +52,6 @@ public class BasicItemFilterGui implements IItemFilterGui { this.yOffset = yOffset; this.buttonIdOffset = buttonIdOffset; - filter = filterContainer.getItemFilter(); isAdvanced = filter.isAdvanced(); @@ -119,7 +118,11 @@ public class BasicItemFilterGui implements IItemFilterGui { if(isStickyModeAvailable) { stickyB.onGuiInit(); stickyB.setSelected(activeFilter.isSticky()); + } else { + stickyB.detach(); } + } else { + stickyB.detach(); } useMetaB.onGuiInit(); diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java index 278ad914..ab45f047 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java @@ -131,6 +131,8 @@ public class ExistingItemFilterGui implements IItemFilterGui { if(!isInput) { stickyB.onGuiInit(); stickyB.setSelected(activeFilter.isSticky()); + } else { + stickyB.detach(); } useMetaB.onGuiInit(); diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java index 9515d769..ba4a6aad 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java @@ -64,6 +64,8 @@ public class PowerItemFilterGui implements IItemFilterGui { if(!isInput) { stickyB.onGuiInit(); stickyB.setSelected(filter.isSticky()); + } else { + stickyB.detach(); } int x0 = gui.getGuiLeft() + 80; From 19134e706d6967e92f9ec4251f46a087f44a078f Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 11:35:06 -0400 Subject: [PATCH 17/33] #2542 Fix painter source slot positioning --- .../assets/enderio/textures/gui/painter.png | Bin 2657 -> 66812 bytes .../machine/painter/PainterContainer.java | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/enderio/textures/gui/painter.png b/resources/assets/enderio/textures/gui/painter.png index 3c79ee023fbe8359940d0c6afcdcc99e8176c64f..d47fa20cde72c74ab47565e01b5e616a4557121f 100644 GIT binary patch literal 66812 zcmeI5`)?Fg6vt;tCZ&^2=hdBc9GA|yD(iT%OG-gO zL1kV}N&c#u;({GzgU1yunB{p@5%`Gi0 zUawd5wzi9HqA0evw|925cXV|4JNI^XcON`>(C70VK79Dd(PN|>KXIa`r{^Rsy*(%W zCwqH){eeqM=X{zy=hljO!~2#Dx96NYTJT9v_7(rKyDJwyTD|yjCI8vb#v21mZw@cJ zKC<%bbGbJ^Tr=2r==S^kcO&zEypT8g75Bqs&* z92^=N8YboJ*^!Zv^CPD(UHItw)yp@oeevL%_wL-e^Ygu5?%)6Q;cxdwM@K{G@Ym7= zKE8Uqn+V|WxvOfqO@BQ0(w)|=TS~d133JQI&g6H?8xC>YwA=LKxRsIhEjc*R=iJ6m z{5@mp^hGmreFv^_+yc&7T3mO`!TJ4x0DXpa3Tdr}_eh1*$boSe2eEFe6yh2^E=nNy zaS6!)U?urQkAw4gTm(SqlQaO5PMLl?YnH>qy9JNOO;mt>#;yOv1BjyO<&HFv0&r0P zR0Z7RV@CjPkpSR{{fmTz4FT|OB0K4Qfv5s+M*uF77d$-eeTu?{8W6Mq()mOU2n8Dg z5JlqqT%tfsz@7kt+8Fx4?wiL2ISZXKu$~v8AOhqOh6F{QUXMN8)<+V0F~d)0D|({7(hsV`vM5dZ(9J8 z{MG^x&AKRRiIOntd_cq{S}GKlWgVpSOK2OO+D4>ORtSLgg+-f7OE(u4u1_HHPs4vb zmDU0zxHNLwh~!90U_>NLP|*ZHp|xpga=m@#No9Wq_bmt@R%-=8uD2?2r3 zte83u4WQp`go{-HEGe0?ZX6mAC16zmi;5?&85aOa2P_Jpes1}OW!eFRuZ-PygK>mwwG`F_Al#{ca2qO>KRN}}_N*ICwq#e~Al7Ym#Q@V+64U7bv zUY(FRZCYmf3$Lu&trtK<6iWhFF*9S*^An%TdTST$E_qj}#F3wrgeLb$RgXpI0*&u1 ze|bjM+D0nB9sp7KEeaqgxb#Qf$=WnPCcgy%2&%7VW%4}pr0lwARfQ}b*XZTZnqf{b z+JvOk06^+-=yZc}oy38=C+0eRCBG{%V2 z>;V`d)fnCh0L-1>7<$8qOId4x;!7^s^u-8iycNxM1OT7`Fah`g zI6;g87zQqw{h zIt+=SAyN7L2>Hi-rG?Frt+7W~4~fcT5VAw+u*BFStTjL}>}i~%SULRc?^ zgow?2fZ4=Vw}-V4P~;zw6NC>?E1|JRU;=~yi|Mf69|%bQM|VoQ`0qa#5B$ek0BsHk zD#1u4Fg?Wd5Yt2IUQ+51bwy!tf^dRt0t1W!STqzI1*nTLe_;_DhfToz!qXN40K4zX zY_9=G6YGl3QW-xo_5rCBMc=ysfbA%tuUAre7c>AGz%&p_r84V#7fb*q025$28PaE$ zsk{q506qXd06u_WMktl;Oy9d0J3%c=_l&)UF#!7bq?MW9mpzcy0wnFB$_Ftt2j#2G zxeov~&k)aIp#hwOjI`D%$^SVC$2qJcJ_8G&zdCVPr)d3=46XwK5C8!X009sH0T2KI z5C8!X009sH0T2KI5C8!X009sH0T4(Ifvocv*GX#ulJi771q46<1V8`;KmY_l00ck) z1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;K)^@>MbmFqV=aJ@J%D$E00@8p2!H?x zfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2(TmINK1SAl-=V^`s5ETW;~?- i)V8y(i@`JlT4Mw!q0(m3~>$()Taw(aiJ! literal 2657 zcmeH|i8q^h7sr23B&t!%v6MlJsioBJO+%-xghuTRNr+eyhKRM6pa^+tU#3IbskOy) zlu%l&qEfBAlW06^jp0#XuU7v4xEiyblq?}`WDUZM0(015yJKy)D!#Ca?h>w+<`J#OZX z$9mbHWIAFQj@IF%V__tt2;!+knqCa?B%5@aO}DVcr@*XpT1 zJa#xQSSK&k;Bq4N7Dum+tN+YYd)(s4YZn49*QPa7w>?k4xxlpZvQhg_RypZ$9fbrz zfo5+7M$`s+ehCtZG+`LNxJO2MdU{4iMrLMKc6N47PEKxaZl0L@{DOjl(t@nYin8X$ zUs{_QMxXrH*Vi{NI5a#wGWP4BNF)-^?f?82On`EI+;cy5g1Y zk9P2m13}fEW-O#WryxkhKylO)w_r=4aP!u>hcY z9nav&7yLim*cYd0E}vz(afN6%|F~>MLCTSpx6oT!o~iKx{vzrU7QJsty<}Z-ttqFH zdEGi9q-A?Ev~^Uu^XOVMO^JZVurTp8Gpfx=msMu}b`Ii&A})EoC;{+Gk=e(aTDhIkvPMJL2Irh50)-4rLNE%DKBRg%Op@Bq2E`1`kTG7rqJY8ooY zB6#DJx0H=k-K>TJ5Ek%CuHnSCT2=;{^#f4md?L9=%i~lVro5z6F~}+82$5?i8IMub zAmij4h9-LWYS5wp4_b-m0Dpba;jn;Ow-DRYRx7Pdml18s#h`vLSdVGBhkFS|n?3}0 z9ksY+b{IYgB|=Y;8j>SALJL?Ds)JaFWpH##5O)|i&qo-_LcAJU9FFX(hA49~Tkf($ z_e&606KT+;-R~M3!;LS964i^_oWFa zty^d^>U#33(Ecs($k40fnIzskdky(p?xB=8QJ4rQAc@M+v!6F1rRw33r!vZdg|j{@ zvemFGL*q48Q3JZczgPh$@Uxv3bR)+mAw2#Zc8{-s`+(?UHaCv~v}x#q+U&Hs`ID$Wcf;x1DB!oR(Qm3HX1&dIsqW6*AeH6mCX_jm-wl0S4+&EI`kY%{3D!jE62$SJ{cZHY zgRijv5#P;JLqR-BN#~W-i(=NZonq=}tA%!OiVCm~m$-`;UHO=>F?- zhNpTlY-As_k#Hwr{;OOzVDP8^an4gz1%{qRmIEhKuWCfL8$;C^wu7y!9bw0!77%iA zwBUx7^nnV2SuK9T`Q2P>|6}c<>D%gU-Oi%Q1#RM@fY*fsQwo-;9XmYC>9utPl7WTv z@Ntf2+{v8C6;`Ans(;Gh<-JjU$WiXkg^?@rKv|$I&=BbKd&6T|OCSJYlsT*KJn6Zm zOiv&3hQ&>xcN(wL_$T9Vo7=yS9M{P%>G`}=5}ESM3`}lv^EF+%LyN|=>hNwE-N=Wk zvw^(Nq62R{H={A7w_RLSZ10qGYaqzDY&iTjUKSGT;-G6rn+&=q9*+EC(<`TE-l2VE zI(;>A@`yzvm_!b@f(gVM?>sx$D{s}%++UY@Usgzi!=d&GL?g0HqExKWLf2N~W6{Qp z1Y_aOk44j4(rulVRJ0;MLWTk%C2&fasoU>Vbd9n2%?YC{V;`-!y;4SnFe$3&PsyaH zW}*3nz2t zpL@rq?>@lQ8D=D#-M0j;^*GxC6_t5>#)(M2Ko!I#m3{F2Ug zGJKL`R6quvopXp@a2^ Date: Fri, 12 Jun 2015 11:46:23 -0400 Subject: [PATCH 18/33] Third time's the charm, even better fix for #2557 --- .../enderio/conduit/gui/item/BasicItemFilterGui.java | 4 ---- .../enderio/conduit/gui/item/ExistingItemFilterGui.java | 2 -- .../enderio/conduit/gui/item/PowerItemFilterGui.java | 2 -- src/main/java/crazypants/enderio/gui/IconButtonEIO.java | 6 +++--- src/main/java/crazypants/gui/GuiContainerBase.java | 4 ++-- src/main/java/crazypants/gui/GuiScreenBase.java | 4 ++-- src/main/java/crazypants/gui/IGuiScreen.java | 2 +- src/main/java/crazypants/gui/ToolTipManager.java | 4 ++-- 8 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java index 7cb79c64..db4562aa 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/BasicItemFilterGui.java @@ -118,11 +118,7 @@ public class BasicItemFilterGui implements IItemFilterGui { if(isStickyModeAvailable) { stickyB.onGuiInit(); stickyB.setSelected(activeFilter.isSticky()); - } else { - stickyB.detach(); } - } else { - stickyB.detach(); } useMetaB.onGuiInit(); diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java index ab45f047..278ad914 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/ExistingItemFilterGui.java @@ -131,8 +131,6 @@ public class ExistingItemFilterGui implements IItemFilterGui { if(!isInput) { stickyB.onGuiInit(); stickyB.setSelected(activeFilter.isSticky()); - } else { - stickyB.detach(); } useMetaB.onGuiInit(); diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java b/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java index ba4a6aad..9515d769 100644 --- a/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java +++ b/src/main/java/crazypants/enderio/conduit/gui/item/PowerItemFilterGui.java @@ -64,8 +64,6 @@ public class PowerItemFilterGui implements IItemFilterGui { if(!isInput) { stickyB.onGuiInit(); stickyB.setSelected(filter.isSticky()); - } else { - stickyB.detach(); } int x0 = gui.getGuiLeft() + 80; diff --git a/src/main/java/crazypants/enderio/gui/IconButtonEIO.java b/src/main/java/crazypants/enderio/gui/IconButtonEIO.java index 747c6172..6ecb61c3 100644 --- a/src/main/java/crazypants/enderio/gui/IconButtonEIO.java +++ b/src/main/java/crazypants/enderio/gui/IconButtonEIO.java @@ -37,7 +37,6 @@ public class IconButtonEIO extends GuiButton { texture = IconEIO.TEXTURE; this.xOrigin = x; this.yOrigin = y; - } public void setToolTip(String... tooltipText) { @@ -51,11 +50,12 @@ public class IconButtonEIO extends GuiButton { } protected void setToolTip(GuiToolTip newToolTip) { + boolean addTooltip = false; if (toolTip != null) { - gui.removeToolTip(toolTip); + addTooltip = gui.removeToolTip(toolTip); } toolTip = newToolTip; - if (toolTip != null) { + if (addTooltip && toolTip != null) { gui.addToolTip(toolTip); } } diff --git a/src/main/java/crazypants/gui/GuiContainerBase.java b/src/main/java/crazypants/gui/GuiContainerBase.java index bb4e07f3..631bb956 100644 --- a/src/main/java/crazypants/gui/GuiContainerBase.java +++ b/src/main/java/crazypants/gui/GuiContainerBase.java @@ -455,8 +455,8 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe } @Override - public void removeToolTip(GuiToolTip toolTip) { - ttMan.removeToolTip(toolTip); + public boolean removeToolTip(GuiToolTip toolTip) { + return ttMan.removeToolTip(toolTip); } protected void drawForegroundImpl(int mouseX, int mouseY) { diff --git a/src/main/java/crazypants/gui/GuiScreenBase.java b/src/main/java/crazypants/gui/GuiScreenBase.java index 941fa352..d6aa4943 100644 --- a/src/main/java/crazypants/gui/GuiScreenBase.java +++ b/src/main/java/crazypants/gui/GuiScreenBase.java @@ -47,8 +47,8 @@ public abstract class GuiScreenBase extends GuiScreen implements ToolTipRenderer } @Override - public void removeToolTip(GuiToolTip toolTip) { - ttMan.removeToolTip(toolTip); + public boolean removeToolTip(GuiToolTip toolTip) { + return ttMan.removeToolTip(toolTip); } @Override diff --git a/src/main/java/crazypants/gui/IGuiScreen.java b/src/main/java/crazypants/gui/IGuiScreen.java index fdff6f91..55b5e004 100644 --- a/src/main/java/crazypants/gui/IGuiScreen.java +++ b/src/main/java/crazypants/gui/IGuiScreen.java @@ -7,7 +7,7 @@ public interface IGuiScreen { void addToolTip(GuiToolTip toolTip); - void removeToolTip(GuiToolTip toolTip); + boolean removeToolTip(GuiToolTip toolTip); int getGuiLeft(); diff --git a/src/main/java/crazypants/gui/ToolTipManager.java b/src/main/java/crazypants/gui/ToolTipManager.java index ba19321e..9712e3f2 100644 --- a/src/main/java/crazypants/gui/ToolTipManager.java +++ b/src/main/java/crazypants/gui/ToolTipManager.java @@ -28,8 +28,8 @@ public class ToolTipManager { } } - public void removeToolTip(GuiToolTip toolTip) { - toolTips.remove(toolTip); + public boolean removeToolTip(GuiToolTip toolTip) { + return toolTips.remove(toolTip); } protected final void drawTooltips(ToolTipRenderer renderer, int mouseX, int mouseY) { From 70080d9acf4efc2f08cbdcd1304ba180e499eea1 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 11:56:07 -0400 Subject: [PATCH 19/33] Fix power monitor automatically focusing on an invisible text box --- .../crazypants/enderio/machine/monitor/GuiPowerMonitor.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/monitor/GuiPowerMonitor.java b/src/main/java/crazypants/enderio/machine/monitor/GuiPowerMonitor.java index e7ccaa52..581d592f 100644 --- a/src/main/java/crazypants/enderio/machine/monitor/GuiPowerMonitor.java +++ b/src/main/java/crazypants/enderio/machine/monitor/GuiPowerMonitor.java @@ -109,7 +109,6 @@ public class GuiPowerMonitor extends GuiContainerBase { startTF = new TextFieldEIO(getFontRenderer(), x, y, 28, 14); startTF.setCanLoseFocus(true); startTF.setMaxStringLength(3); - startTF.setFocused(true); startTF.setVisible(false); startTF.setText(INT_NF.format(te.asPercentInt(te.startLevel))); @@ -118,7 +117,6 @@ public class GuiPowerMonitor extends GuiContainerBase { endTF = new TextFieldEIO(getFontRenderer(), x, y, 28, 14); endTF.setCanLoseFocus(true); endTF.setMaxStringLength(3); - endTF.setFocused(false); endTF.setVisible(false); endTF.setText(INT_NF.format(te.asPercentInt(te.stopLevel))); From d98be8dd86e02b7ed40419ae01db27ee58063b7e Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 14:35:12 -0400 Subject: [PATCH 20/33] Massive recipe cleanup, everything should use oredict properly now --- src/main/java/crazypants/enderio/EnderIO.java | 12 +- .../enderio/conduit/ConduitRecipes.java | 78 +++--- .../enderio/enderface/EnderfaceRecipes.java | 8 +- .../crazypants/enderio/item/ItemRecipes.java | 63 +++-- .../enderio/machine/MachineRecipes.java | 222 ++++++++---------- .../crazypants/enderio/material/Alloy.java | 28 ++- .../enderio/material/MachinePart.java | 15 +- .../crazypants/enderio/material/Material.java | 10 + .../enderio/material/MaterialRecipes.java | 158 ++++++------- .../enderio/thaumcraft/ThaumcraftCompat.java | 26 +- src/main/java/crazypants/util/RecipeUtil.java | 35 +++ 11 files changed, 338 insertions(+), 317 deletions(-) create mode 100644 src/main/java/crazypants/util/RecipeUtil.java diff --git a/src/main/java/crazypants/enderio/EnderIO.java b/src/main/java/crazypants/enderio/EnderIO.java index d59cfc33..b0f10737 100644 --- a/src/main/java/crazypants/enderio/EnderIO.java +++ b/src/main/java/crazypants/enderio/EnderIO.java @@ -566,13 +566,15 @@ public class EnderIO { SkeletonHandler.registerSkeleton(this); } + MaterialRecipes.registerDependantOresInDictionary(); + EnderfaceRecipes.addRecipes(); MaterialRecipes.addRecipes(); ConduitRecipes.addRecipes(); MachineRecipes.addRecipes(); ItemRecipes.addRecipes(); TeleportRecipes.addRecipes(); - + proxy.load(); } @@ -583,16 +585,10 @@ public class EnderIO { //Regsiter the enchants Enchantments.getInstance(); - - MaterialRecipes.registerDependantOresInDictionary(); - + //This must be loaded before parsing the recipes so we get the preferred outputs OreDictionaryPreferences.loadConfig(); - MaterialRecipes.addOreDictionaryRecipes(); - MachineRecipes.addOreDictionaryRecipes(); - ItemRecipes.addOreDictionaryRecipes(); - CrusherRecipeManager.getInstance().loadRecipesFromConfig(); AlloyRecipeManager.getInstance().loadRecipesFromConfig(); SliceAndSpliceRecipeManager.getInstance().loadRecipesFromConfig(); diff --git a/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java b/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java index 375c9720..eea50252 100644 --- a/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java +++ b/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java @@ -16,11 +16,14 @@ import crazypants.enderio.conduit.item.filter.CopyFilterRecipe; import crazypants.enderio.conduit.me.MEUtil; import crazypants.enderio.config.Config; import crazypants.enderio.machine.MachineRecipeRegistry; -import crazypants.enderio.material.Alloy; import crazypants.enderio.material.BlockFusedQuartz; import crazypants.enderio.material.FrankenSkull; import crazypants.enderio.material.Material; -import static crazypants.enderio.ModObject.*; + +import static crazypants.enderio.ModObject.blockPainter; +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.*; +import static crazypants.util.RecipeUtil.addShaped; public class ConduitRecipes { @@ -28,62 +31,61 @@ public class ConduitRecipes { //Crafting Components ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 0); - ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal()); ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); ItemStack fusedGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.GLASS.ordinal()); - ItemStack conductiveIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal()); - ItemStack energeticGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()); - ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal()); - ItemStack redstoneAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); + String electricalSteel = ELECTRICAL_STEEL.oreIngot; + String phasedGold = PHASED_GOLD.oreIngot; + String conductiveIron = CONDUCTIVE_IRON.oreIngot; + String energeticGold = ENERGETIC_ALLOY.oreIngot; + String phasedIronNugget = PHASED_IRON_NUGGET.oreDict; + String redstoneAlloy = REDSTONE_ALLOY.oreIngot; + + String binder = CONDUIT_BINDER.oreDict; + ItemStack zombieController = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()); //Recipes - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.BASIC.ordinal()), "bbb", "b b", "bbb", 'b', conduitBinder); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()), " o ", "oFo", " o ", 'F', EnderIO.itemConduitFacade, 'o', "dustObsidian")); + addShaped(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.BASIC.ordinal()), "bbb", "b b", "bbb", 'b', binder); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()), " o ", "oFo", " o ", 'F', + EnderIO.itemConduitFacade, 'o', "dustObsidian")); int numConduits = Config.numConduitsPerRecipe; - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 0), "bbb", "###", "bbb", 'b', conduitBinder, '#', fusedGlass); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 1), "bbb", "###", "bbb", 'b', conduitBinder, '#', fusedQuartz); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 2), "bbb", "#p#", "bbb", 'b', conduitBinder, '#', fusedQuartz, 'p', phasedGold); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 0), "bbb", "###", "bbb", 'b', conduitBinder, '#', conductiveIron); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 1), "bbb", "###", "bbb", 'b', conduitBinder, '#', energeticGold); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedGold); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 0), "###", '#', redstoneAlloy); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, 1, 1), "lbl", "bcb", "lbl", 'b', conduitBinder, 'c', redstoneConduit, 'l', - Blocks.lever); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#', - redstoneAlloy); + addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 0), "bbb", "###", "bbb", 'b', binder, '#', fusedGlass); + addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 1), "bbb", "###", "bbb", 'b', binder, '#', fusedQuartz); + addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 2), "bbb", "#p#", "bbb", 'b', binder, '#', fusedQuartz, 'p', phasedGold); + addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 0), "bbb", "###", "bbb", 'b', binder, '#', conductiveIron); + addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 1), "bbb", "###", "bbb", 'b', binder, '#', energeticGold); + addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 2), "bbb", "###", "bbb", 'b', binder, '#', phasedGold); + addShaped(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 0), "###", '#', redstoneAlloy); + addShaped(new ItemStack(EnderIO.itemRedstoneConduit, 1, 1), "lbl", "bcb", "lbl", 'b', binder, 'c', redstoneConduit, 'l', Blocks.lever); + addShaped(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', binder, '#', redstoneAlloy); if (GasUtil.isGasConduitEnabled()) { - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', conduitBinder, '#', electricalSteel, 'g', - fusedGlass); + addShaped(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', binder, '#', electricalSteel, 'g', fusedGlass); } ItemStack itemConduit = new ItemStack(EnderIO.itemItemConduit, numConduits, 0); - GameRegistry.addShapedRecipe(itemConduit, "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedIronNugget); + addShaped(itemConduit, "bbb", "###", "bbb", 'b', binder, '#', phasedIronNugget); MachineRecipeRegistry.instance.registerRecipe(blockPainter.unlocalisedName, EnderIO.itemConduitFacade.new FacadePainterRecipe()); //Filter Recipes ItemStack basicFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 0); - GameRegistry.addShapedRecipe(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper); + addShaped(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper); ItemStack advFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 1); - GameRegistry.addRecipe(new ShapedOreRecipe(advFilter, "rpr", "pzp", "rpr", 'p', Items.paper, 'z', zombieController, 'r', Items.redstone)); + addShaped(advFilter, "rpr", "pzp", "rpr", 'p', Items.paper, 'z', zombieController, 'r', "dustRedstone"); ItemStack modFilter = new ItemStack(EnderIO.itemModItemFilter, 1, 0); - GameRegistry.addShapedRecipe(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench); + addShaped(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench); ItemStack exFilt = new ItemStack(EnderIO.itemExistingItemFilter); - GameRegistry.addShapedRecipe(exFilt, " r ", "rfr", " c ", 'c', new ItemStack(Items.comparator, 1, 0), 'r', Items.redstone, 'f', advFilter); + addShaped(exFilt, " r ", "rfr", " c ", 'c', new ItemStack(Items.comparator, 1, 0), 'r', "dustRedstone", 'f', advFilter); ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter); - GameRegistry.addShapedRecipe(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe); + addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe); ClearFilterRecipe clearRec = new ClearFilterRecipe(); MinecraftForge.EVENT_BUS.register(clearRec); @@ -93,11 +95,11 @@ public class ConduitRecipes { GameRegistry.addRecipe(copyRec); ItemStack speedUpgrade = new ItemStack(EnderIO.itemExtractSpeedUpgrade, 1, 0); - GameRegistry.addShapedRecipe(speedUpgrade, "iii","epe","ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', Items.iron_ingot); + addShaped(speedUpgrade, "iii", "epe", "ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', "ingotIron"); ItemStack speedDowngrade = new ItemStack(EnderIO.itemExtractSpeedUpgrade, 1, 1); - GameRegistry.addRecipe(new ShapedOreRecipe(speedDowngrade, "iii","ese","ete", 's', "slimeball", 'e', electricalSteel, 't', "stickWood", 'i', Items.iron_ingot)); - GameRegistry.addRecipe(new ShapedOreRecipe(speedDowngrade, "iii","ese","ete", 's', "slimeball", 'e', electricalSteel, 't', "woodStick", 'i', Items.iron_ingot)); + addShaped(speedDowngrade, "iii", "ese", "ete", 's', "slimeball", 'e', electricalSteel, 't', "stickWood", 'i', "ingotIron"); + addShaped(speedDowngrade, "iii", "ese", "ete", 's', "slimeball", 'e', electricalSteel, 't', "woodStick", 'i', "ingotIron"); if (MEUtil.isMEEnabled()) { addAeRecipes(); @@ -108,15 +110,15 @@ public class ConduitRecipes { private static void addAeRecipes() { String fluix = "crystalFluix"; String pureFluix = "crystalPureFluix"; - + ItemStack quartzFiber = AEApi.instance().parts().partQuartzFiber.stack(1).copy(); ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal()); ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2); - GameRegistry.addRecipe(new ShapedOreRecipe(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', fluix, 'q', quartzFiber)); - GameRegistry.addRecipe(new ShapedOreRecipe(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber)); + addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', fluix, 'q', quartzFiber); + addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber); res.stackSize = 1; - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res)); + addShaped(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res); } } diff --git a/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java b/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java index 8033c457..14877eda 100644 --- a/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java +++ b/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java @@ -2,19 +2,17 @@ package crazypants.enderio.enderface; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; import crazypants.enderio.material.Alloy; +import crazypants.util.RecipeUtil; public class EnderfaceRecipes { public static void addRecipes() { - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - GameRegistry.addRecipe(new ItemStack(EnderIO.blockEnderIo), "sqs", "qeq", "sqs", 's', electricalSteel, 'q', fusedQuartz, 'e', new ItemStack( - Items.ender_eye)); + String electricalSteel = Alloy.ELECTRICAL_STEEL.oreIngot; + RecipeUtil.addShaped(new ItemStack(EnderIO.blockEnderIo), "sqs", "qeq", "sqs", 's', electricalSteel, 'q', fusedQuartz, 'e', new ItemStack(Items.ender_eye)); } } diff --git a/src/main/java/crazypants/enderio/item/ItemRecipes.java b/src/main/java/crazypants/enderio/item/ItemRecipes.java index 9b6e2d81..9e1a0bd6 100644 --- a/src/main/java/crazypants/enderio/item/ItemRecipes.java +++ b/src/main/java/crazypants/enderio/item/ItemRecipes.java @@ -7,64 +7,63 @@ import net.minecraftforge.oredict.ShapedOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; import crazypants.enderio.item.darksteel.DarkSteelItems; -import crazypants.enderio.material.Alloy; import crazypants.enderio.material.MachinePart; -import crazypants.enderio.material.Material; + +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.VIBRANT_CYSTAL; +import static crazypants.util.RecipeUtil.addShaped; public class ItemRecipes { public static void addRecipes() { ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack conductiveIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal()); - ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()); - ItemStack vibAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack enAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); - ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal()); + String electricalSteel = ELECTRICAL_STEEL.oreIngot; + String conductiveIron = CONDUCTIVE_IRON.oreIngot; + String vibCry = VIBRANT_CYSTAL.oreDict; + String enAlloy = ENERGETIC_ALLOY.oreIngot; + String darkSteel = DARK_STEEL.oreIngot; + String soularium = SOULARIUM.oreIngot; // Wrench ItemStack wrench = new ItemStack(EnderIO.itemYetaWench, 1, 0); - GameRegistry.addShapedRecipe(wrench, "s s", " b ", " s ", 's', electricalSteel, 'b', basicGear); + addShaped(wrench, "s s", " b ", " s ", 's', electricalSteel, 'b', basicGear); //Magnet ItemStack magnet = new ItemStack(EnderIO.itemMagnet, 1, 0); EnderIO.itemMagnet.setEnergy(magnet, 0); - GameRegistry.addShapedRecipe(magnet, "scc", " v", "scc", 's', electricalSteel, 'c', conductiveIron, 'v', vibCry); + addShaped(magnet, "scc", " v", "scc", 's', electricalSteel, 'c', conductiveIron, 'v', vibCry); //Dark Steel - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelHelmet.createItemStack(), "sss", "s s", 's', darkSteel); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelBoots.createItemStack(), "s s", "s s", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelHelmet.createItemStack(), "sss", "s s", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelBoots.createItemStack(), "s s", "s s", 's', darkSteel); - ItemStack wing = new ItemStack(DarkSteelItems.itemGliderWing,1,0); - GameRegistry.addShapedRecipe(wing, " s", " sl", "sll", 's', darkSteel, 'l', Items.leather); - GameRegistry.addShapedRecipe(new ItemStack(DarkSteelItems.itemGliderWing,1,1), " s ", "wsw", " ", 's', darkSteel, 'w', wing); + ItemStack wing = new ItemStack(DarkSteelItems.itemGliderWing, 1, 0); + addShaped(wing, " s", " sl", "sll", 's', darkSteel, 'l', Items.leather); + addShaped(new ItemStack(DarkSteelItems.itemGliderWing, 1, 1), " s ", "wsw", " ", 's', darkSteel, 'w', wing); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelShears.createItemStack(), " s", "s ", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelShears.createItemStack(), " s", "s ", 's', darkSteel); ItemStack dspp = new ItemStack(EnderIO.blockDarkSteelPressurePlate); - GameRegistry.addShapedRecipe(dspp, "ss", 's', darkSteel); + addShaped(dspp, "ss", 's', darkSteel); ItemStack dsppSilent = new ItemStack(EnderIO.blockDarkSteelPressurePlate, 1, 1); GameRegistry.addShapedRecipe(dsppSilent, "p", "w", 'p', dspp, 'w', Blocks.wool); //Soul Vessel - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack(EnderIO.blockFusedQuartz,1,0)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack( + EnderIO.blockFusedQuartz, 1, 0))); //XP Rod - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemXpTransfer), " s", " v ", "s ", 's', soularium, 'v', enAlloy); + addShaped(new ItemStack(EnderIO.itemXpTransfer), " s", " v ", "s ", 's', soularium, 'v', enAlloy); - } - - public static void addOreDictionaryRecipes() { - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "woodStick")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "woodStick")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "woodStick")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "stickWood")); + // DS Tools + addShaped(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "stickWood"); + addShaped(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "woodStick"); + addShaped(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "stickWood"); + addShaped(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "woodStick"); + addShaped(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "woodStick"); + addShaped(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "stickWood"); } } diff --git a/src/main/java/crazypants/enderio/machine/MachineRecipes.java b/src/main/java/crazypants/enderio/machine/MachineRecipes.java index 1631dcfd..c0d3aeae 100644 --- a/src/main/java/crazypants/enderio/machine/MachineRecipes.java +++ b/src/main/java/crazypants/enderio/machine/MachineRecipes.java @@ -1,11 +1,9 @@ package crazypants.enderio.machine; -import static crazypants.enderio.EnderIO.itemBasicCapacitor; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; @@ -17,132 +15,131 @@ import crazypants.enderio.machine.capbank.BlockItemCapBank; import crazypants.enderio.machine.capbank.CapBankType; import crazypants.enderio.machine.capbank.ConvertOldRecipe; import crazypants.enderio.machine.light.BlockItemElectricLight; -import crazypants.enderio.material.Alloy; import crazypants.enderio.material.FrankenSkull; import crazypants.enderio.material.MachinePart; import crazypants.enderio.material.Material; import crazypants.enderio.power.Capacitors; +import static crazypants.enderio.EnderIO.itemBasicCapacitor; +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.*; +import static crazypants.util.RecipeUtil.*; + public class MachineRecipes { public static void addRecipes() { //Common ingredients - ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 4, Material.CONDUIT_BINDER.ordinal()); ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); ItemStack capacitor2 = new ItemStack(itemBasicCapacitor, 1, 1); ItemStack capacitor3 = new ItemStack(itemBasicCapacitor, 1, 2); ItemStack enderCapacitor = new ItemStack(itemBasicCapacitor, 1, Capacitors.ENDER_CAPACITOR.ordinal()); - ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); - ItemStack machineChassi = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); - ItemStack silicon = new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal()); - ItemStack pulCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal()); - ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()); - ItemStack endCry = new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal()); - ItemStack electricSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()); - ItemStack energeticAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); + String basicGear = MachinePart.BASIC_GEAR.oreDict; + String machineChassi = MachinePart.MACHINE_CHASSI.oreDict; ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); - ItemStack clearGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, 1); ItemStack enlightedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 2); - ItemStack fusedGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, 1); - ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal()); ItemStack zombieController = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()); ItemStack frankenZombie = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal()); ItemStack enderRes = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ENDER_RESONATOR.ordinal()); ItemStack sentientEnder = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.SENTIENT_ENDER.ordinal()); ItemStack obsidian = new ItemStack(Blocks.obsidian); + String electricalSteel = ELECTRICAL_STEEL.oreIngot; + String darkSteel = DARK_STEEL.oreIngot; + String energeticAlloy = ENERGETIC_ALLOY.oreIngot; + String phasedGold = PHASED_GOLD.oreIngot; + String phasedIron = PHASED_IRON.oreIngot; + String soularium = SOULARIUM.oreIngot; + + String vibCry = VIBRANT_CYSTAL.oreDict; + String pulCry = PULSATING_CYSTAL.oreDict; + String endCry = ENDER_CRYSTAL.oreDict; + String binder = CONDUIT_BINDER.oreDict; + String silicon = SILICON.oreDict; + //stirling gen ItemStack stirlingGen = new ItemStack(EnderIO.blockStirlingGenerator, 1, 0); - GameRegistry.addShapedRecipe(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear); + addShaped(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear); //Combustion Gen ItemStack res = new ItemStack(EnderIO.blockTank, 1, 0); ItemStack comGen = new ItemStack(EnderIO.blockCombustionGenerator, 1, 0); - GameRegistry.addShapedRecipe(comGen, "eee", "rmr", "gpg", 'e', electricSteel, 'r', res, 'm', machineChassi, 'g', basicGear, 'p', Blocks.piston); + addShaped(comGen, "eee", "rmr", "gpg", 'e', electricalSteel, 'r', res, 'm', machineChassi, 'g', basicGear, 'p', Blocks.piston); //ZombieGen ItemStack zg = new ItemStack(EnderIO.blockZombieGenerator, 1, 0); - GameRegistry.addShapedRecipe(zg, "eee", "qzq", "qqq", 'e', electricSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 0)); + addShaped(zg, "eee", "qzq", "qqq", 'e', electricalSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 0)); //KillerJoe ItemStack kj = new ItemStack(EnderIO.blockKillerJoe, 1, 0); - GameRegistry.addShapedRecipe(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie); + addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie); //Wireless charger ItemStack wirelessCharger = new ItemStack(EnderIO.blockWirelessCharger); - //GameRegistry.addShapedRecipe(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry); - GameRegistry.addShapedRecipe(wirelessCharger, "sss", "ses", "scs", 's', electricSteel, 'c', capacitor3, 'e', enderRes); + //addShaped(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry); + addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes); //Crafter ItemStack crafter = new ItemStack(EnderIO.blockCrafter, 1, 0); - GameRegistry.addShapedRecipe(crafter, "iti", "imi", "izi", 'i', Items.iron_ingot, 't', Blocks.crafting_table, 'm', machineChassi, 'z', zombieController); + addShaped(crafter, "iti", "imi", "izi", 'i', Items.iron_ingot, 't', Blocks.crafting_table, 'm', machineChassi, 'z', zombieController); //Powered Spawner ItemStack poweredSpawner = new ItemStack(EnderIO.blockPoweredSpawner); ItemStack zombieBit; - if(Config.useHardRecipes) { + if (Config.useHardRecipes) { zombieBit = frankenZombie; } else { zombieBit = zombieController; } - GameRegistry.addRecipe(new ShapedOreRecipe(poweredSpawner, "ese", "eme", "vzv", 'e', electricSteel, 's', "itemSkull", 'v', vibCry, 'm', machineChassi, 'z', - zombieBit)); + addShaped(poweredSpawner, "ese", "eme", "vzv", 'e', electricalSteel, 's', "itemSkull", 'v', vibCry, 'm', machineChassi, 'z', zombieBit); - if(Config.reservoirEnabled) { + if (Config.reservoirEnabled) { //reservoir ItemStack reservoir = new ItemStack(EnderIO.blockReservoir, 2, 0); Object glassSides; - if(Config.useHardRecipes) { + if (Config.useHardRecipes) { glassSides = "blockGlassHardened"; } else { glassSides = "glass"; } - GameRegistry.addRecipe(new ShapedOreRecipe(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz)); + addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz); } //Tanks ItemStack basicTank = new ItemStack(EnderIO.blockTank, 1, 0); - GameRegistry.addRecipe(new ShapedOreRecipe(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', Items.iron_ingot, 'b', Blocks.iron_bars)); + addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', Items.iron_ingot, 'b', Blocks.iron_bars); ItemStack advTank = new ItemStack(EnderIO.blockTank, 1, 1); - GameRegistry.addRecipe(new ShapedOreRecipe(advTank, "ibi", "bgb", "ibi", 'g', "blockGlassHardened", 'i', darkSteel, 'b', EnderIO.blockDarkIronBars)); + addShaped(advTank, "ibi", "bgb", "ibi", 'g', "blockGlassHardened", 'i', darkSteel, 'b', EnderIO.blockDarkIronBars); //mill ItemStack crusher = new ItemStack(EnderIO.blockCrusher, 1, 0); - if(Config.useHardRecipes) { - GameRegistry.addShapedRecipe(crusher, "ooo", "fmf", "pip", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', - Blocks.piston, - 'o', Blocks.obsidian); + if (Config.useHardRecipes) { + addShaped(crusher, "ooo", "fmf", "pip", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston, 'o', Blocks.obsidian); } else { - GameRegistry.addShapedRecipe(crusher, "fff", "imi", "ipi", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston); + addShaped(crusher, "fff", "imi", "ipi", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston); } //alloy smelter ItemStack alloySmelter = new ItemStack(EnderIO.blockAlloySmelter, 1, 0); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Blocks.iron_block, 'f', - Blocks.furnace)); + if (Config.useHardRecipes) { + addShaped(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Blocks.iron_block, 'f', Blocks.furnace); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Items.iron_ingot, 'f', - Blocks.furnace)); + addShaped(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Items.iron_ingot, 'f', Blocks.furnace); } //Vat ItemStack still = new ItemStack(EnderIO.blockVat, 1, 0); - GameRegistry.addShapedRecipe(still, "eve", "tmt", "efe", 'v', Items.cauldron, 'm', machineChassi, 'e', electricSteel, 'f', Blocks.furnace, 't', basicTank); + addShaped(still, "eve", "tmt", "efe", 'v', Items.cauldron, 'm', machineChassi, 'e', electricalSteel, 'f', Blocks.furnace, 't', basicTank); //capacitor bank ItemStack capBank1 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.SIMPLE), 0); - GameRegistry.addShapedRecipe(capBank1, "bcb", "cmc", "bcb", 'b', Items.iron_ingot, 'c', capacitor, 'm', Blocks.redstone_block); + addShaped(capBank1, "bcb", "cmc", "bcb", 'b', Items.iron_ingot, 'c', capacitor, 'm', Blocks.redstone_block); ItemStack capBank2 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.ACTIVATED), 0); - GameRegistry.addShapedRecipe(capBank2, "bcb", "cmc", "bcb", 'b', electricSteel, 'c', capacitor2, 'm', Blocks.redstone_block); + addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', Blocks.redstone_block); ItemStack capBank3 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.VIBRANT), 0); - GameRegistry.addShapedRecipe(capBank3, "bcb", "cmc", "bcb", 'b', electricSteel, 'c', capacitor3, 'm', vibCry); + addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry); ConvertOldRecipe convertRecipe = new ConvertOldRecipe(); GameRegistry.addRecipe(convertRecipe); @@ -152,54 +149,46 @@ public class MachineRecipes { //painter ItemStack painter = new ItemStack(EnderIO.blockPainter, 1, 0); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qqq", "mdm", "mMm", 'm', electricSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, - 'd', Items.diamond)); + if (Config.useHardRecipes) { + addShaped(painter, "qqq", "mdm", "mMm", 'm', electricalSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, 'd', Items.diamond); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qdq", "mMm", "mmm", 'm', electricSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, - 'd', Items.diamond)); + addShaped(painter, "qdq", "mMm", "mmm", 'm', electricalSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, 'd', Items.diamond); } //Farm ItemStack farm = new ItemStack(EnderIO.blockFarmStation, 1, 0); - if(Config.useHardRecipes) { + if (Config.useHardRecipes) { zombieBit = frankenZombie; } else { zombieBit = zombieController; } - GameRegistry.addShapedRecipe(farm, "ehe", "eme", "pzp", 'h', Items.diamond_hoe, 'm', machineChassi, 'e', electricSteel, 'z', zombieController, 'p', pulCry); + addShaped(farm, "ehe", "eme", "pzp", 'h', Items.diamond_hoe, 'm', machineChassi, 'e', electricalSteel, 'z', zombieController, 'p', pulCry); - if(Config.transceiverEnabled) { + if (Config.transceiverEnabled) { //transceiver ItemStack transceiver = new ItemStack(EnderIO.blockTransceiver, 1, 0); - if(Config.transceiverUseEasyRecipe) { - GameRegistry - .addShapedRecipe(transceiver, "oeo", "pdp", "oco", 'o', obsidian, 'e', Items.ender_eye, 'c', enderCapacitor, 'p', phasedGold, 'd', Items.diamond); + if (Config.transceiverUseEasyRecipe) { + addShaped(transceiver, "oeo", "pdp", "oco", 'o', obsidian, 'e', Items.ender_eye, 'c', enderCapacitor, 'p', phasedGold, 'd', + Items.diamond); } else { - GameRegistry - .addShapedRecipe(transceiver, "oeo", "pdp", "oco", 'o', electricSteel, 'e', enderRes, 'c', enderCapacitor, 'p', fusedQuartz, 'd', endCry); - GameRegistry.addShapelessRecipe(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0)); + addShaped(transceiver, "oeo", "pdp", "oco", 'o', electricalSteel, 'e', enderRes, 'c', enderCapacitor, 'p', fusedQuartz, 'd', endCry); + addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0)); } } //solar panel - if(Config.photovoltaicCellEnabled) { + if (Config.photovoltaicCellEnabled) { ItemStack solarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 0); ItemStack advSolarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 1); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'c', capacitor, - 'e', - energeticAlloy, 'p', phasedGold)); - GameRegistry.addRecipe(new ShapedOreRecipe(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'c', capacitor2, - 'e', - phasedIron, 'p', phasedGold)); + if (Config.useHardRecipes) { + addShaped(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'c', capacitor, 'e', energeticAlloy, 'p', + phasedGold); + addShaped(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'c', capacitor2, 'e', phasedIron, 'p', phasedGold); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'p', silicon, - 'e', - energeticAlloy, 'c', electricSteel)); - GameRegistry.addRecipe(new ShapedOreRecipe(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'p', vibCry, 'e', - phasedGold, 'c', phasedIron)); + addShaped(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'p', silicon, 'e', energeticAlloy, 'c', + electricalSteel); + addShaped(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'p', vibCry, 'e', phasedGold, 'c', phasedIron); } } @@ -208,20 +197,19 @@ public class MachineRecipes { ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0); ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2); ItemStack mJMonitor = new ItemStack(EnderIO.blockPowerMonitor, 1, 0); - GameRegistry.addShapedRecipe(mJMonitor, "sms", "sMs", "sps", 's', electricSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit, - 'r', redstoneConduit); + addShaped(mJMonitor, "sms", "sMs", "sps", 's', electricalSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit, 'r', redstoneConduit); //Enchanter ItemStack enchanter = new ItemStack(EnderIO.blockEnchanter); - GameRegistry.addShapedRecipe(enchanter, "dbd", "sss", " s ", 'd', Items.diamond, 'b', Items.book, 's', darkSteel); + addShaped(enchanter, "dbd", "sss", " s ", 'd', Items.diamond, 'b', Items.book, 's', darkSteel); //Vacuum Chest ItemStack vacuumChest = new ItemStack(EnderIO.blockVacuumChest); - GameRegistry.addShapedRecipe(vacuumChest, "iii", "ici", "ipi", 'i', Items.iron_ingot, 'c', Blocks.chest, 'p', pulCry); + addShaped(vacuumChest, "iii", "ici", "ipi", 'i', Items.iron_ingot, 'c', Blocks.chest, 'p', pulCry); //Soul Binder - ItemStack enderBit; - if(Config.soulBinderRequiresEndermanSkull) { + Object enderBit; + if (Config.soulBinderRequiresEndermanSkull) { enderBit = new ItemStack(EnderIO.blockEndermanSkull); } else { enderBit = pulCry; @@ -230,29 +218,28 @@ public class MachineRecipes { ItemStack zombieSkull = new ItemStack(Items.skull, 1, 4); ItemStack skeletonSkull = new ItemStack(Items.skull, 1, 0); ItemStack soulBinder = new ItemStack(EnderIO.blockSoulFuser); - GameRegistry.addShapedRecipe(soulBinder, "ses", "zmc", "sks", 's', soularium, 'm', machineChassi, 'e', enderBit, 'z', zombieSkull, 'c', creeperSkull, 'k', - skeletonSkull); + addShaped(soulBinder, "ses", "zmc", "sks", 's', soularium, 'm', machineChassi, 'e', enderBit, 'z', zombieSkull, 'c', creeperSkull, 'k', skeletonSkull); //Attractor ItemStack attractor = new ItemStack(EnderIO.blockAttractor); ItemStack attractorCrystal = new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()); - GameRegistry.addShapedRecipe(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy); + addShaped(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy); //Aversion ItemStack aversion = new ItemStack(EnderIO.blockSpawnGuard); ItemStack tormentedEnderman = new ItemStack(EnderIO.blockEndermanSkull, 1, BlockEndermanSkull.SkullType.TORMENTED.ordinal()); - GameRegistry.addShapedRecipe(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy); + addShaped(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy); //Experience ItemStack xp = new ItemStack(EnderIO.blockExperianceOblisk); ItemStack xpItem = new ItemStack(EnderIO.itemXpTransfer); - GameRegistry.addShapedRecipe(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem); + addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem); //Weather ItemStack weather = new ItemStack(EnderIO.blockWeatherObelisk); ItemStack weatherItem = new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal()); - GameRegistry.addShapedRecipe(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b', new ItemStack(EnderIO.blockCapBank, - 1, CapBankType.getMetaFromType(CapBankType.SIMPLE))); + addShaped(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b', + new ItemStack(EnderIO.blockCapBank, 1, CapBankType.getMetaFromType(CapBankType.SIMPLE))); ClearConfigRecipe inst = new ClearConfigRecipe(); MinecraftForge.EVENT_BUS.register(inst); @@ -263,65 +250,52 @@ public class MachineRecipes { ItemStack poweredLampInv = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.ELECTRIC_INV.ordinal()); ItemStack wirelessLamp = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.WIRELESS.ordinal()); ItemStack wirelessLampInv = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.WIRELESS_INV.ordinal()); - GameRegistry.addShapelessRecipe(wirelessLamp, poweredLamp, enderRes); - GameRegistry.addShapelessRecipe(wirelessLamp, wirelessLampInv, Blocks.redstone_torch); - GameRegistry.addShapelessRecipe(wirelessLampInv, poweredLampInv, enderRes); - GameRegistry.addShapelessRecipe(wirelessLampInv, wirelessLamp, Blocks.redstone_torch); + addShapeless(wirelessLamp, poweredLamp, enderRes); + addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch); + addShapeless(wirelessLampInv, poweredLampInv, enderRes); + addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch); //inventory panel ItemStack awareness = new ItemStack(EnderIO.itemFunctionUpgrade, 1, FunctionUpgrade.INVENTORY_PANEL.ordinal()); - GameRegistry.addRecipe(new ShapedOreRecipe(awareness, "bsb", "ses", "bib", 'b', conduitBinder, 's', silicon, 'e', Items.ender_eye, 'i', electricSteel)); + addShaped(awareness, "bsb", "ses", "bib", 'b', binder, 's', silicon, 'e', Items.ender_eye, 'i', electricalSteel); ItemStack invPanel = new ItemStack(EnderIO.blockInventoryPanel); - GameRegistry.addShapedRecipe(invPanel, "dad", "psp", "dtd", 'd', darkSteel, 'a', awareness, 'p', pulCry, 's', sentientEnder, 't', basicTank); - } + addShaped(invPanel, "dad", "psp", "dtd", 'd', darkSteel, 'a', awareness, 'p', pulCry, 's', sentientEnder, 't', basicTank); - public static void addOreDictionaryRecipes() { - ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); ItemStack machineChassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); - ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); //powered light - ItemStack poweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 0); ItemStack glowstone = new ItemStack(Items.glowstone_dust); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', "itemSilicon", 'c', capacitor)); + if (Config.useHardRecipes) { + addShaped(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', "itemSilicon", 'c', capacitor); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', "glass", 'd', glowstone, 's', "itemSilicon", 'c', capacitor)); + addShaped(poweredLamp, "ggg", "sds", "scs", 'g', "glass", 'd', glowstone, 's', "itemSilicon", 'c', capacitor); } ItemStack invPoweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 1); - GameRegistry.addShapelessRecipe(invPoweredLamp, poweredLamp, Blocks.redstone_torch); - GameRegistry.addShapelessRecipe(poweredLamp, invPoweredLamp, Blocks.redstone_torch); + addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch); + addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch); //light ItemStack lamp = new ItemStack(EnderIO.blockElectricLight, 1, 2); - GameRegistry.addRecipe(new ShapedOreRecipe(lamp, " ", "ggg", "isi", 'g', "glass", 's', Blocks.glowstone, 'i', Items.iron_ingot)); + addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', Blocks.glowstone, 'i', Items.iron_ingot); ItemStack invLamp = new ItemStack(EnderIO.blockElectricLight, 1, 3); - GameRegistry.addShapelessRecipe(invLamp, lamp, Blocks.redstone_torch); - GameRegistry.addShapelessRecipe(lamp, invLamp, Blocks.redstone_torch); + addShapeless(invLamp, lamp, Blocks.redstone_torch); + addShapeless(lamp, invLamp, Blocks.redstone_torch); //MJ Reader - ItemStack mJReader = new ItemStack(EnderIO.itemConduitProbe, 1, 0); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0); - ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2); - GameRegistry.addRecipe(new ShapedOreRecipe(mJReader, "epe", "gcg", "srs", 'p', powerConduit, 'r', redstoneConduit, 'c', Items.comparator, 'g', - Blocks.glass_pane, 's', "itemSilicon", 'e', - electricalSteel)); + addShaped(mJReader, "epe", "gcg", "srs", 'p', powerConduit, 'r', redstoneConduit, 'c', Items.comparator, 'g', Blocks.glass_pane, 's', "itemSilicon", 'e', + electricalSteel); //Slice'N'Splice - ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal()); ItemStack sns = new ItemStack(EnderIO.blockSliceAndSplice); - GameRegistry.addRecipe(new ShapedOreRecipe(sns, "iki", "ams", "iii", 'i', soularium, 'm', machineChassis, 'k', "itemSkull", 'a', Items.iron_axe, 's', - Items.shears)); - - //Buffer - ItemStack itemBuffer = Type.getStack(Type.ITEM); - ItemStack powerBuffer = Type.getStack(Type.POWER); - ItemStack omniBuffer = Type.getStack(Type.OMNI); - GameRegistry.addRecipe(new ShapedOreRecipe(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', Blocks.chest)); - GameRegistry.addRecipe(new ShapedOreRecipe(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis)); - GameRegistry.addRecipe(new ShapelessOreRecipe(omniBuffer, itemBuffer, powerBuffer)); + addShaped(sns, "iki", "ams", "iii", 'i', soularium, 'm', machineChassis, 'k', "itemSkull", 'a', Items.iron_axe, 's', Items.shears); + //Buffer + ItemStack itemBuffer = Type.getStack(Type.ITEM); + ItemStack powerBuffer = Type.getStack(Type.POWER); + ItemStack omniBuffer = Type.getStack(Type.OMNI); + addShaped(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', Blocks.chest); + addShaped(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis); + addShapeless(omniBuffer, itemBuffer, powerBuffer); } } \ No newline at end of file diff --git a/src/main/java/crazypants/enderio/material/Alloy.java b/src/main/java/crazypants/enderio/material/Alloy.java index e17d2f21..694419a2 100644 --- a/src/main/java/crazypants/enderio/material/Alloy.java +++ b/src/main/java/crazypants/enderio/material/Alloy.java @@ -1,7 +1,11 @@ package crazypants.enderio.material; +import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.StringUtils; +import crazypants.enderio.EnderIO; + public enum Alloy { ELECTRICAL_STEEL("electricalSteel", 6.0f), @@ -15,19 +19,35 @@ public enum Alloy { public final String unlocalisedName; public final String iconKey; - public final String oredictIngotName; - public final String oredictBlockName; + public final String oreIngot; + public final String oreBlock; private final float hardness; private Alloy(String baseName, float hardness) { this.unlocalisedName = "enderio." + baseName; this.iconKey = "enderio:" + baseName; - this.oredictIngotName = "ingot" + StringUtils.capitalize(baseName); - this.oredictBlockName = "block" + StringUtils.capitalize(baseName); + this.oreIngot = "ingot" + StringUtils.capitalize(baseName); + this.oreBlock = "block" + StringUtils.capitalize(baseName); this.hardness = hardness; } public float getHardness() { return hardness; } + + public ItemStack getStackIngot() { + return getStackIngot(1); + } + + public ItemStack getStackIngot(int size) { + return new ItemStack(EnderIO.itemAlloy, size, ordinal()); + } + + public ItemStack getStackBlock() { + return getStackIngot(1); + } + + public ItemStack getStackBlock(int size) { + return new ItemStack(EnderIO.blockIngotStorage, size, ordinal()); + } } diff --git a/src/main/java/crazypants/enderio/material/MachinePart.java b/src/main/java/crazypants/enderio/material/MachinePart.java index 0c74cadc..005d407c 100644 --- a/src/main/java/crazypants/enderio/material/MachinePart.java +++ b/src/main/java/crazypants/enderio/material/MachinePart.java @@ -1,5 +1,11 @@ package crazypants.enderio.material; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import org.apache.commons.lang3.StringUtils; + public enum MachinePart { MACHINE_CHASSI("machineChassi"), @@ -7,10 +13,17 @@ public enum MachinePart { public final String unlocalisedName; public final String iconKey; + public final String oreDict; private MachinePart(String unlocalisedName) { this.unlocalisedName = "enderio." + unlocalisedName; this.iconKey = "enderio:" + unlocalisedName; + this.oreDict = "item" + StringUtils.capitalize(unlocalisedName); + } + + public static void registerOres(Item item) { + for (MachinePart m : values()) { + OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal())); + } } - } diff --git a/src/main/java/crazypants/enderio/material/Material.java b/src/main/java/crazypants/enderio/material/Material.java index 86af833a..6db4e1c7 100644 --- a/src/main/java/crazypants/enderio/material/Material.java +++ b/src/main/java/crazypants/enderio/material/Material.java @@ -6,6 +6,8 @@ import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.StringUtils; +import crazypants.enderio.EnderIO; + public enum Material { SILICON("silicon"), @@ -41,4 +43,12 @@ public enum Material { OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal())); } } + + public ItemStack getStack() { + return getStack(1); + } + + public ItemStack getStack(int size) { + return new ItemStack(EnderIO.itemMaterial, size, ordinal()); + } } diff --git a/src/main/java/crazypants/enderio/material/MaterialRecipes.java b/src/main/java/crazypants/enderio/material/MaterialRecipes.java index aa104f50..a51113a6 100644 --- a/src/main/java/crazypants/enderio/material/MaterialRecipes.java +++ b/src/main/java/crazypants/enderio/material/MaterialRecipes.java @@ -1,19 +1,11 @@ package crazypants.enderio.material; -import static crazypants.enderio.EnderIO.itemBasicCapacitor; -import static crazypants.util.OreDictionaryHelper.INGOT_TIN; -import static crazypants.util.OreDictionaryHelper.hasCopper; -import static crazypants.util.OreDictionaryHelper.hasEnderPearlDust; -import static crazypants.util.OreDictionaryHelper.hasTin; - import java.util.ArrayList; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; @@ -21,21 +13,26 @@ import crazypants.enderio.config.Config; import crazypants.enderio.machine.obelisk.weather.TileWeatherObelisk.WeatherTask; import crazypants.util.OreDictionaryHelper; +import static crazypants.enderio.EnderIO.itemBasicCapacitor; +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.*; +import static crazypants.util.OreDictionaryHelper.*; +import static crazypants.util.RecipeUtil.*; public class MaterialRecipes { public static void registerDependantOresInDictionary() { - if(hasCopper()) { + if (hasCopper()) { OreDictionary.registerOre("dustCopper", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal())); } - if(hasTin()) { + if (hasTin()) { OreDictionary.registerOre("dustTin", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal())); } - if(hasEnderPearlDust()) { + if (hasEnderPearlDust()) { OreDictionary.registerOre("dustEnderPearl", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal())); } //Enderium Base - if(OreDictionaryHelper.hasEnderium()) { + if (OreDictionaryHelper.hasEnderium()) { OreDictionary.registerOre("ingotEnderiumBase", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.INGOT_ENDERIUM_BASE.ordinal())); } } @@ -46,13 +43,10 @@ public class MaterialRecipes { OreDictionary.registerOre("dustIron", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal())); OreDictionary.registerOre("dustGold", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal())); OreDictionary.registerOre("dustObsidian", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_OBSIDIAN.ordinal())); - - OreDictionary.registerOre("gearStone", new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal())); - OreDictionary.registerOre("itemSilicon", new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal())); for (Alloy alloy : Alloy.values()) { - OreDictionary.registerOre(alloy.oredictIngotName, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal())); - OreDictionary.registerOre(alloy.oredictBlockName, new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal())); + OreDictionary.registerOre(alloy.oreIngot, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal())); + OreDictionary.registerOre(alloy.oreBlock, new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal())); } OreDictionary.registerOre("nuggetPulsatingIron", new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal())); @@ -76,63 +70,60 @@ public class MaterialRecipes { OreDictionary.registerOre("itemSkull", new ItemStack(EnderIO.blockEndermanSkull)); //Glass stuff for compatability - GameRegistry.addShapedRecipe(new ItemStack(Blocks.glass_pane, 16, 0), " ", "eee", "eee", 'e', pureGlass); - GameRegistry.addShapelessRecipe(new ItemStack(Blocks.glass), pureGlass); - GameRegistry.addShapedRecipe(new ItemStack(Items.glass_bottle, 3, 0), " ", "g g", " g ", 'g', pureGlass); + addShaped(new ItemStack(Blocks.glass_pane, 16, 0), " ", "eee", "eee", 'e', pureGlass); + addShapeless(new ItemStack(Blocks.glass), pureGlass); + addShaped(new ItemStack(Items.glass_bottle, 3, 0), " ", "g g", " g ", 'g', pureGlass); Material.registerOres(EnderIO.itemMaterial); + MachinePart.registerOres(EnderIO.itemMachinePart); } public static void addRecipes() { //Common Ingredients - ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 4, Material.CONDUIT_BINDER.ordinal()); - ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); - ItemStack binderComposite = new ItemStack(EnderIO.itemMaterial, 1, Material.BINDER_COMPOSITE.ordinal()); + String conduitBinder = CONDUIT_BINDER.oreDict; ItemStack fusedQuartzFrame = new ItemStack(EnderIO.itemFusedQuartzFrame, 1, 0); - ItemStack machineChassi = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); + String energeticAlloy = ENERGETIC_ALLOY.oreIngot; + String phasedGold = PHASED_GOLD.oreIngot; + String phasedIron = PHASED_IRON.oreIngot; + String darkSteel = DARK_STEEL.oreIngot; ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); //Conduit Binder - ItemStack cbc = binderComposite.copy(); - cbc.stackSize = 8; - if(Config.useAlternateBinderRecipe) { - GameRegistry.addShapedRecipe(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); + ItemStack cbc = CONDUIT_BINDER.getStack(8); + if (Config.useAlternateBinderRecipe) { + addShaped(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); } else { - GameRegistry.addShapedRecipe(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); + addShaped(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); } - GameRegistry.addSmelting(binderComposite, conduitBinder, 0); + GameRegistry.addSmelting(BINDER_COMPOSITE.getStack(), CONDUIT_BINDER.getStack(4), 0); //Nuggets ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.PHASED_IRON_NUGGET.ordinal()); - GameRegistry.addShapelessRecipe(phasedIronNugget, phasedIron); + addShapeless(phasedIronNugget, phasedIron); phasedIronNugget = phasedIronNugget.copy(); phasedIronNugget.stackSize = 1; - GameRegistry.addShapedRecipe(phasedIron, "eee", "eee", "eee", 'e', phasedIronNugget); + addShaped(PHASED_IRON.getStackIngot(), "eee", "eee", "eee", 'e', phasedIronNugget); ItemStack vibrantNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.VIBRANT_NUGGET.ordinal()); - GameRegistry.addShapelessRecipe(vibrantNugget, phasedGold); + addShapeless(vibrantNugget, phasedGold); vibrantNugget = vibrantNugget.copy(); vibrantNugget.stackSize = 1; - GameRegistry.addShapedRecipe(phasedGold, "eee", "eee", "eee", 'e', vibrantNugget); + addShaped(PHASED_GOLD.getStackIngot(), "eee", "eee", "eee", 'e', vibrantNugget); //Crystals ItemStack pulsCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal()); - GameRegistry.addShapedRecipe(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', Items.diamond); + addShaped(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', Items.diamond); ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()); - GameRegistry.addShapedRecipe(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', Items.emerald); + addShaped(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', Items.emerald); //Balls ItemStack darkBall = new ItemStack(EnderIO.itemMaterial, 5, Material.DARK_GRINDING_BALL.ordinal()); - GameRegistry.addShapedRecipe(darkBall, " s ", "sss", " s ", 's', darkSteel); + addShaped(darkBall, " s ", "sss", " s ", 's', darkSteel); //Smelting ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal()); @@ -145,37 +136,36 @@ public class MaterialRecipes { //Ender Dusts ItemStack enderDust = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal()); - GameRegistry.addShapedRecipe(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust); + addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust); //Dark Iron Bars ItemStack diBars = new ItemStack(EnderIO.blockDarkIronBars, 16, 0); - GameRegistry.addShapedRecipe(diBars, "ddd", "ddd", 'd', darkSteel); + addShaped(diBars, "ddd", "ddd", 'd', darkSteel); // Fused Quartz Frame - GameRegistry.addRecipe(new ShapedOreRecipe(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick")); + addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood"); + addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick"); // Machine Chassi ArrayList steelIngots = OreDictionary.getOres("ingotSteel"); - if(Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty()) { - GameRegistry.addRecipe(new ShapedOreRecipe(machineChassi, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', "ingotSteel", 'c', capacitor)); - } else { - GameRegistry.addShapedRecipe(machineChassi, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', Items.iron_ingot, 'c', capacitor); - } + ItemStack chassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); + String mat = Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty() ? "ingotSteel" : "ingotIron"; + addShaped(chassis, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', mat, 'c', capacitor); // Basic Gear - GameRegistry.addRecipe(new ShapedOreRecipe(basicGear, "scs", "c c", "scs", 's', "stickWood", 'c', Blocks.cobblestone)); - GameRegistry.addRecipe(new ShapedOreRecipe(basicGear, "scs", "c c", "scs", 's', "woodStick", 'c', Blocks.cobblestone)); + ItemStack gear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); + addShaped(gear, "scs", "c c", "scs", 's', "stickWood", 'c', "cobblestone"); + addShaped(gear, "scs", "c c", "scs", 's', "woodStick", 'c', "cobblestone"); //Ender Capacitor ItemStack enderCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 2); ItemStack activatedCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 1); - if(Config.useHardRecipes) { - GameRegistry.addShapedRecipe(enderCapacitor, "eee", "cgc", "eee", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); + if (Config.useHardRecipes) { + addShaped(enderCapacitor, "eee", "cgc", "eee", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); } else { - GameRegistry.addShapedRecipe(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); + addShaped(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); } // Weather Crystal @@ -183,30 +173,22 @@ public class MaterialRecipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal()), main, WeatherTask.CLEAR .requiredItem(), WeatherTask.RAIN.requiredItem(), WeatherTask.STORM.requiredItem())); - if(Config.reinforcedObsidianEnabled) { + if (Config.reinforcedObsidianEnabled) { ItemStack reinfObs = new ItemStack(EnderIO.blockReinforcedObsidian); - ItemStack corners = darkSteel; - if(Config.reinforcedObsidianUseDarkSteelBlocks) { - corners = new ItemStack(EnderIO.blockIngotStorage, 1, Alloy.DARK_STEEL.ordinal()); + String corners = darkSteel; + if (Config.reinforcedObsidianUseDarkSteelBlocks) { + corners = Alloy.DARK_STEEL.oreBlock; } - GameRegistry.addShapedRecipe(reinfObs, "dbd", "bob", "dbd", 'd', corners, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian); + addShaped(reinfObs, "dbd", "bob", "dbd", 'd', corners, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian); } - GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.blockDarkSteelAnvil, - "bbb", - " i ", - "iii", + addShaped(EnderIO.blockDarkSteelAnvil, "bbb", " i ", "iii", 'b', DARK_STEEL.oreBlock, 'i', darkSteel); - 'b', "blockDarkSteel", - 'i', "ingotDarkSteel" - )); - - GameRegistry.addRecipe(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars); + addShaped(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars); for (Alloy alloy : Alloy.values()) { - GameRegistry - .addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()), "iii", "iii", "iii", 'i', alloy.oredictIngotName)); - GameRegistry.addShapelessRecipe(new ItemStack(EnderIO.itemAlloy, 9, alloy.ordinal()), new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal())); + addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.oreIngot); + addShapeless(alloy.getStackIngot(9), alloy.oreBlock); } //Food @@ -215,42 +197,34 @@ public class MaterialRecipes { GameRegistry.addSmelting(flour, bread, 0.35f); - } - - public static void addOreDictionaryRecipes() { - if(OreDictionaryHelper.hasCopper()) { + if (hasCopper()) { ItemStack dustCopper = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal()); ItemStack ingotCopper = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_COPPER); GameRegistry.addSmelting(dustCopper, ingotCopper, 0); } - if(hasTin()) { + if (hasTin()) { ItemStack dustTin = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal()); ItemStack ingotTin = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_TIN); GameRegistry.addSmelting(dustTin, ingotTin, 0); } - ItemStack capacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 0); ArrayList copperIngots = OreDictionary.getOres("ingotCopper"); - Item gold; - if(Config.useHardRecipes) { - gold = Items.gold_ingot; + String gold; + if (Config.useHardRecipes) { + gold = "ingotGold"; } else { - gold = Items.gold_nugget; + gold = "nuggetGold"; } - if(copperIngots != null && !copperIngots.isEmpty() && Config.useModMetals) { - GameRegistry.addRecipe(new ShapedOreRecipe(capacitor, " gr", "gcg", "rg ", 'r', Items.redstone, 'g', gold, 'c', "ingotCopper")); + if (copperIngots != null && !copperIngots.isEmpty() && Config.useModMetals) { + addShaped(capacitor, " gr", "gcg", "rg ", 'r', Items.redstone, 'g', gold, 'c', "ingotCopper"); } else { - GameRegistry. - addShapedRecipe(capacitor, " gr", "gig", "rg ", 'r', Items.redstone, 'g', gold, 'i', Items.iron_ingot); + addShaped(capacitor, " gr", "gig", "rg ", 'r', "dustRedstone", 'g', gold, 'i', "ingotIron"); } - int dustCoal = OreDictionary.getOreID("dustCoal"); - ItemStack activatedCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 1); - ItemStack energeticAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(activatedCapacitor, "eee", "cCc", "eee", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal")); + if (Config.useHardRecipes) { + addShaped(activatedCapacitor, "eee", "cCc", "eee", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal"); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(activatedCapacitor, " e ", "cCc", " e ", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal")); + addShaped(activatedCapacitor, " e ", "cCc", " e ", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal"); } } } \ No newline at end of file diff --git a/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java b/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java index 8e775fdf..f65bc4a3 100644 --- a/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java +++ b/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java @@ -36,38 +36,38 @@ public class ThaumcraftCompat { ThaumcraftApi.registerObjectTag("dustCoal", new AspectList().add(getAspects(Items.coal))); ThaumcraftApi.registerObjectTag("itemSilicon", new AspectList().add(Aspect.FIRE, 1).add(Aspect.ORDER, 1).add(Aspect.SENSES, 1)); - ThaumcraftApi.registerObjectTag(Alloy.ELECTRICAL_STEEL.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.ELECTRICAL_STEEL.oreIngot, new AspectList() .add(getAspects("dustCoal")) .add(getAspects(Items.iron_ingot)) .add(getAspects("itemSilicon"))); - ThaumcraftApi.registerObjectTag(Alloy.ENERGETIC_ALLOY.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.ENERGETIC_ALLOY.oreIngot, new AspectList() .add(getAspects(Items.glowstone_dust)) .add(getAspects(Items.redstone)) .add(getAspects(Items.gold_ingot))); - ThaumcraftApi.registerObjectTag(Alloy.PHASED_GOLD.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.PHASED_GOLD.oreIngot, new AspectList() .add(getAspects(Items.ender_pearl)) .add(getAspects("ingotEnergeticAlloy"))); - ThaumcraftApi.registerObjectTag(Alloy.REDSTONE_ALLOY.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.REDSTONE_ALLOY.oreIngot, new AspectList() .add(getAspects(Items.redstone)) .add(getAspects("itemSilicon"))); - ThaumcraftApi.registerObjectTag(Alloy.CONDUCTIVE_IRON.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.CONDUCTIVE_IRON.oreIngot, new AspectList() .add(getAspects(Items.redstone)) .add(getAspects(Items.iron_ingot))); - ThaumcraftApi.registerObjectTag(Alloy.PHASED_IRON.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.PHASED_IRON.oreIngot, new AspectList() .add(getAspects(Items.ender_pearl)) .add(getAspects(Items.iron_ingot))); - ThaumcraftApi.registerObjectTag(Alloy.DARK_STEEL.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.DARK_STEEL.oreIngot, new AspectList() .add(getAspects(Items.iron_ingot)) .add(getAspects("dustCoal")) .add(getAspects(Blocks.obsidian))); - ThaumcraftApi.registerObjectTag(Alloy.SOULARIUM.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.SOULARIUM.oreIngot, new AspectList() .add(getAspects(Blocks.soul_sand)) .add(getAspects(Items.gold_ingot))); @@ -80,19 +80,19 @@ public class ThaumcraftCompat { .add(getAspects(EnderIO.blockEndermanSkull)) .add(getAspects(Items.potionitem)).add(getAspects(Items.potionitem)) .add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal()))) - .add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName))); + .add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_ELECTRODE.ordinal()), new AspectList() .add(getAspects(new ItemStack(Items.skull, 1, 2))) .add(getAspects("itemSilicon")).add(getAspects("itemSilicon")) .add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal()))) - .add(getAspects(Alloy.ENERGETIC_ALLOY.oredictIngotName)).add(getAspects(Alloy.ENERGETIC_ALLOY.oredictIngotName))); + .add(getAspects(Alloy.ENERGETIC_ALLOY.oreIngot)).add(getAspects(Alloy.ENERGETIC_ALLOY.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()), new AspectList() .add(getAspects(new ItemStack(Items.skull, 1, 2))) .add(getAspects("itemSilicon")).add(getAspects("itemSilicon")) .add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal()))) - .add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName))); + .add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal()), new AspectList() .add(Aspect.UNDEAD, 2) @@ -103,8 +103,8 @@ public class ThaumcraftCompat { ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ENDER_RESONATOR.ordinal()), new AspectList() .add(getAspects(EnderIO.blockEndermanSkull)) .add(getAspects("itemSilicon")).add(getAspects("itemSilicon")) - .add(getAspects(Alloy.PHASED_GOLD.oredictIngotName)) - .add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName))); + .add(getAspects(Alloy.PHASED_GOLD.oreIngot)) + .add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal()), new AspectList() .add(Aspect.AIR, 2) diff --git a/src/main/java/crazypants/util/RecipeUtil.java b/src/main/java/crazypants/util/RecipeUtil.java new file mode 100644 index 00000000..ebece446 --- /dev/null +++ b/src/main/java/crazypants/util/RecipeUtil.java @@ -0,0 +1,35 @@ +package crazypants.util; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; +import cpw.mods.fml.common.registry.GameRegistry; + +public class RecipeUtil { + + public static void addShaped(Item res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShaped(Block res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShaped(ItemStack res, Object... recipe) { + GameRegistry.addRecipe(new ShapedOreRecipe(res, recipe)); + } + + public static void addShapeless(Item res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShapeless(Block res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShapeless(ItemStack res, Object... recipe) { + GameRegistry.addRecipe(new ShapelessOreRecipe(res, recipe)); + } +} From b04213e165998a4f61f933d97159edf548afd3a1 Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Fri, 12 Jun 2015 22:14:31 +0200 Subject: [PATCH 21/33] add Storage Drawer API support for the Inventory Panel --- .../api/IStorageDrawersApi.java | 20 ++++ .../storagedrawers/api/StorageDrawersApi.java | 28 +++++ .../api/event/DrawerPopulatedEvent.java | 19 +++ .../api/inventory/IDrawerInventory.java | 35 ++++++ .../api/inventory/IInventoryAdapter.java | 16 +++ .../api/inventory/SlotType.java | 15 +++ .../api/pack/BlockConfiguration.java | 49 ++++++++ .../storagedrawers/api/pack/BlockType.java | 8 ++ .../api/pack/IPackBlockFactory.java | 11 ++ .../api/pack/IPackDataResolver.java | 18 +++ .../api/pack/StandardDataResolver.java | 106 +++++++++++++++++ .../storagedrawers/api/pack/TextureType.java | 14 +++ .../api/registry/IIngredientHandler.java | 19 +++ .../api/registry/IRecipeHandler.java | 36 ++++++ .../api/registry/IRecipeHandlerRegistry.java | 12 ++ .../api/registry/IRenderRegistry.java | 8 ++ .../api/registry/IWailaRegistry.java | 6 + .../api/registry/IWailaTooltipHandler.java | 8 ++ .../api/render/IRenderLabel.java | 9 ++ .../storagedrawers/api/storage/IDrawer.java | 109 ++++++++++++++++++ .../api/storage/IDrawerGroup.java | 25 ++++ .../api/storage/IDrawerGroupInteractive.java | 15 +++ .../api/storage/IFractionalDrawer.java | 28 +++++ .../api/storage/INetworked.java | 5 + .../api/storage/attribute/ILockable.java | 21 ++++ .../api/storage/attribute/IShroudable.java | 16 +++ .../api/storage/attribute/IVoidable.java | 9 ++ .../api/storage/attribute/LockAttribute.java | 37 ++++++ .../invpanel/server/AbstractInventory.java | 26 ++++- .../invpanel/server/DrawerGroupInventory.java | 66 +++++++++++ .../server/InventoryDatabaseServer.java | 7 +- .../invpanel/server/InventoryFactory.java | 55 +++++++++ 32 files changed, 845 insertions(+), 11 deletions(-) create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/IStorageDrawersApi.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/StorageDrawersApi.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/event/DrawerPopulatedEvent.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IInventoryAdapter.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockConfiguration.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockType.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackBlockFactory.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackDataResolver.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/StandardDataResolver.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/TextureType.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandlerRegistry.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRenderRegistry.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaRegistry.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaTooltipHandler.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/render/IRenderLabel.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroupInteractive.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/INetworked.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/ILockable.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IShroudable.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IVoidable.java create mode 100644 src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/LockAttribute.java create mode 100644 src/main/java/crazypants/enderio/machine/invpanel/server/DrawerGroupInventory.java create mode 100644 src/main/java/crazypants/enderio/machine/invpanel/server/InventoryFactory.java diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/IStorageDrawersApi.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/IStorageDrawersApi.java new file mode 100644 index 00000000..5c73621e --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/IStorageDrawersApi.java @@ -0,0 +1,20 @@ +package com.jaquadro.minecraft.storagedrawers.api; + +import com.jaquadro.minecraft.storagedrawers.api.pack.IPackBlockFactory; +import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry; +import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry; +import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry; + +public interface IStorageDrawersApi +{ + /** + * Recipe handlers are used to make custom recipes compatible with compacting drawers. + */ + IRecipeHandlerRegistry recipeHandlerRegistry (); + + IRenderRegistry renderRegistry (); + + IWailaRegistry wailaRegistry (); + + IPackBlockFactory packFactory (); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/StorageDrawersApi.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/StorageDrawersApi.java new file mode 100644 index 00000000..70a15174 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/StorageDrawersApi.java @@ -0,0 +1,28 @@ +package com.jaquadro.minecraft.storagedrawers.api; + +/** + * Entry point for the public API. + */ +public class StorageDrawersApi +{ + private static IStorageDrawersApi instance; + + /** + * API entry point. + * + * @return The {@link IStorageDrawersApi} instance or null if the API or Storage Drawers is unavailable. + */ + public static IStorageDrawersApi instance () { + if (instance == null) { + try { + Class classApi = Class.forName( "com.jaquadro.minecraft.storagedrawers.core.Api" ); + instance = (IStorageDrawersApi) classApi.getField("instance").get(null); + } + catch (Throwable t) { + return null; + } + } + + return instance; + } +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/event/DrawerPopulatedEvent.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/event/DrawerPopulatedEvent.java new file mode 100644 index 00000000..f5dca193 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/event/DrawerPopulatedEvent.java @@ -0,0 +1,19 @@ +package com.jaquadro.minecraft.storagedrawers.api.event; + +import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; +import cpw.mods.fml.common.eventhandler.Event; + +/** + * This event is called when a drawer has been bound to a new item. This is + * and opportunity for mods to cache extended data with the drawer. + * + * This event is also called when the drawer is changed to empty. + */ +public class DrawerPopulatedEvent extends Event +{ + public final IDrawer drawer; + + public DrawerPopulatedEvent (IDrawer drawer) { + this.drawer = drawer; + } +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java new file mode 100644 index 00000000..47396c79 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IDrawerInventory.java @@ -0,0 +1,35 @@ +package com.jaquadro.minecraft.storagedrawers.api.inventory; + +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; + +public interface IDrawerInventory extends ISidedInventory +{ + /** + * Gets a drawer's group slot index from an IInventory slot index. + * + * @param inventorySlot An IInventory slot index returned from getInventorySlot. + */ + int getDrawerSlot (int inventorySlot); + + /** + * Gets an IInventory slot index suitable for operations for the given type. + * + * @param drawerSlot The index of the drawer within its group. + * @param type The type of IInventory slot to return an index for. + */ + int getInventorySlot (int drawerSlot, SlotType type); + + /** + * Gets the type associated with a given IInventory slot index. + * + * @param inventorySlot An IInventory slot index returned from getInventorySlot. + */ + SlotType getInventorySlotType (int inventorySlot); + + boolean canInsertItem (int slot, ItemStack stack); + + boolean canExtractItem (int slot, ItemStack stack); + + boolean syncInventoryIfNeeded (); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IInventoryAdapter.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IInventoryAdapter.java new file mode 100644 index 00000000..71f55e3d --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/IInventoryAdapter.java @@ -0,0 +1,16 @@ +package com.jaquadro.minecraft.storagedrawers.api.inventory; + +import net.minecraft.item.ItemStack; + +public interface IInventoryAdapter +{ + ItemStack getInventoryStack (SlotType slotType); + + void setInStack (ItemStack stack); + + void setOutStack (ItemStack stack); + + void syncInventory (); + + boolean syncInventoryIfNeeded (); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java new file mode 100644 index 00000000..dbb002ed --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/inventory/SlotType.java @@ -0,0 +1,15 @@ +package com.jaquadro.minecraft.storagedrawers.api.inventory; + +/** + * Classifies different IInventory slots according to how they should be used. + */ +public enum SlotType +{ + /** An inventory slot for input-only operations; stack sizes artificially held low. */ + INPUT, + + /** An inventory slot for output-only operations; stack sizes artificially held high. */ + OUTPUT; + + public static final SlotType[] values = values(); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockConfiguration.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockConfiguration.java new file mode 100644 index 00000000..502e46f3 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockConfiguration.java @@ -0,0 +1,49 @@ +package com.jaquadro.minecraft.storagedrawers.api.pack; + +public enum BlockConfiguration +{ + BasicFull1(BlockType.Drawers, 1, false), + BasicFull2(BlockType.Drawers, 2, false), + BasicFull4(BlockType.Drawers, 4, false), + BasicHalf2(BlockType.Drawers, 2, true), + BasicHalf4(BlockType.Drawers, 4, true), + + SortingFull1(BlockType.DrawersSorting, 1, false), + SortingFull2(BlockType.DrawersSorting, 2, false), + SortingFull4(BlockType.DrawersSorting, 4, false), + SortingHalf2(BlockType.DrawersSorting, 2, true), + SortingHalf4(BlockType.DrawersSorting, 4, true), + + Trim(BlockType.Trim, 0, false); + + private final BlockType type; + private final int drawerCount; + private final boolean halfDepth; + + BlockConfiguration (BlockType type, int count, boolean half) { + this.type = type; + this.drawerCount = count; + this.halfDepth = half; + } + + public BlockType getBlockType () { + return type; + } + + public int getDrawerCount () { + return drawerCount; + } + + public boolean isHalfDepth () { + return halfDepth; + } + + public static BlockConfiguration by (BlockType type, int drawerCount, boolean halfDepth) { + for (BlockConfiguration config : values()) { + if (config.type == type && config.drawerCount == drawerCount && config.halfDepth == halfDepth) + return config; + } + + return null; + } +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockType.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockType.java new file mode 100644 index 00000000..9487f6cd --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/BlockType.java @@ -0,0 +1,8 @@ +package com.jaquadro.minecraft.storagedrawers.api.pack; + +public enum BlockType +{ + Drawers, + DrawersSorting, + Trim +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackBlockFactory.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackBlockFactory.java new file mode 100644 index 00000000..d6ffe1f5 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackBlockFactory.java @@ -0,0 +1,11 @@ +package com.jaquadro.minecraft.storagedrawers.api.pack; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; + +public interface IPackBlockFactory +{ + Block createBlock (BlockConfiguration blockConfig, IPackDataResolver dataResolver); + + void registerBlock (Block block, String name); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackDataResolver.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackDataResolver.java new file mode 100644 index 00000000..bc9627bc --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/IPackDataResolver.java @@ -0,0 +1,18 @@ +package com.jaquadro.minecraft.storagedrawers.api.pack; + +import net.minecraft.creativetab.CreativeTabs; + +public interface IPackDataResolver +{ + String getPackModID (); + + String getBlockName (BlockConfiguration blockConfig); + + CreativeTabs getCreativeTabs (BlockType type); + + boolean isValidMetaValue (int meta); + + String getUnlocalizedName (int meta); + + String getTexturePath (TextureType type, int meta); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/StandardDataResolver.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/StandardDataResolver.java new file mode 100644 index 00000000..212f2471 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/StandardDataResolver.java @@ -0,0 +1,106 @@ +package com.jaquadro.minecraft.storagedrawers.api.pack; + +import net.minecraft.creativetab.CreativeTabs; + +public class StandardDataResolver implements IPackDataResolver +{ + private String modID; + private String[] unlocalizedNames; + private CreativeTabs creativeTab; + + public StandardDataResolver (String modID, String[] unlocalizedNames) { + this.modID = modID; + this.unlocalizedNames = unlocalizedNames; + } + + public StandardDataResolver (String modID, String[] unlocalizedNames, CreativeTabs creativeTab) { + this(modID, unlocalizedNames); + this.creativeTab = creativeTab; + } + + @Override + public String getPackModID () { + return modID; + } + + protected String makeBlockName (String name) { + return getPackModID().toLowerCase() + "." + name; + } + + @Override + public String getBlockName (BlockConfiguration blockConfig) { + switch (blockConfig.getBlockType()) { + case Drawers: + case DrawersSorting: + if (blockConfig.getDrawerCount() == 1) + return makeBlockName("fullDrawers1"); + if (blockConfig.getDrawerCount() == 2 && !blockConfig.isHalfDepth()) + return makeBlockName("fullDrawers2"); + if (blockConfig.getDrawerCount() == 4 && !blockConfig.isHalfDepth()) + return makeBlockName("fullDrawers4"); + if (blockConfig.getDrawerCount() == 2 && blockConfig.isHalfDepth()) + return makeBlockName("halfDrawers2"); + if (blockConfig.getDrawerCount() == 4 && blockConfig.isHalfDepth()) + return makeBlockName("halfDrawers4"); + break; + case Trim: + return makeBlockName("trim"); + } + return null; + } + + @Override + public CreativeTabs getCreativeTabs (BlockType type) { + return creativeTab; + } + + @Override + public boolean isValidMetaValue (int meta) { + if (meta < 0 || meta >= unlocalizedNames.length) + return false; + + return unlocalizedNames != null && unlocalizedNames[meta] != null; + } + + @Override + public String getUnlocalizedName (int meta) { + if (!isValidMetaValue(meta)) + return null; + + return unlocalizedNames[meta]; + } + + protected String getBaseTexturePath () { + return getPackModID() + ":"; + } + + protected String getTextureMetaName (int meta) { + return getUnlocalizedName(meta); + } + + @Override + public String getTexturePath (TextureType type, int meta) { + switch (type) { + case Front1: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front_1"; + case Front2: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front_2"; + case Front4: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front_4"; + case Side: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_side"; + case SideSort: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_sort"; + case SideVSplit: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_side_v"; + case SideHSplit: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_side_h"; + case TrimBorder: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_trim"; + case TrimBlock: + return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_side"; + default: + return ""; + } + } +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/TextureType.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/TextureType.java new file mode 100644 index 00000000..e1c9eb08 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/pack/TextureType.java @@ -0,0 +1,14 @@ +package com.jaquadro.minecraft.storagedrawers.api.pack; + +public enum TextureType +{ + Front1, + Front2, + Front4, + Side, + SideSort, + SideVSplit, + SideHSplit, + TrimBorder, + TrimBlock +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java new file mode 100644 index 00000000..a7432b2b --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java @@ -0,0 +1,19 @@ +package com.jaquadro.minecraft.storagedrawers.api.registry; + +import net.minecraft.item.ItemStack; + +/** + * Ingredient handlers are used to get ItemStacks from ingredients in custom IRecipe implementations. If you have + * registered an IRecipeHandler that returns lists of objects that aren't ItemStacks, then you will need to + * implement an ingredient handler for those objects. + */ +public interface IIngredientHandler +{ + /** + * Gets an ItemStack from an object that represents an ingredient in an IRecipe. + * + * @param object An ingredient object. + * @return An ItemStack for the given ingredient. + */ + ItemStack getItemStack (Object object); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java new file mode 100644 index 00000000..d4311ea8 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java @@ -0,0 +1,36 @@ +package com.jaquadro.minecraft.storagedrawers.api.registry; + +import net.minecraft.item.crafting.IRecipe; + +import java.util.List; + +/** + * Recipe handlers are used by compacting drawers to find more-compressed forms of blocks and items. If your recipe + * to craft compressed items is a custom IRecipe implementation, you will need to register a handler for it. + */ +public interface IRecipeHandler +{ + /** + * Get the recipe ingredient list as an array of objects (usually used for shaped recipes). + * If your array does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to + * get an ItemStack from them. + * + * If you would prefer to return a List, return null in this method and implement {@link #getInputAsList}. + * + * @param recipe An instance of a custom {@link IRecipe}. + * @return An array of ItemStacks or objects with a registered {@link IIngredientHandler}. + */ + Object[] getInputAsArray (IRecipe recipe); + + /** + * Get the recipe ingredient list as a list of objects (usually used for shapeless recipes). + * If your list does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to + * get an ItemStack from them. + * + * If you would prefer to return an array, return null in this method and implement {@link #getInputAsArray}. + * + * @param recipe An instance of a custom {@link IRecipe}. + * @return A list of ItemStacks or objects with a registered {@link IIngredientHandler}. + */ + List getInputAsList (IRecipe recipe); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandlerRegistry.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandlerRegistry.java new file mode 100644 index 00000000..b83d5347 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandlerRegistry.java @@ -0,0 +1,12 @@ +package com.jaquadro.minecraft.storagedrawers.api.registry; + +public interface IRecipeHandlerRegistry +{ + void registerRecipeHandler (Class clazz, IRecipeHandler handler); + + void registerIngredientHandler (Class clazz, IIngredientHandler handler); + + IRecipeHandler getRecipeHandler (Class clazz); + + IIngredientHandler getIngredientHandler (Class clazz); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRenderRegistry.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRenderRegistry.java new file mode 100644 index 00000000..cfa4543a --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IRenderRegistry.java @@ -0,0 +1,8 @@ +package com.jaquadro.minecraft.storagedrawers.api.registry; + +import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel; + +public interface IRenderRegistry +{ + void registerPreLabelRenderHandler (IRenderLabel renderHandler); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaRegistry.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaRegistry.java new file mode 100644 index 00000000..a4ee9874 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaRegistry.java @@ -0,0 +1,6 @@ +package com.jaquadro.minecraft.storagedrawers.api.registry; + +public interface IWailaRegistry +{ + void registerTooltipHandler (IWailaTooltipHandler handler); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaTooltipHandler.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaTooltipHandler.java new file mode 100644 index 00000000..d0f3328c --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/registry/IWailaTooltipHandler.java @@ -0,0 +1,8 @@ +package com.jaquadro.minecraft.storagedrawers.api.registry; + +import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; + +public interface IWailaTooltipHandler +{ + String transformItemName (IDrawer drawer, String defaultName); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/render/IRenderLabel.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/render/IRenderLabel.java new file mode 100644 index 00000000..500030aa --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/render/IRenderLabel.java @@ -0,0 +1,9 @@ +package com.jaquadro.minecraft.storagedrawers.api.render; + +import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup; +import net.minecraft.tileentity.TileEntity; + +public interface IRenderLabel +{ + void render (TileEntity tileEntity, IDrawerGroup drawerGroup, int slot, float brightness, float partialTickTime); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java new file mode 100644 index 00000000..c88556c0 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawer.java @@ -0,0 +1,109 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public interface IDrawer +{ + /** + * Gets an ItemStack of size 1 representing the type, metadata, and tags of the stored items. + * The returned ItemStack should not be modified for any reason. Make a copy if you need to store or modify it. + */ + ItemStack getStoredItemPrototype (); + + /** + * Gets an ItemStack initialized to the number of items stored in this drawer. + * The returned ItemStack is guaranteed to be a new copy and can be used for any purpose. Does not affect drawer contents. + */ + ItemStack getStoredItemCopy (); + + /** + * Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced. + * + * @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store. + * @param amount The amount to initialize the stored item count to. + */ + void setStoredItem (ItemStack itemPrototype, int amount); + + /** + * Gets the number of items stored in this drawer. + */ + int getStoredItemCount (); + + /** + * Sets the number of items stored in this drawer. Triggers syncing of inventories and client data. + * Setting a drawer's count to 0 may also result in the item type being cleared, depending in implementation. + * + * @param amount The new amount of items stored in this drawer. + */ + void setStoredItemCount (int amount); + + /** + * Gets the maximum number of items that can be stored in this drawer. + * This value will vary depending on the max stack size of the stored item type. + */ + int getMaxCapacity (); + + /** + * Gets the maximum number of items that could be stored in this drawer if it held the given item. + * + * @param itemPrototype The item type to query. + */ + int getMaxCapacity (ItemStack itemPrototype); + + /** + * Gets the number of items that could still be added to this drawer before it is full. + */ + int getRemainingCapacity (); + + /** + * Gets the max stack size of the item type stored in this drawer. Convenience method. + */ + int getStoredItemStackSize (); + + /** + * Gets whether or not an item of the given type and data can be stored in this drawer. + * + * Stack size and available capacity are not considered. For drawers that are not empty, this + * method can allow ore-dictionary compatible items to be accepted into the drawer, as defined by what + * the drawer considers to be an equivalent item. + * + * @param itemPrototype An ItemStack representing the type, metadata, and tags of an item. + */ + boolean canItemBeStored (ItemStack itemPrototype); + + /** + * Gets whether or not an item of the given type and data can be extracted from this drawer. + * + * This is intended to allow outbound ore-dictionary conversions of compatible items, as defined by what + * the drawer considers to be an equivalent item. + * + * @param itemPrototype An ItemStack representing the type, metadata, and tags of an item. + */ + boolean canItemBeExtracted (ItemStack itemPrototype); + + /** + * Gets whether or not the drawer has items. + * A drawer set with an item type and 0 count is not considered empty. + */ + boolean isEmpty (); + + /** + * Gets auxiliary data that has been associated with this drawer. + * + * @param key The key used to identify the data. + * @return An opaque object that was previously stored. + */ + Object getExtendedData (String key); + + /** + * Stores auxiliary data with this drawer, mainly for use in integration. + * @param key The key to identify the data with. + * @param data The data to store. + */ + void setExtendedData (String key, Object data); + + void writeToNBT (NBTTagCompound tag); + + void readFromNBT (NBTTagCompound tag); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java new file mode 100644 index 00000000..1f1eefef --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroup.java @@ -0,0 +1,25 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage; + +import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory; + +public interface IDrawerGroup +{ + /** + * Gets the number of drawers contained within this group. + */ + int getDrawerCount (); + + /** + * Gets the drawer at the given slot within this group. + */ + IDrawer getDrawer (int slot); + + /** + * Gets whether the drawer in the given slot is usable. + */ + boolean isDrawerEnabled (int slot); + + IDrawerInventory getDrawerInventory (); + + boolean markDirtyIfNeeded (); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroupInteractive.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroupInteractive.java new file mode 100644 index 00000000..bd8a0ea7 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IDrawerGroupInteractive.java @@ -0,0 +1,15 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public interface IDrawerGroupInteractive extends IDrawerGroup +{ + ItemStack takeItemsFromSlot (int slot, int count); + + int putItemsIntoSlot (int slot, ItemStack stack, int count); + + int interactPutCurrentItemIntoSlot (int slot, EntityPlayer player); + + int interactPutCurrentInventoryIntoSlot (int slot, EntityPlayer player); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java new file mode 100644 index 00000000..bd87a808 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java @@ -0,0 +1,28 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage; + +/** + * Represents a drawer with items that are a fractional component of another item within the drawer group. Compacting + * Drawers are a primary example of this drawer type. + */ +public interface IFractionalDrawer extends IDrawer +{ + /** + * Gets the storage ratio between the held item and the most compressed item within the drawer group. + * + * For example, most ingots have a conversion rate of 9 compared to metal blocks, and nuggets a rate of 81. + * Actual conversion rates are implementation-defined. + */ + int getConversionRate (); + + /** + * Gets the number of items left in the drawer if the maximum number of equivalent compressed items had been removed. + * The equivalency is determined by the next compression tier, and not necessarily the conversion rate. + */ + int getStoredItemRemainder (); + + /** + * Gets whether or not the stored item represents the smallest granularity of material that can be stored within + * the drawer group. + */ + boolean isSmallestUnit (); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/INetworked.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/INetworked.java new file mode 100644 index 00000000..fba20d40 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/INetworked.java @@ -0,0 +1,5 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage; + +public interface INetworked +{ +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/ILockable.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/ILockable.java new file mode 100644 index 00000000..7645c83a --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/ILockable.java @@ -0,0 +1,21 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage.attribute; + +public interface ILockable +{ + /** + * Gets whether or not a drawer or group is locked for the given lock attribute. + */ + boolean isLocked (LockAttribute attr); + + /** + * Gets whether or not the lock state can be changed for the given lock attribute. + * If this method returns false, isLocked may still return true. + */ + boolean canLock (LockAttribute attr); + + /** + * Sets the lock state of a drawer or group for the given lock attribute. + * If canLock returns false, this is a no-op. + */ + void setLocked (LockAttribute attr, boolean isLocked); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IShroudable.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IShroudable.java new file mode 100644 index 00000000..b7f0bf03 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IShroudable.java @@ -0,0 +1,16 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage.attribute; + +public interface IShroudable +{ + /** + * Gets whether or not the drawer has the shrouded attribute. + * The shrouded attribute instructs the drawer to not render its item label. + */ + boolean isShrouded (); + + /** + * Sets whether or not the drawer is currently shrouded. + * @return false if the operation is not supported, true otherwise. + */ + boolean setIsShrouded (boolean state); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IVoidable.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IVoidable.java new file mode 100644 index 00000000..9fc58063 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/IVoidable.java @@ -0,0 +1,9 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage.attribute; + +public interface IVoidable +{ + /** + * Gets whether or not the drawer has a voiding attribute. + */ + boolean isVoid (); +} diff --git a/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/LockAttribute.java b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/LockAttribute.java new file mode 100644 index 00000000..cb726b41 --- /dev/null +++ b/src/api/java/com/jaquadro/minecraft/storagedrawers/api/storage/attribute/LockAttribute.java @@ -0,0 +1,37 @@ +package com.jaquadro.minecraft.storagedrawers.api.storage.attribute; + +import java.util.EnumSet; + +public enum LockAttribute +{ + LOCK_POPULATED, + LOCK_EMPTY; + + public int getFlagValue () { + return 1 << ordinal(); + } + + public static int getBitfield (EnumSet attributes) { + int value = 0; + if (attributes == null) + return value; + + for (LockAttribute attr : attributes) + value |= attr.getFlagValue(); + + return value; + } + + public static EnumSet getEnumSet (int bitfield) { + if (bitfield == 0) + return null; + + EnumSet set = EnumSet.noneOf(LockAttribute.class); + for (LockAttribute attr : values()) { + if ((bitfield & attr.getFlagValue()) != 0) + set.add(attr); + } + + return set; + } +} diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java b/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java index f38d03c1..e279f14b 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/AbstractInventory.java @@ -22,24 +22,40 @@ abstract class AbstractInventory { } protected void updateSlot(InventoryDatabaseServer db, int slot, ItemStack stack) { + if (stack == null) { + emptySlot(db, slot); + } else { + updateSlot(db, slot, stack, stack.stackSize); + } + } + + protected void updateSlot(InventoryDatabaseServer db, int slot, ItemStack stack, int count) { SlotKey slotKey = slotKeys[slot]; ItemEntry current = slotKey != null ? slotKey.item : null; ItemEntry key = db.lookupItem(stack, current, true); if (key != current) { - updateSlotKey(db, slot, slotKey, key, stack); - } else if (slotKey != null && slotKey.count != stack.stackSize) { - slotKey.count = stack.stackSize; + updateSlotKey(db, slot, slotKey, key, count); + } else if (slotKey != null && slotKey.count != count) { + slotKey.count = count; db.entryChanged(current); } } - private void updateSlotKey(InventoryDatabaseServer db, int slot, SlotKey slotKey, ItemEntry key, ItemStack stack) { + protected void emptySlot(InventoryDatabaseServer db, int slot) { + SlotKey slotKey = slotKeys[slot]; + if (slotKey != null) { + slotKey.remove(db); + slotKeys[slot] = null; + } + } + + private void updateSlotKey(InventoryDatabaseServer db, int slot, SlotKey slotKey, ItemEntry key, int count) { if (slotKey != null) { slotKey.remove(db); slotKey = null; } if (key != null) { - slotKey = new SlotKey(this, slot, key, stack.stackSize); + slotKey = new SlotKey(this, slot, key, count); key.addSlot(slotKey); db.entryChanged(key); } diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/DrawerGroupInventory.java b/src/main/java/crazypants/enderio/machine/invpanel/server/DrawerGroupInventory.java new file mode 100644 index 00000000..be93d634 --- /dev/null +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/DrawerGroupInventory.java @@ -0,0 +1,66 @@ +package crazypants.enderio.machine.invpanel.server; + +import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; +import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup; +import net.minecraft.item.ItemStack; + +public class DrawerGroupInventory extends AbstractInventory { + final IDrawerGroup dg; + + public DrawerGroupInventory(IDrawerGroup dg) { + this.dg = dg; + } + + @Override + int scanInventory(InventoryDatabaseServer db) { + int count = dg.getDrawerCount(); + if (count == 0) { + setEmpty(db); + return 0; + } + if (count != slotKeys.length) { + reset(db, count); + } + for (int i = 0; i < count; i++) { + IDrawer drawer = dg.getDrawer(i); + ItemStack stack; + int quantity; + if (drawer != null && + (quantity = drawer.getStoredItemCount()) > 0 && + (stack = drawer.getStoredItemPrototype()) != null && + drawer.canItemBeExtracted(stack)) { + updateSlot(db, i, stack, quantity); + } else { + emptySlot(db, i); + } + } + return count; + } + + @Override + int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) { + if (slot >= dg.getDrawerCount()) { + return 0; + } + IDrawer drawer = dg.getDrawer(slot); + if (drawer == null) { + return 0; + } + int remaining = drawer.getStoredItemCount(); + if (remaining <= 0) { + return 0; + } + ItemStack stack = drawer.getStoredItemPrototype(); + if (db.lookupItem(stack, entry, false) != entry) { + return 0; + } + if (count > remaining) { + count = remaining; + } + remaining -= count; + drawer.setStoredItemCount(remaining); + updateCount(db, slot, entry, remaining); + return count; + } + +} diff --git a/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java b/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java index a55e0d22..84b798ea 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/server/InventoryDatabaseServer.java @@ -18,7 +18,6 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; -import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; public class InventoryDatabaseServer extends InventoryDatabase { @@ -179,11 +178,7 @@ public class InventoryDatabaseServer extends InventoryDatabase { this.inventories = new AbstractInventory[sources.size()]; for(int i=0; i factories; + + static { + factories = new ArrayList(); + factories.add(new DSUFactory()); + if (Loader.isModLoaded("StorageDrawers")) { + factories.add(new DrawerFactory()); + } + } + + static AbstractInventory createInventory(NetworkedInventory ni) { + for(InventoryFactory f : factories) { + AbstractInventory ai = f.create(ni); + if (ai != null) { + return ai; + } + } + return new NormalInventory(ni); + } + + abstract AbstractInventory create(NetworkedInventory ni); + + static class DSUFactory extends InventoryFactory { + @Override + AbstractInventory create(NetworkedInventory ni) { + ISidedInventory inv = ni.getInventory(); + if (inv instanceof IDeepStorageUnit) { + return new DSUInventory((IDeepStorageUnit) inv); + } + return null; + } + } + + static class DrawerFactory extends InventoryFactory { + @Override + AbstractInventory create(NetworkedInventory ni) { + ISidedInventory inv = ni.getInventory(); + if (inv instanceof IDrawerGroup) { + return new DrawerGroupInventory((IDrawerGroup) inv); + } + return null; + } + } +} From 4fa83c1114b4ed02a9fe1f9a65e809a4274cbe8b Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 19:06:02 -0400 Subject: [PATCH 22/33] #1668 Fix attractor obelisk behavior with endermen --- .../obelisk/attractor/BlockAttractor.java | 2 + .../obelisk/attractor/EndermanFixer.java | 15 ++++++ .../obelisk/attractor/TileAttractor.java | 46 +++++++++++++------ 3 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 src/main/java/crazypants/enderio/machine/obelisk/attractor/EndermanFixer.java diff --git a/src/main/java/crazypants/enderio/machine/obelisk/attractor/BlockAttractor.java b/src/main/java/crazypants/enderio/machine/obelisk/attractor/BlockAttractor.java index 62a5a2a1..55cfa855 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/attractor/BlockAttractor.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/attractor/BlockAttractor.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import crazypants.enderio.GuiHandler; @@ -15,6 +16,7 @@ public class BlockAttractor extends BlockObeliskAbstract { public static BlockAttractor create() { BlockAttractor res = new BlockAttractor(); res.init(); + MinecraftForge.EVENT_BUS.register(new EndermanFixer()); return res; } diff --git a/src/main/java/crazypants/enderio/machine/obelisk/attractor/EndermanFixer.java b/src/main/java/crazypants/enderio/machine/obelisk/attractor/EndermanFixer.java new file mode 100644 index 00000000..86d98966 --- /dev/null +++ b/src/main/java/crazypants/enderio/machine/obelisk/attractor/EndermanFixer.java @@ -0,0 +1,15 @@ +package crazypants.enderio.machine.obelisk.attractor; + +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraftforge.event.entity.living.EnderTeleportEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public class EndermanFixer { + + @SubscribeEvent + public void onEndermanTeleport(EnderTeleportEvent event) { + if (event.entityLiving instanceof EntityEnderman && event.entityLiving.getEntityData().getBoolean("EIO:tracked")) { + event.setCanceled(true); + } + } +} diff --git a/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java b/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java index d7a4bcd1..f40e6d56 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java @@ -9,6 +9,7 @@ import java.util.Set; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAITasks; import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry; @@ -25,6 +26,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import net.minecraft.world.WorldSettings.GameType; import net.minecraftforge.common.util.FakePlayer; import com.mojang.authlib.GameProfile; @@ -35,6 +37,7 @@ import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; import crazypants.enderio.config.Config; import crazypants.enderio.machine.AbstractPowerConsumerEntity; +import crazypants.enderio.machine.FakePlayerEIO; import crazypants.enderio.machine.SlotDefinition; import crazypants.enderio.machine.ranged.IRanged; import crazypants.enderio.machine.ranged.RangeEntity; @@ -166,13 +169,31 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange onEntityTick(ent); } else if(tracking.size() < maxMobsAttracted && trackMob(ent)) { trackingThisTick.add(ent); + onTracked(ent); } } } + for (EntityLiving e : tracking) { + if (!trackingThisTick.contains(e)) { + onUntracked(e); + } + } tracking.clear(); tracking = trackingThisTick; return false; } + + private void onUntracked(EntityLiving e) { + if (e instanceof EntityEnderman) { + e.getEntityData().setBoolean("EIO:tracked", false); + } + } + + private void onTracked(EntityLiving e) { + if (e instanceof EntityEnderman) { + e.getEntityData().setBoolean("EIO:tracked", true); + } + } protected double usePower() { return usePower(getPowerUsePerTick()); @@ -281,10 +302,6 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange } private boolean applySpecialCase(EntityLiving ent) { - return ent instanceof EntitySlime || ent instanceof EntitySilverfish || ent instanceof EntityBlaze; - } - - private boolean useSpecialCase(EntityLiving ent) { if(ent instanceof EntitySlime) { ent.faceEntity(getTarget(), 10.0F, 20.0F); return true; @@ -298,6 +315,10 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange return false; } + private boolean useSpecialCase(EntityLiving ent) { + return ent instanceof EntitySlime || ent instanceof EntitySilverfish || ent instanceof EntityBlaze; + } + private void onEntityTick(EntityLiving ent) { if(ent instanceof EntitySlime) { ent.faceEntity(getTarget(), 10.0F, 20.0F); @@ -325,7 +346,9 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange } } else if(ent instanceof EntityPigZombie || ent instanceof EntitySpider) { forceMove(ent); - } + } else if(ent instanceof EntityEnderman) { + ((EntityEnderman) ent).setTarget(getTarget()); + } } private void forceMove(EntityLiving ent) { @@ -346,19 +369,14 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange } private boolean useSetTarget(EntityLiving ent) { - return ent instanceof EntityEnderman || ent instanceof EntityPigZombie || ent instanceof EntitySpider || ent instanceof EntitySilverfish; + return ent instanceof EntityPigZombie || ent instanceof EntitySpider || ent instanceof EntitySilverfish; } - private class Target extends FakePlayer { - - ItemStack prevWeapon; + private class Target extends FakePlayerEIO { public Target() { - super(MinecraftServer.getServer().worldServerForDimension(getWorldObj().provider.dimensionId), new GameProfile(null, - ModObject.blockAttractor.unlocalisedName + ":" + getLocation())); - posX = xCoord + 0.5; - posY = yCoord + 1.5; - posZ = zCoord + 0.5; + super(getWorldObj(), getLocation(), new GameProfile(null, ModObject.blockAttractor.unlocalisedName + ":" + getLocation())); + posY += 1; } } From e49275235b5efa988c34f86f9b263ad829965a8e Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sat, 13 Jun 2015 08:32:19 +0200 Subject: [PATCH 23/33] #2579 protect against blocks without a registered name, also compile the patterns just once --- .../enderio/machine/farm/FarmersRegistry.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java b/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java index b47672e7..60b61bb2 100644 --- a/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java +++ b/src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java @@ -10,6 +10,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; public final class FarmersRegistry { @@ -209,15 +210,18 @@ public final class FarmersRegistry { @SuppressWarnings("unchecked") private static void addGrowableOres() { String mod = "B0bGrowsOre"; - String[] growableOres = { "(.+)Reed", "oreGrowable(.+)" }; + if (!Loader.isModLoaded(mod)) { + return; + } + Pattern[] growableOres = { Pattern.compile("(.+)Reed"), Pattern.compile("oreGrowable(.+)") }; Iterator blockIter = Block.blockRegistry.iterator(); while (blockIter.hasNext()) { Block block = blockIter.next(); String name = Block.blockRegistry.getNameForObject(block); - if (name.startsWith(mod)) { - for (String blockName : growableOres) { - if (Pattern.compile(blockName).matcher(name).find()) { + if (name != null && name.startsWith(mod)) { + for (Pattern blockPattern : growableOres) { + if (blockPattern.matcher(name).find()) { FarmersCommune.joinCommune(new StemFarmer(block, new ItemStack(block))); } } From 5dfd976d43cfa2938de71e8a54845fa95b11469b Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sun, 14 Jun 2015 11:54:36 +0200 Subject: [PATCH 24/33] try to fix javadoc --- build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle b/build.gradle index da6adfbe..8fa34274 100644 --- a/build.gradle +++ b/build.gradle @@ -111,6 +111,14 @@ task exportJavadoc(type: Javadoc) { source = sourceSets.main.allSource } +if (JavaVersion.current().isJava8Compatible()) { + allprojects { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } + } +} + build.dependsOn sourceJar, deobfJar, apiJar, exportJavadoc publishing { From e3e3d26885b3f80ce6fb403c0f18724adf00c4b5 Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sun, 14 Jun 2015 11:55:25 +0200 Subject: [PATCH 25/33] #2582 fix recipe typos --- src/main/java/crazypants/enderio/material/Alloy.java | 2 +- src/main/java/crazypants/enderio/material/MaterialRecipes.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/crazypants/enderio/material/Alloy.java b/src/main/java/crazypants/enderio/material/Alloy.java index 694419a2..8b5865f2 100644 --- a/src/main/java/crazypants/enderio/material/Alloy.java +++ b/src/main/java/crazypants/enderio/material/Alloy.java @@ -44,7 +44,7 @@ public enum Alloy { } public ItemStack getStackBlock() { - return getStackIngot(1); + return getStackBlock(1); } public ItemStack getStackBlock(int size) { diff --git a/src/main/java/crazypants/enderio/material/MaterialRecipes.java b/src/main/java/crazypants/enderio/material/MaterialRecipes.java index a51113a6..c02d02b1 100644 --- a/src/main/java/crazypants/enderio/material/MaterialRecipes.java +++ b/src/main/java/crazypants/enderio/material/MaterialRecipes.java @@ -93,7 +93,7 @@ public class MaterialRecipes { ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); //Conduit Binder - ItemStack cbc = CONDUIT_BINDER.getStack(8); + ItemStack cbc = BINDER_COMPOSITE.getStack(8); if (Config.useAlternateBinderRecipe) { addShaped(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); } else { From ae2c783e1efa30d8528b449ddd5f5743e43be07f Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sun, 14 Jun 2015 22:29:38 +0200 Subject: [PATCH 26/33] #2584 don't crash on empty fluid containers --- src/main/java/crazypants/util/FluidUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/util/FluidUtil.java b/src/main/java/crazypants/util/FluidUtil.java index e7ff8df1..117af4b9 100644 --- a/src/main/java/crazypants/util/FluidUtil.java +++ b/src/main/java/crazypants/util/FluidUtil.java @@ -250,7 +250,8 @@ public class FluidUtil { if (source != null && source.getItem() != null) { if (source.getItem() instanceof IFluidContainerItem) { - IFluidTank targetTank = tank.getInputTank(((IFluidContainerItem) source.getItem()).getFluid(source)); + FluidStack fluid = ((IFluidContainerItem) source.getItem()).getFluid(source); + IFluidTank targetTank = fluid != null ? tank.getInputTank(fluid) : null; if (targetTank != null) { FluidStack target = targetTank.getFluid(); int maxDrain = targetTank.getCapacity() - (target != null ? target.amount : 0); From fe3b56c9243d1d39c29f4f0826a63c0c94d4f3ba Mon Sep 17 00:00:00 2001 From: HenryLoenwind Date: Wed, 17 Jun 2015 01:46:44 +0200 Subject: [PATCH 27/33] Fix: Combustion Generator Input Tank Handling * Combustion Generator Input Tank Handling wasn't implementing the interface correctly, leading to NPEs * re #2584 --- .../combustion/TileCombustionGenerator.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/generator/combustion/TileCombustionGenerator.java b/src/main/java/crazypants/enderio/machine/generator/combustion/TileCombustionGenerator.java index 134cbfee..cbcea4de 100644 --- a/src/main/java/crazypants/enderio/machine/generator/combustion/TileCombustionGenerator.java +++ b/src/main/java/crazypants/enderio/machine/generator/combustion/TileCombustionGenerator.java @@ -419,11 +419,13 @@ public class TileCombustionGenerator extends AbstractGeneratorEntity implements @Override public FluidTank getInputTank(FluidStack forFluidType) { - if (FluidFuelRegister.instance.getCoolant(forFluidType.getFluid()) != null) { - return coolantTank; - } - if (FluidFuelRegister.instance.getFuel(forFluidType.getFluid()) != null) { - return fuelTank; + if (forFluidType != null) { + if (FluidFuelRegister.instance.getCoolant(forFluidType.getFluid()) != null) { + return coolantTank; + } + if (FluidFuelRegister.instance.getFuel(forFluidType.getFluid()) != null) { + return fuelTank; + } } return null; } From 75b677a91d0d737c8c012be224048208ce9e4c7c Mon Sep 17 00:00:00 2001 From: HenryLoenwind Date: Wed, 17 Jun 2015 17:33:08 +0200 Subject: [PATCH 28/33] Fix: Telepad multipart * Allow coords to be set on any block of the multiblock, not just the master * Prevent maxPower to be 0 --- .../crazypants/enderio/teleport/telepad/TileTelePad.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java b/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java index 34bb5ac3..ab5e38d5 100644 --- a/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java +++ b/src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java @@ -346,6 +346,9 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei int distance = new BlockCoord(this).distance(target); double base = Math.log((0.005 * distance) + 1); this.maxPower = (int) (base * Config.telepadPowerCoefficient); + if (this.maxPower <= 0) { + this.maxPower = 1; + } } else { this.maxPower = Config.telepadPowerInterdimensional; } @@ -523,7 +526,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei this.target = coords; this.coordsChanged = true; } else { - this.master.setCoords(coords); + this.master.setCoords_internal(coords); } } } From 4203014011106de74911fe3c7a6554c35488b399 Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Wed, 17 Jun 2015 22:46:52 +0200 Subject: [PATCH 29/33] #2591 add some peaceful recipe alternatives --- src/main/java/crazypants/enderio/config/Config.java | 3 +++ src/main/java/crazypants/enderio/machine/MachineRecipes.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index 78b94845..05d0bab3 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -104,6 +104,7 @@ public final class Config { public static File configDirectory; public static boolean useHardRecipes = false; + public static boolean addPeacefulRecipes = false; public static boolean allowExternalTickSpeedup = true; public static boolean useSteelInChassi = false; @@ -586,6 +587,8 @@ public final class Config { useHardRecipes = config.get(sectionRecipe.name, "useHardRecipes", useHardRecipes, "When enabled machines cost significantly more.") .getBoolean(useHardRecipes); + addPeacefulRecipes = config.get(sectionRecipe.name, "addPeacefulRecipes", addPeacefulRecipes, "When enabled peaceful recipes are added for soulbinder based crafting components.") + .getBoolean(addPeacefulRecipes); soulBinderRequiresEndermanSkull = config.getBoolean("soulBinderRequiresEndermanSkull", sectionRecipe.name, soulBinderRequiresEndermanSkull, "When true the Soul Binder requires an Enderman Skull to craft"); allowTileEntitiesAsPaintSource = config.get(sectionRecipe.name, "allowTileEntitiesAsPaintSource", allowTileEntitiesAsPaintSource, diff --git a/src/main/java/crazypants/enderio/machine/MachineRecipes.java b/src/main/java/crazypants/enderio/machine/MachineRecipes.java index c0d3aeae..c1bdb7c1 100644 --- a/src/main/java/crazypants/enderio/machine/MachineRecipes.java +++ b/src/main/java/crazypants/enderio/machine/MachineRecipes.java @@ -56,6 +56,11 @@ public class MachineRecipes { String binder = CONDUIT_BINDER.oreDict; String silicon = SILICON.oreDict; + if (Config.addPeacefulRecipes) { + addShaped(frankenZombie, "gdg", "dzd", "gdg", 'g', Items.gold_ingot, 'd', Items.diamond, 'z', zombieController); + addShaped(sentientEnder, "ddd", "ded", "dgd", 'g', Blocks.gold_block, 'd', Items.diamond, 'e', enderRes); + } + //stirling gen ItemStack stirlingGen = new ItemStack(EnderIO.blockStirlingGenerator, 1, 0); addShaped(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear); From 2cf20667241ae33b93046ed688761082f55f1252 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 21 Jun 2015 11:23:58 -0400 Subject: [PATCH 30/33] #2594 Farming Station not displaying notification with stem farmer --- .../enderio/machine/farm/farmers/StemFarmer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/farm/farmers/StemFarmer.java b/src/main/java/crazypants/enderio/machine/farm/farmers/StemFarmer.java index a4a75a02..3352b3d4 100644 --- a/src/main/java/crazypants/enderio/machine/farm/farmers/StemFarmer.java +++ b/src/main/java/crazypants/enderio/machine/farm/farmers/StemFarmer.java @@ -50,18 +50,23 @@ public class StemFarmer extends CustomSeedFarmer { boolean done = false; do{ harvestCoord = harvestCoord.getLocation(ForgeDirection.UP); - if(plantedBlock == farm.getBlock(harvestCoord) && farm.hasHoe()) { + boolean hasHoe = farm.hasHoe(); + if(plantedBlock == farm.getBlock(harvestCoord) && hasHoe) { res.harvestedBlocks.add(harvestCoord); ArrayList drops = plantedBlock.getDrops(farm.getWorldObj(), harvestCoord.x, harvestCoord.y, harvestCoord.z, meta, farm.getMaxLootingValue()); if(drops != null) { for(ItemStack drop : drops) { res.drops.add(new EntityItem(farm.getWorldObj(), bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, drop.copy())); } - } farm.damageHoe(1, harvestCoord); farm.actionPerformed(false); } else { + if (!hasHoe) { + farm.setNotification(TileFarmStation.NOTIFICATION_NO_HOE); + } else { + farm.clearNotification(); + } done = true; } } while(!done); From 7eb77c5108e4ac02778265374aa5208563aa0eaf Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 21 Jun 2015 11:29:27 -0400 Subject: [PATCH 31/33] Attractor obelisk should call onUntracked when invalidated --- .../enderio/machine/obelisk/attractor/TileAttractor.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java b/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java index f40e6d56..ed203454 100644 --- a/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java +++ b/src/main/java/crazypants/enderio/machine/obelisk/attractor/TileAttractor.java @@ -194,6 +194,15 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange e.getEntityData().setBoolean("EIO:tracked", true); } } + + @Override + public void invalidate() { + super.invalidate(); + for (EntityLiving e : tracking) { + onUntracked(e); + } + tracking.clear(); + } protected double usePower() { return usePower(getPowerUsePerTick()); From 7dae561b891dd5418f5511e4a0f3e1b69d0f7fcd Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 21 Jun 2015 12:02:29 -0400 Subject: [PATCH 32/33] Allow copying of any amount of filters --- .../conduit/item/filter/CopyFilterRecipe.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/item/filter/CopyFilterRecipe.java b/src/main/java/crazypants/enderio/conduit/item/filter/CopyFilterRecipe.java index 8e3f7d5b..d3d36c74 100644 --- a/src/main/java/crazypants/enderio/conduit/item/filter/CopyFilterRecipe.java +++ b/src/main/java/crazypants/enderio/conduit/item/filter/CopyFilterRecipe.java @@ -19,30 +19,30 @@ public class CopyFilterRecipe implements IRecipe{ @Override public boolean matches(InventoryCrafting inv, World world) { - ItemStack blankInput = null; + int blankCount = 0; ItemStack filterInput = null; for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack checkStack = inv.getStackInSlot(i); if (checkStack != null && checkStack.getItem() instanceof IItemFilterUpgrade) { if(FilterRegister.isFilterSet(checkStack)) { - if(filterInput != null || !isSameTypeOrNull(blankInput, checkStack)) { - return false; - } - filterInput = checkStack; - } else { - if(blankInput != null || !isSameTypeOrNull(filterInput, checkStack)) { + if(filterInput != null) { return false; } - blankInput = checkStack; + filterInput = checkStack; + } else { + if(!isSameTypeOrNull(filterInput, checkStack)) { + return false; + } + blankCount++; } } } - if(blankInput == null || filterInput == null) { + if(blankCount == 0 || filterInput == null) { return false; } output = filterInput.copy(); - output.stackSize = 2; + output.stackSize = blankCount + 1; return true; } From 2b0db0a54385765e325cf4443da3d3381c2c0749 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 21 Jun 2015 12:12:02 -0400 Subject: [PATCH 33/33] #2597 Conduit Probe does not copy ender fluid conduit filter --- .../conduit/liquid/EnderLiquidConduit.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/crazypants/enderio/conduit/liquid/EnderLiquidConduit.java b/src/main/java/crazypants/enderio/conduit/liquid/EnderLiquidConduit.java index 5cc3ab51..271a9596 100644 --- a/src/main/java/crazypants/enderio/conduit/liquid/EnderLiquidConduit.java +++ b/src/main/java/crazypants/enderio/conduit/liquid/EnderLiquidConduit.java @@ -296,6 +296,38 @@ public class EnderLiquidConduit extends AbstractLiquidConduit { } return network.getTankInfo(this, from); } + + @Override + protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) { + super.readTypeSettings(dir, dataRoot); + if (dataRoot.hasKey("outputFilters")) { + FluidFilter out = new FluidFilter(); + out.readFromNBT(dataRoot.getCompoundTag("outputFilters")); + outputFilters.put(dir, out); + } + if (dataRoot.hasKey("inputFilters")) { + FluidFilter in = new FluidFilter(); + in.readFromNBT(dataRoot.getCompoundTag("inputFilters")); + inputFilters.put(dir, in); + } + } + + @Override + protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) { + super.writeTypeSettingsToNbt(dir, dataRoot); + FluidFilter out = outputFilters.get(dir); + if (out != null) { + NBTTagCompound outTag = new NBTTagCompound(); + out.writeToNBT(outTag); + dataRoot.setTag("outputFilters", outTag); + } + FluidFilter in = inputFilters.get(dir); + if (in != null) { + NBTTagCompound inTag = new NBTTagCompound(); + in.writeToNBT(inTag); + dataRoot.setTag("inputFilters", inTag); + } + } @Override public void writeToNBT(NBTTagCompound nbtRoot) { @@ -320,7 +352,6 @@ public class EnderLiquidConduit extends AbstractLiquidConduit { } } } - } @Override