diff --git a/build.gradle b/build.gradle index 8f149046..ca4d7052 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ dependencies { compile "mezz.jei:jei_${config.jei_mc_version}:${config.jei_version}" } -version = "${project.config.mod_version}." + (System.getenv("BUILD_NUMBER") ?: "36") +version = "${project.config.mod_version}." + (System.getenv("BUILD_NUMBER") ?: "1") println config.mc_version + "-" + config.forge_version // Setup the Forge/Minecraft plugin data. Specify the preferred Forge/Minecraft version here. diff --git a/src/main/java/cofh/thermalexpansion/block/BlockTEBase.java b/src/main/java/cofh/thermalexpansion/block/BlockTEBase.java index c144bfdc..b1738812 100644 --- a/src/main/java/cofh/thermalexpansion/block/BlockTEBase.java +++ b/src/main/java/cofh/thermalexpansion/block/BlockTEBase.java @@ -46,7 +46,7 @@ public abstract class BlockTEBase extends BlockCoreTile { protected BlockTEBase(Material material) { - super(material); + super(material, "thermalexpansion"); setSoundType(SoundType.STONE); setCreativeTab(ThermalExpansion.tabCommon); } diff --git a/src/main/java/cofh/thermalexpansion/block/storage/TileCache.java b/src/main/java/cofh/thermalexpansion/block/storage/TileCache.java index 95d7913b..aecde4e5 100644 --- a/src/main/java/cofh/thermalexpansion/block/storage/TileCache.java +++ b/src/main/java/cofh/thermalexpansion/block/storage/TileCache.java @@ -91,7 +91,7 @@ public static void config() { boolean lock = false; int cacheStackSize; int maxCacheStackSize; - int maxCapacity; + int maxCapacity = Integer.MAX_VALUE; public ItemStack storedStack = ItemStack.EMPTY; @@ -99,9 +99,7 @@ public TileCache() { inventory = new ItemStack[2]; Arrays.fill(inventory, ItemStack.EMPTY); - - maxCapacity = getCapacity(0, 0); - maxCacheStackSize = maxCapacity - 64 * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(0, 0)) - 64 * 2; } @Override @@ -166,12 +164,10 @@ protected boolean setLevel(int level) { if (super.setLevel(level)) { if (!storedStack.isEmpty()) { - maxCapacity = getCapacity(level, enchantHolding); - maxCacheStackSize = maxCapacity - storedStack.getMaxStackSize() * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(level, enchantHolding)) - storedStack.getMaxStackSize() * 2; balanceStacks(); } else { - maxCapacity = getCapacity(level, enchantHolding); - maxCacheStackSize = maxCapacity - 64 * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(level, enchantHolding)) - 64 * 2; } return true; } @@ -346,11 +342,9 @@ public void readFromNBT(NBTTagCompound nbt) { if (nbt.hasKey("Item")) { storedStack = ItemHelper.readItemStackFromNBT(nbt.getCompoundTag("Item")); cacheStackSize = nbt.getInteger("CacheCount"); - maxCapacity = getCapacity(level, enchantHolding); - maxCacheStackSize = maxCapacity - storedStack.getMaxStackSize() * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(level, enchantHolding)) - storedStack.getMaxStackSize() * 2; } else { - maxCapacity = getCapacity(level, enchantHolding); - maxCacheStackSize = maxCapacity - 64 * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(level, enchantHolding)) - 64 * 2; lock = false; } } @@ -482,8 +476,7 @@ public void setStoredItemType(ItemStack stack, int amount) { } else { storedStack = ItemHelper.cloneStack(stack, 1); cacheStackSize = Math.min(amount, getMaxStoredCount()); - maxCapacity = getCapacity(level, enchantHolding); - maxCacheStackSize = maxCapacity - storedStack.getMaxStackSize() * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(level, enchantHolding)) - storedStack.getMaxStackSize() * 2; balanceStacks(); } updateTrackers(); @@ -579,8 +572,7 @@ public void setInventorySlotContents(int slot, ItemStack stack) { storedStack = ItemHelper.cloneStack(inventory[0], 1); cacheStackSize = inventory[0].getCount(); inventory[0] = ItemStack.EMPTY; - maxCapacity = getCapacity(level, enchantHolding); - maxCacheStackSize = maxCapacity - storedStack.getMaxStackSize() * 2; + maxCacheStackSize = Math.min(maxCapacity, getCapacity(level, enchantHolding)) - storedStack.getMaxStackSize() * 2; } else { cacheStackSize += inventory[0].getCount() + inventory[1].getCount(); } diff --git a/src/main/java/cofh/thermalexpansion/item/ItemSatchel.java b/src/main/java/cofh/thermalexpansion/item/ItemSatchel.java index c1e7bea3..16251d9b 100644 --- a/src/main/java/cofh/thermalexpansion/item/ItemSatchel.java +++ b/src/main/java/cofh/thermalexpansion/item/ItemSatchel.java @@ -307,6 +307,8 @@ public static boolean onItemPickup(EntityItemPickupEvent event, ItemStack stack) if (isVoid(stack)) { eventItem.setCount(0); stack.setAnimationsToGo(5); + EntityPlayer player = event.getEntityPlayer(); + player.world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, (MathHelper.RANDOM.nextFloat() - MathHelper.RANDOM.nextFloat()) * 0.7F + 1.0F); stack.getTagCompound().setInteger("Random", MathHelper.RANDOM.nextInt()); return true; } else if (!(eventItem.getItem() instanceof IInventoryContainerItem) || ((IInventoryContainerItem) eventItem.getItem()).getSizeInventory(stack) <= 0) { diff --git a/src/main/java/cofh/thermalexpansion/plugins/jei/JEIPluginTE.java b/src/main/java/cofh/thermalexpansion/plugins/jei/JEIPluginTE.java index d517fa25..9edda368 100644 --- a/src/main/java/cofh/thermalexpansion/plugins/jei/JEIPluginTE.java +++ b/src/main/java/cofh/thermalexpansion/plugins/jei/JEIPluginTE.java @@ -29,6 +29,7 @@ import cofh.thermalexpansion.plugins.jei.machine.transposer.TransposerRecipeCategory; import mezz.jei.api.*; import mezz.jei.api.recipe.IRecipeCategoryRegistration; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -127,7 +128,8 @@ public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { public static void refresh() { - EnchanterRecipeCategory.refresh(); + // This is done because JEI whines otherwise. + Minecraft.getMinecraft().addScheduledTask(EnchanterRecipeCategory::refresh); } /* HELPERS */ diff --git a/src/main/java/cofh/thermalexpansion/plugins/jei/machine/enchanter/EnchanterRecipeCategory.java b/src/main/java/cofh/thermalexpansion/plugins/jei/machine/enchanter/EnchanterRecipeCategory.java index 4da6eff3..77f2fc62 100644 --- a/src/main/java/cofh/thermalexpansion/plugins/jei/machine/enchanter/EnchanterRecipeCategory.java +++ b/src/main/java/cofh/thermalexpansion/plugins/jei/machine/enchanter/EnchanterRecipeCategory.java @@ -75,20 +75,18 @@ public static void refresh() { List enchanterRecipeWrappers = recipeRegistry.getRecipeWrappers(categoryStandard); for (EnchanterRecipeWrapper wrapper : enchanterRecipeWrappers) { - //recipeRegistry.removeRecipe(wrapper, RecipeUidsTE.ENCHANTER); - wrapper.refresh(); + recipeRegistry.removeRecipe(wrapper, RecipeUidsTE.ENCHANTER); + } + enchanterRecipeWrappers.clear(); + + for (EnchanterRecipe recipe : EnchanterManager.getRecipeList()) { + if (recipe.getType() == Type.STANDARD) { + enchanterRecipeWrappers.add(new EnchanterRecipeWrapper(JEIPluginTE.guiHelper, recipe)); + } + } + for (EnchanterRecipeWrapper wrapper : enchanterRecipeWrappers) { + recipeRegistry.addRecipe(wrapper, RecipeUidsTE.ENCHANTER); } - // TODO: This is a temporary half-solution til Mezz gets back to me. - // enchanterRecipeWrappers.clear(); - // - // for (EnchanterRecipe recipe : EnchanterManager.getRecipeList()) { - // if (recipe.getType() == Type.STANDARD) { - // enchanterRecipeWrappers.add(new EnchanterRecipeWrapper(JEIPluginTE.guiHelper, recipe)); - // } - // } - // for (EnchanterRecipeWrapper wrapper : enchanterRecipeWrappers) { - // recipeRegistry.addRecipe(wrapper, RecipeUidsTE.ENCHANTER); - // } // EnchanterRecipeCategoryEmpowered.refresh(registry); } diff --git a/src/main/java/cofh/thermalexpansion/util/managers/dynamo/SteamManager.java b/src/main/java/cofh/thermalexpansion/util/managers/dynamo/SteamManager.java index a652bbc8..067ed149 100644 --- a/src/main/java/cofh/thermalexpansion/util/managers/dynamo/SteamManager.java +++ b/src/main/java/cofh/thermalexpansion/util/managers/dynamo/SteamManager.java @@ -3,6 +3,7 @@ import cofh.core.init.CoreProps; import cofh.core.inventory.ComparableItemStack; import cofh.core.util.helpers.ItemHelper; +import cofh.thermalfoundation.block.BlockStorageResource; import cofh.thermalfoundation.item.ItemMaterial; import com.google.common.collect.ImmutableSet; import gnu.trove.iterator.TObjectIntIterator; @@ -51,7 +52,9 @@ public static void initialize() { addFuel(new ItemStack(Items.COAL, 1, 0), 24000); addFuel(new ItemStack(Blocks.COAL_BLOCK), 24000 * 10); addFuel(new ItemStack(Items.COAL, 1, 1), 16000); + addFuel(ItemHelper.cloneStack(BlockStorageResource.blockCharcoal, 1), 16000 * 10); addFuel(ItemHelper.cloneStack(ItemMaterial.fuelCoke, 1), 40000); + addFuel(ItemHelper.cloneStack(BlockStorageResource.blockCoke, 1), 40000 * 10); loadFuels(); } diff --git a/src/main/java/cofh/thermalexpansion/util/managers/machine/SmelterManager.java b/src/main/java/cofh/thermalexpansion/util/managers/machine/SmelterManager.java index 7758f123..b64746c0 100644 --- a/src/main/java/cofh/thermalexpansion/util/managers/machine/SmelterManager.java +++ b/src/main/java/cofh/thermalexpansion/util/managers/machine/SmelterManager.java @@ -23,6 +23,7 @@ public class SmelterManager { private static Map, SmelterRecipe> recipeMap = new THashMap<>(); + private static Map, SmelterRecipe> recipeMapRecycle = new THashMap<>(); private static Set validationSet = new THashSet<>(); private static Set lockSet = new THashSet<>(); @@ -268,8 +269,8 @@ public static void initialize() { { int energy = DEFAULT_ENERGY * 3 / 2; - addRecipe(energy, BLOCK_SAND, new ItemStack(Items.COMPASS), new ItemStack(Items.IRON_INGOT, 4), ItemMaterial.crystalSlagRich, 10); // consumes redstone - addRecipe(energy, BLOCK_SAND, new ItemStack(Items.FLINT_AND_STEEL), new ItemStack(Items.IRON_INGOT), ItemMaterial.crystalSlag, 90); // make a use for flint: slag! + addRecipe(energy, BLOCK_SAND, new ItemStack(Items.COMPASS), new ItemStack(Items.IRON_INGOT, 4), ItemMaterial.crystalSlagRich, 10); + addRecipe(energy, BLOCK_SAND, new ItemStack(Items.FLINT_AND_STEEL), new ItemStack(Items.IRON_INGOT), ItemMaterial.crystalSlag, 90); ItemStack ingot = new ItemStack(Items.IRON_INGOT); // no minecart, rails. Railcraft causes resource duplication there @@ -298,7 +299,7 @@ public static void initialize() { } ingot = new ItemStack(Items.GOLD_INGOT); - addRecipe(energy, BLOCK_SAND, new ItemStack(Items.CLOCK), new ItemStack(Items.GOLD_INGOT, 4), ItemMaterial.crystalSlagRich, 10); // consumes redstone + addRecipe(energy, BLOCK_SAND, new ItemStack(Items.CLOCK), new ItemStack(Items.GOLD_INGOT, 4), ItemMaterial.crystalSlagRich, 10); addRecycleRecipe(energy, new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), ingot, 2); addRecycleRecipe(energy, new ItemStack(Items.GOLDEN_SWORD), ingot, 2); @@ -485,7 +486,7 @@ private static void addDefaultOreDictionaryRecipe(String oreName, String dustNam addOreToIngotRecipe(DEFAULT_ENERGY, oreName, ItemHelper.cloneStack(ingot, ORE_MULTIPLIER), ItemHelper.cloneStack(ingot, ORE_MULTIPLIER_SPECIAL), ItemHelper.cloneStack(ingotRelated, 1), richSlagChance, slagOreChance); } if (dustName != null) { - addDustToIngotRecipe(DEFAULT_ENERGY / 5, dustName, ItemHelper.cloneStack(ingot, 2), slagDustChance); + addDustToIngotRecipe(DEFAULT_ENERGY / 8, dustName, ItemHelper.cloneStack(ingot, 1), slagDustChance); } } @@ -563,12 +564,12 @@ private static void addOreToIngotRecipe(int energy, String oreName, ItemStack in } } - private static void addDustToIngotRecipe(int energy, String dustName, ItemStack ingot2, int slagDustChance) { + private static void addDustToIngotRecipe(int energy, String dustName, ItemStack ingot, int slagDustChance) { List registeredOres = OreDictionary.getOres(dustName, false); if (registeredOres.size() > 0) { - addRecipe(energy, ItemHelper.cloneStack(registeredOres.get(0), 2), BLOCK_SAND, ingot2, ItemMaterial.crystalSlag, slagDustChance); + addRecipe(energy, ItemHelper.cloneStack(registeredOres.get(0), 1), BLOCK_SAND, ingot, ItemMaterial.crystalSlag, slagDustChance); } }