diff --git a/.gitignore b/.gitignore index dde8a42..010798b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,31 @@ -.nb-gradle -build -.gradle -run -/MineTweaker3-Web/nbproject/private/ -/MineTweaker3-Web/doc -/MineTweaker3-MC164-Main/eclipse -/ZenScript-Test -*.class +/* -# Package Files # -*.war -*.ear -/build -*/eclipse -/bin -/out +!build.gradle +!/buildSrc/src/ +!/MineTweaker3-API/src/ +!/MineTweaker3-MC18-Main/src/ +!/MineTweaker3-MC1710-Main/bin/ +!/MineTweaker3-MC1710-Main/eclipse/ +!/MineTweaker3-MC1710-Mod-Buildcraft/src/ +!/MineTweaker3-MC1710-Mod-Buildcraft61/src/ +!/MineTweaker3-MC1710-Mod-IC2/src/ +!/MineTweaker3-MC1710-Mod-IC2/libs/ +!/MineTweaker3-MC1710-Mod-MFR/src/ +!/MineTweaker3-MC1710-Mod-MFR/libs/ +!/MineTweaker3-MC1710-Mod-NEI/src/ +!/MineTweaker3-MC1710-Mod-NEI/libs/ +!/ZenScript/src/ +!/MineTweaker3-Web/ -*.mtl -*.classpath -*.project -/.settings -/.idea -/.gradle -*/.settings/ +!/gradlew +!/gradlew.bat +!/gradle/ -*.iml -*.ipr -*.iws -/.metadata/* -*.eml -usernamecache.json -MineTweaker3-MC1710-Main/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location -*.location -MineTweaker3-MC1710-Main/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location -MineTweaker3-MC164-Main/bin/assets/minetweaker/logo.png -MineTweaker3-MC164-Main/bin/mcmod.info \ No newline at end of file +!/common.gradle +!/configuration.gradle +!/gradle.properties + +MineTweaker3-Web/doc + +nbproject/ +Thumbs.db diff --git a/MineTweaker3-MC164-Main/build.gradle b/MineTweaker3-MC164-Main/build.gradle deleted file mode 100644 index eca46e6..0000000 --- a/MineTweaker3-MC164-Main/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion164 -} - - -version = "1.6.4-" + ext.mineTweakerVersion -//group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = project.projectDir.name - -dependencies { - dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - } -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mc164.MineTweakerRegistry' -} - -tasks.jar.dependsOn(makeRegistry) - -processResources -{ - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} diff --git a/MineTweaker3-MC164-Main/gradle/wrapper/gradle-wrapper.jar b/MineTweaker3-MC164-Main/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 667288a..0000000 Binary files a/MineTweaker3-MC164-Main/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/api/minecraft/MineTweakerMC.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/api/minecraft/MineTweakerMC.java deleted file mode 100644 index 9b18a09..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/api/minecraft/MineTweakerMC.java +++ /dev/null @@ -1,460 +0,0 @@ -package minetweaker.api.minecraft; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import minetweaker.MineTweakerAPI; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.data.IData; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.api.player.IPlayer; -import minetweaker.api.world.IBiome; -import minetweaker.api.world.IDimension; -import minetweaker.mc164.block.MCBlockDefinition; -import minetweaker.mc164.block.MCSpecificBlock; -import minetweaker.mc164.block.MCWorldBlock; -import minetweaker.mc164.data.NBTConverter; -import minetweaker.mc164.item.MCItemStack; -import minetweaker.mc164.oredict.MCOreDictEntry; -import minetweaker.mc164.player.MCPlayer; -import minetweaker.mc164.world.MCBiome; -import minetweaker.mc164.world.MCDimension; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * MineTweaker - MineCraft API bridge. - * - * @author Stan Hebben - */ -public class MineTweakerMC { - private static final Map blockDefinitions = new HashMap(); - public static final IBiome[] biomes; - - static { - biomes = new IBiome[BiomeGenBase.biomeList.length]; - for (int i = 0; i < BiomeGenBase.biomeList.length; i++) { - if (BiomeGenBase.biomeList[i] != null) - biomes[i] = new MCBiome(BiomeGenBase.biomeList[i]); - } - } - - private MineTweakerMC() {} - - /** - * Returns the Minecraft item for this MineTweaker item. - * - * @param item minetweaker item stack - * @return minecraft item stack - */ - public static ItemStack getItemStack(IItemStack item) { - if (item == null) return null; - - Object internal = item.getInternal(); - if (internal == null || !(internal instanceof ItemStack)) { - MineTweakerAPI.logError("Not a valid item stack: " + item); - } - return (ItemStack) internal; - } - - /** - * Returns the Minecraft ingredient for this ingredient. This method is only - * useful for ingredients that represent a single item stack. - * - * @param ingredient item ingredient - * @return minecraft item stack - */ - public static ItemStack getItemStack(IIngredient ingredient) { - if (ingredient == null) return null; - - List items = ingredient.getItems(); - if (items.size() != 1) { - MineTweakerAPI.logError("Not an ingredient with a single item: " + ingredient); - } - return getItemStack(items.get(0)); - } - - /** - * Returns the MineTweaker item stack for this item. - * - * @param item minecraft item stack - * @return minetweaker item stack - */ - public static IItemStack getIItemStack(ItemStack item) { - if (item == null) return null; - - return new MCItemStack(item); - } - - /** - * Constructs an item stack with wildcard size. - * - * @param item minecraft item stack - * @return minetweaker stack - */ - public static IItemStack getIItemStackWildcardSize(ItemStack item) { - if (item == null) return null; - - return new MCItemStack(item, true); - } - - /** - * Constructs an item stack with wildcard size. - * - * @param item - * @param meta - * @return minetweaker stack - */ - public static IItemStack getIItemStackWildcardSize(Item item, int meta) { - if (item == null) return null; - - return new MCItemStack(new ItemStack(item, 1, meta), true); - } - - /** - * Constructs an item stack with wildcard damage. - * - * @param item stack item - * @param amount stack size - * @return minetweaker item stack - */ - public static IItemStack getIItemStackWildcard(Item item, int amount) { - if (item == null) return null; - - return new MCItemStack(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE)); - } - - /** - * Constructs an item stack with given item, damage and amount. - * - * @param item stack item - * @param damage stack damage - * @param amount stack amount - * @return minetweaker item stack - */ - public static IItemStack getItemStack(Item item, int amount, int damage) { - if (item == null) return null; - - return new MCItemStack(new ItemStack(item, amount, damage)); - } - - /** - * Converts an array of minetweaker item stacks into an array of minecraft - * item stacks. - * - * @param items minetweker item stacks - * @return minecraft item stacks - */ - public static ItemStack[] getItemStacks(IItemStack... items) { - if (items == null) return null; - - ItemStack[] output = new ItemStack[items.length]; - for (int i = 0; i < items.length; i++) { - Object internal = items[i].getInternal(); - if (internal != null && internal instanceof ItemStack) { - output[i] = (ItemStack) internal; - } - } - return output; - } - - /** - * Converts a list of minetweaker item stacks into an array of minecraft - * item stacks. - * - * @param items minetweaker items - * @return minecraft items - */ - public static ItemStack[] getItemStacks(List items) { - if (items == null) return null; - - ItemStack[] output = new ItemStack[items.size()]; - for (int i = 0; i < items.size(); i++) { - Object internal = items.get(i).getInternal(); - if (internal != null && internal instanceof ItemStack) { - output[i] = (ItemStack) internal; - } else { - MineTweakerAPI.logError("Invalid item stack: " + items.get(i)); - } - } - return output; - } - - /** - * Converts an array of minecraft item stacks into an array of minetweaker - * item stacks. - * - * @param items minecraft item stacks - * @return minetweaker item stacks - */ - public static IItemStack[] getIItemStacks(ItemStack... items) { - if (items == null) return null; - - IItemStack[] result = new IItemStack[items.length]; - for (int i = 0; i < items.length; i++) { - result[i] = new MCItemStack(items[i]); - } - return result; - } - - /** - * Converts a list of minecraft item stacks into an array of minetweaker - * item stacks. - * - * @param items minecraft item stacks - * @return minetweaker item stacks - */ - public static IItemStack[] getIItemStacks(List items) { - if (items == null) return null; - - IItemStack[] result = new IItemStack[items.size()]; - for (int i = 0; i < result.length; i++) { - result[i] = new MCItemStack(items.get(i)); - } - return result; - } - - /** - * Gets the ore dictionary entry with the given name. If the entry didn't - * exist yet, it will create it and return an empty entry. - * - * @param name ore entry name - * @return ore dictionary entry - */ - public static IOreDictEntry getOreDict(String name) { - return new MCOreDictEntry(name); - } - - /** - * Converts a Minecraft player into a MineTweaker player. - * - * @param player minecraft player - * @return minetweaker player - */ - public static IPlayer getIPlayer(EntityPlayer player) { - if (player == null) return null; - - return new MCPlayer(player); - } - - /** - * Converts a MineTweaker player into a Minecraft player. - * - * @param player minetweaker player - * @return minecraft player - */ - public static EntityPlayer getPlayer(IPlayer player) { - if (player == null) return null; - - if (!(player instanceof MCPlayer)) { - MineTweakerAPI.logError("Invalid player: " + player); - } - - return ((MCPlayer) player).getInternal(); - } - - /** - * Converts a Minecraft NBT to an IData instance. The IData instance is - * immutable (not modifyiable). - * - * @param nbt nbt data - * @return IData value - */ - public static IData getIData(NBTBase nbt) { - if (nbt == null) return null; - - return NBTConverter.from(nbt, true); - } - - /** - * Converts a Minecraft NBT to a modifyable IData instance. - * - * @param nbt nbt data - * @return mutable IData value - */ - public static IData getIDataModifyable(NBTBase nbt) { - if (nbt == null) return null; - - return NBTConverter.from(nbt, false); - } - - /** - * Converts an IData instance to an NBT value. - * - * @param data IData value - * @return nbt data - */ - public static NBTBase getNBT(IData data) { - if (data == null) return null; - - return NBTConverter.from(data); - } - - /** - * Converts an IData instance to an NBT Tag compound. - * - * @param data IData value - * @return nbt compound data - */ - public static NBTTagCompound getNBTCompound(IData data) { - if (data == null) return null; - - return (NBTTagCompound) NBTConverter.from(data); - } - - /** - * Retrieves the block at the given position. - * - * @param blocks block access - * @param x block x position - * @param y block y position - * @param z block z position - * @return block instance - */ - public static IBlock getBlock(IBlockAccess blocks, int x, int y, int z) { - return new MCWorldBlock(blocks, x, y, z); - } - - /** - * Retrieves the block definition for the given block. - * - * @param block block object - * @return block definition - */ - public static IBlockDefinition getBlockDefinition(Block block) { - if (!blockDefinitions.containsKey(block)) { - blockDefinitions.put(block, new MCBlockDefinition(block)); - } - return blockDefinitions.get(block); - } - - /** - * Retrieves the block from an item stack. - * - * @param itemStack - * @return - */ - public static Block getBlock(IItemStack itemStack) { - return ((MCBlockDefinition) itemStack.asBlock().getDefinition()).getInternalBlock(); - } - - /** - * Retrieves the dimension instance for a given world. - * - * @param world world - * @return dimension - */ - public static IDimension getDimension(World world) { - if (world == null) return null; - - return new MCDimension(world); - } - - /** - * Returns an instance of the given block. - * - * @param block MC block definition - * @return MT block instance - */ - public static IBlock getBlockAnyMeta(Block block) { - return new MCSpecificBlock(block, OreDictionary.WILDCARD_VALUE); - } - - /** - * Returns an instance of the given block. - * - * @param block MC block definition - * @param meta block meta value - * @return MT block instance - */ - public static IBlock getBlock(Block block, int meta) { - return new MCSpecificBlock(block, meta); - } - - /** - * Retrieves the internal fluid stack of the given stack. - * - * @param stack MT liquid stack - * @return MCF fluid stack - */ - public static FluidStack getLiquidStack(ILiquidStack stack) { - if (stack == null) - return null; - - return (FluidStack) stack.getInternal(); - } - - public static int getBlockId(IBlockDefinition blockDefinition) { - if (blockDefinition instanceof MCBlockDefinition) { - return ((MCBlockDefinition) blockDefinition).getInternalId(); - } else { - throw new IllegalArgumentException("block definition is not generated by MineTweaker"); - } - } - - public static ItemStack toItemStack(IBlock block) { - int mcBlockId = getBlockId(block.getDefinition()); - ItemStack result = new ItemStack(mcBlockId, 1, block.getMeta()); - IData data = block.getTileData(); - if (data != null) { - result.setTagCompound(MineTweakerMC.getNBTCompound(data)); - } - return result; - } - - - private static final HashMap oreDictArrays = new HashMap(); - public static IOreDictEntry getOreDictEntryFromArray(List array) { - if (!oreDictArrays.containsKey(array)) { - for (String ore : OreDictionary.getOreNames()) { - if (OreDictionary.getOres(ore) == array) { - oreDictArrays.put(array, MineTweakerAPI.oreDict.get(ore)); - } - } - } - - return oreDictArrays.get(array); - } - - /** - * Converts a Minecraft ingredient to a MineTweaker ingredient. - * - * @param ingredient minecraft ingredient - * @return minetweaker ingredient - */ - public static IIngredient getIIngredient(Object ingredient) { - if (ingredient == null) { - return null; - } else if (ingredient instanceof String) { - return MineTweakerAPI.oreDict.get((String) ingredient); - } else if (ingredient instanceof Item) { - return getIItemStack(new ItemStack((Item) ingredient, 1, 0)); - } else if (ingredient instanceof ItemStack) { - return getIItemStack((ItemStack) ingredient); - } else if (ingredient instanceof List) { - IOreDictEntry entry = getOreDictEntryFromArray((List) ingredient); - - if (entry == null) { - throw new IllegalArgumentException("No matching oredict entry: " + ingredient); - } - - return entry; - } else { - throw new IllegalArgumentException("Not a valid ingredient: " + ingredient); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/ForgeEventHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/ForgeEventHandler.java deleted file mode 100644 index b6ef35c..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/ForgeEventHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164; - -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.formatting.IFormattedText; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.tooltip.IngredientTooltips; -import minetweaker.mc164.formatting.IMCFormattedString; -import net.minecraftforge.event.ForgeSubscribe; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import org.lwjgl.input.Keyboard; - -/** - * - * @author Stan - */ -public class ForgeEventHandler { - @ForgeSubscribe - public void onPlayerInteract(PlayerInteractEvent ev) { - minetweaker.api.event.PlayerInteractEvent event = new minetweaker.api.event.PlayerInteractEvent( - MineTweakerMC.getIPlayer(ev.entityPlayer), - MineTweakerMC.getDimension(ev.entityPlayer.getEntityWorld()), - ev.x, ev.y, ev.z - ); - - MineTweakerImplementationAPI.events.publishPlayerInteract(event); - } - - @ForgeSubscribe - public void onItemTooltip(ItemTooltipEvent ev) { - IItemStack itemStack = MineTweakerMC.getIItemStack(ev.itemStack); - for (IFormattedText tooltip : IngredientTooltips.getTooltips(itemStack)) { - ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString()); - } - - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - for (IFormattedText tooltip : IngredientTooltips.getShiftTooltips(itemStack)) { - ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString()); - } - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MCPlatformFunctions.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MCPlatformFunctions.java deleted file mode 100644 index fc7716f..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MCPlatformFunctions.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164; - -import cpw.mods.fml.common.network.PacketDispatcher; -import minetweaker.IPlatformFunctions; -import minetweaker.MineTweakerAPI; -import minetweaker.api.chat.IChatMessage; -import minetweaker.api.item.IItemDefinition; -import minetweaker.mc164.chat.MCChatMessage; -import minetweaker.mc164.item.MCItemDefinition; -import minetweaker.mc164.network.MCPacketHandler; -import net.minecraft.item.Item; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet250CustomPayload; - -/** - * - * @author Stan - */ -public class MCPlatformFunctions implements IPlatformFunctions { - public static final MCPlatformFunctions INSTANCE = new MCPlatformFunctions(); - - private MCPlatformFunctions() {} - - @Override - public IChatMessage getMessage(String message) { - return new MCChatMessage(message); - } - - @Override - public void distributeScripts(byte[] data) { - Packet packet = new Packet250CustomPayload( - MCPacketHandler.CHANNEL_SERVERSCRIPT, - MineTweakerAPI.tweaker.getScriptData()); - PacketDispatcher.sendPacketToAllPlayers(packet); - } - - @Override - public IItemDefinition getItemDefinition(int id) { - if (id < 0 || id >= Item.itemsList.length) return null; - Item item = Item.itemsList[id]; - if (item == null) return null; - return new MCItemDefinition(item); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MTCraftingHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MTCraftingHandler.java deleted file mode 100644 index 4e0df29..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MTCraftingHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164; - -import cpw.mods.fml.common.ICraftingHandler; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.event.PlayerCraftedEvent; -import minetweaker.api.event.PlayerSmeltedEvent; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.mc164.recipes.MCCraftingInventory; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -/** - * - * @author Stan - */ -public class MTCraftingHandler implements ICraftingHandler { - @Override - public void onCrafting(EntityPlayer player, ItemStack crafting, IInventory craftMatrix) { - IPlayer iplayer = MineTweakerMC.getIPlayer(player); - - if (MineTweakerMod.INSTANCE.recipes.hasTransformerRecipes()) { - MineTweakerMod.INSTANCE.recipes.applyTransformations(MCCraftingInventory.get(craftMatrix, player), iplayer); - } - - if (MineTweakerImplementationAPI.events.hasPlayerCrafted()) { - MineTweakerImplementationAPI.events.publishPlayerCrafted(new PlayerCraftedEvent( - iplayer, - MineTweakerMC.getIItemStack(crafting), - MCCraftingInventory.get(craftMatrix, player))); - } - } - - @Override - public void onSmelting(EntityPlayer ep, ItemStack is) { - if (MineTweakerImplementationAPI.events.hasPlayerSmelted()) { - MineTweakerImplementationAPI.events.publishPlayerSmelted(new PlayerSmeltedEvent( - MineTweakerMC.getIPlayer(ep), - MineTweakerMC.getIItemStack(is))); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MineTweakerMod.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MineTweakerMod.java deleted file mode 100644 index 95f7187..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MineTweakerMod.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164; - -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.event.FMLServerStoppedEvent; -import cpw.mods.fml.common.network.NetworkMod; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.Player; -import cpw.mods.fml.common.registry.GameRegistry; -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.event.PlayerLoggedInEvent; -import minetweaker.api.event.PlayerLoggedOutEvent; -import minetweaker.api.logger.FileLogger; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.mc164.client.MCClient; -import minetweaker.mc164.formatting.MCFormatter; -import minetweaker.mc164.furnace.FuelTweaker; -import minetweaker.mc164.furnace.MCFurnaceManager; -import minetweaker.mc164.game.MCGame; -import minetweaker.mc164.mods.MCLoadedMods; -import minetweaker.mc164.network.MCConnectionHandler; -import minetweaker.mc164.network.MCPacketHandler; -import minetweaker.mc164.oredict.MCOreDict; -import minetweaker.mc164.recipes.MCRecipeManager; -import minetweaker.mc164.server.MCServer; -import minetweaker.mc164.util.MineTweakerHacks; -import minetweaker.mc164.util.MineTweakerPlatformUtils; -import minetweaker.mc164.vanilla.MCVanilla; -import minetweaker.runtime.IScriptProvider; -import minetweaker.runtime.providers.ScriptProviderCascade; -import minetweaker.runtime.providers.ScriptProviderCustom; -import minetweaker.runtime.providers.ScriptProviderDirectory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.NetHandler; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraftforge.common.MinecraftForge; - -/** - * Main mod class. Performs some general logic, initialization of the API and - * FML event handling. - * - * @author Stan Hebben - */ -@Mod(modid = MineTweakerMod.MODID, version = "3.0.9B") -@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = {MCPacketHandler.CHANNEL_SERVERSCRIPT, MCPacketHandler.CHANNEL_OPENBROWSER}, packetHandler = MCPacketHandler.class) -public class MineTweakerMod { - public static final String MODID = "MineTweaker3"; - public static final String MCVERSION = "1.6.4"; - - private static final String[] REGISTRIES = { - "minetweaker.mods.ic2.ClassRegistry", - "minetweaker.mods.nei.ClassRegistry", - "minetweaker.mods.mfr.ClassRegistry", - "minetweaker.mods.gregtech.ClassRegistry", - "minetweaker.mods.buildcraft.ClassRegistry" - }; - private static final String[] REGISTRY_DESCRIPTIONS = { - "IC2 mod support", - "NEI mod support", - "MFR mod support", - "GregTech mod support", - "Buildcraft mod support" - }; - - @Mod.Instance(MODID) - public static MineTweakerMod INSTANCE; - - public final MCRecipeManager recipes; - private final IScriptProvider scriptsGlobal; - private final ScriptProviderCustom scriptsIMC; - - private final Map networkByUser = new HashMap(); - private final Map userByNetwork = new HashMap(); - - public MineTweakerMod() { - MineTweakerImplementationAPI.init( - new MCOreDict(), - recipes = new MCRecipeManager(), - new MCFurnaceManager(), - MCGame.INSTANCE, - new MCLoadedMods(), - new MCFormatter(), - new MCVanilla()); - - MineTweakerImplementationAPI.logger.addLogger(new FileLogger(new File("minetweaker.log"))); - MineTweakerImplementationAPI.platform = MCPlatformFunctions.INSTANCE; - - File globalDir = new File("scripts"); - if (!globalDir.exists()) { - globalDir.mkdirs(); - } - - scriptsGlobal = new ScriptProviderDirectory(globalDir); - scriptsIMC = new ScriptProviderCustom("intermod"); - MineTweakerImplementationAPI.setScriptProvider(scriptsGlobal); - } - - public void onPlayerLogin(Player player, NetHandler netHandler, INetworkManager manager) { - networkByUser.put(netHandler.getPlayer().username, manager); - userByNetwork.put(manager, netHandler); - - MineTweakerImplementationAPI.events.publishPlayerLoggedIn( - new PlayerLoggedInEvent(MineTweakerMC.getIPlayer(netHandler.getPlayer()))); - } - - public void onPlayerLogout(INetworkManager manager) { - // TODO: there appear to be some problems here - NetHandler netHandler = userByNetwork.get(manager); - if (netHandler != null && netHandler.getPlayer() != null) { - String name = netHandler.getPlayer().username; - networkByUser.remove(name); - userByNetwork.remove(manager); - - MineTweakerImplementationAPI.events.publishPlayerLoggedOut( - new PlayerLoggedOutEvent(MineTweakerMC.getIPlayer(netHandler.getPlayer()))); - } - } - - public void openBrowser(String user, String url) { - if (networkByUser.containsKey(user)) { - networkByUser.get(user).addToSendQueue(new Packet250CustomPayload( - MCPacketHandler.CHANNEL_OPENBROWSER, - MCPacketHandler.UTF8.encode(url).array())); - } - } - - public void copyToClipboard(String user, String data) { - if (networkByUser.containsKey(user)) { - networkByUser.get(user).addToSendQueue(new Packet250CustomPayload( - MCPacketHandler.CHANNEL_OPENBROWSER, - MCPacketHandler.UTF8.encode(data).array())); - } - } - - // ########################## - // ### FML Event Handlers ### - // ########################## - - @EventHandler - public void onIMCEvent(FMLInterModComms.IMCEvent event) { - for (final FMLInterModComms.IMCMessage imcMessage : event.getMessages()) { - if (imcMessage.key.equalsIgnoreCase("addMineTweakerScript")) { - if (imcMessage.isStringMessage()) { - scriptsIMC.add(imcMessage.getSender() + "::imc", imcMessage.getStringValue()); - } else if (imcMessage.isNBTMessage()) { - NBTTagCompound message = imcMessage.getNBTValue(); - scriptsIMC.add(imcMessage.getSender() + "::" + message.getString("name"), message.getString("content")); - } - } - } - } - - @EventHandler - public void onLoad(FMLPreInitializationEvent ev) { - - } - - @EventHandler - public void onPostInit(FMLPostInitializationEvent ev) { - MineTweakerAPI.registerClassRegistry(MineTweakerRegistry.class); - - for (int i = 0; i < REGISTRIES.length; i++) { - MineTweakerAPI.registerClassRegistry(REGISTRIES[i], REGISTRY_DESCRIPTIONS[i]); - } - - FuelTweaker.INSTANCE.register(); - NetworkRegistry.instance().registerConnectionHandler(new MCConnectionHandler()); - GameRegistry.registerCraftingHandler(new MTCraftingHandler()); - - MinecraftForge.EVENT_BUS.register(new ForgeEventHandler()); - } - - @EventHandler - public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { - // starts before loading worlds - // perfect place to start MineTweaker! - - if (MineTweakerPlatformUtils.isClient()) { - MineTweakerAPI.client = new MCClient(); - } - - File scriptsDir = new File(MineTweakerHacks.getWorldDirectory(ev.getServer()), "scripts"); - if (!scriptsDir.exists()) { - scriptsDir.mkdir(); - } - - IScriptProvider scriptsLocal = new ScriptProviderDirectory(scriptsDir); - IScriptProvider cascaded = new ScriptProviderCascade(scriptsIMC, scriptsGlobal, scriptsLocal); - - MineTweakerImplementationAPI.setScriptProvider(cascaded); - MineTweakerImplementationAPI.onServerStart(new MCServer(ev.getServer())); - } - - @EventHandler - public void onServerStarting(FMLServerStartingEvent ev) { - - } - - @EventHandler - public void onServerStopped(FMLServerStoppedEvent ev) { - System.out.println("[MineTweaker] Server stopped"); - - MineTweakerImplementationAPI.onServerStop(); - MineTweakerImplementationAPI.setScriptProvider(scriptsGlobal); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MineTweakerRegistry.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MineTweakerRegistry.java deleted file mode 100644 index d8780f5..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/MineTweakerRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164; - -import java.util.List; - -/** - * - * @author Stan - */ -public class MineTweakerRegistry { - public static void getClasses(List classes) { - // method stub, actual content is generated by build process - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/actions/SetTranslationAction.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/actions/SetTranslationAction.java deleted file mode 100644 index 7c9f238..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/actions/SetTranslationAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.actions; - -import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; -import minetweaker.IUndoableAction; -import minetweaker.mc164.util.MineTweakerHacks; -import net.minecraft.util.StringTranslate; - -/** - * - * @author Stan - */ -public class SetTranslationAction implements IUndoableAction { - private static final StringTranslate INSTANCE = MineTweakerHacks.getStringTranslateInstance(); - private static final Charset UTF8 = Charset.forName("utf-8"); - - private final String key; - private final String newValue; - private final String oldValue; - - public SetTranslationAction(String key, String value) { - this.key = key; - newValue = value; - oldValue = INSTANCE.translateKey(key); - } - - @Override - public void apply() { - set(key, newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - set(key, oldValue); - } - - @Override - public String describe() { - return "Translating " + key + " to " + newValue; - } - - @Override - public String describeUndo() { - return "Reverting " + key + " to " + oldValue; - } - - private static void set(String key, String value) { - StringTranslate.inject(new ByteArrayInputStream((key + "=" + value).getBytes(UTF8))); - } - - @Override - public Object getOverrideKey() { - return null; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCBlockDefinition.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCBlockDefinition.java deleted file mode 100644 index 2e2bf3e..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCBlockDefinition.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.block; - -import minetweaker.api.block.IBlockDefinition; -import net.minecraft.block.Block; - -/** - * - * @author Stan - */ -public class MCBlockDefinition implements IBlockDefinition { - private final Block block; - - public MCBlockDefinition(Block block) { - if (block == null) - throw new IllegalArgumentException("block cannot be null"); - - this.block = block; - } - - public Block getInternalBlock() { - return block; - } - - public int getInternalId() { - return block.blockID; - } - - @Override - public String getId() { - return block.getUnlocalizedName(); - } - - @Override - public String getDisplayName() { - return block.getLocalizedName(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCItemBlock.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCItemBlock.java deleted file mode 100644 index 89eee2b..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCItemBlock.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.block; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.block.BlockPatternOr; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.data.IData; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCItemBlock implements IBlock { - private final ItemStack item; - - public MCItemBlock(ItemStack item) { - this.item = item; - } - - @Override - public IBlockDefinition getDefinition() { - return MineTweakerMC.getBlockDefinition(Block.blocksList[item.itemID]); - } - - @Override - public int getMeta() { - return item.getItemDamage(); - } - - @Override - public IData getTileData() { - if (item.stackTagCompound == null) - return null; - - return MineTweakerMC.getIData(item.stackTagCompound); - } - - @Override - public String getDisplayName() { - return item.getDisplayName(); - } - - @Override - public List getBlocks() { - return Collections.singletonList(this); - } - - @Override - public boolean matches(IBlock block) { - /*if (getDefinition() != block.getDefinition()) { - System.out.println("Different block"); - return false; - } - - if (getMeta() != OreDictionary.WILDCARD_VALUE && getMeta() != block.getMeta()) { - System.out.println("Different meta"); - return false; - } - - if (getTileData() != null && (block.getTileData() == null || !block.getTileData().contains(getTileData()))) { - System.out.println("Different tile data"); - return false; - } - - return true;*/ - - return getDefinition() == block.getDefinition() - && (getMeta() == OreDictionary.WILDCARD_VALUE || getMeta() == block.getMeta()) - && (getTileData() == null || (block.getTileData() != null && block.getTileData().contains(getTileData()))); - } - - @Override - public IBlockPattern or(IBlockPattern pattern) { - return new BlockPatternOr(this, pattern); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCSpecificBlock.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCSpecificBlock.java deleted file mode 100644 index b7d4088..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCSpecificBlock.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.block; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.block.BlockPatternOr; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.data.IData; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCSpecificBlock implements IBlock { - private final Block block; - private final int meta; - - public MCSpecificBlock(Block block, int meta) { - this.block = block; - this.meta = meta; - } - - @Override - public IBlockDefinition getDefinition() { - return MineTweakerMC.getBlockDefinition(block); - } - - @Override - public int getMeta() { - return meta; - } - - @Override - public IData getTileData() { - return null; - } - - @Override - public List getBlocks() { - return Collections.singletonList(this); - } - - @Override - public boolean matches(IBlock block) { - return block.getDefinition() == getDefinition() - && (meta == OreDictionary.WILDCARD_VALUE || block.getMeta() == meta); - } - - @Override - public IBlockPattern or(IBlockPattern pattern) { - return new BlockPatternOr(this, pattern); - } - - @Override - public String getDisplayName() { - return block.getLocalizedName(); - } - - @Override - public String toString() { - return ""; - } - - private static String getBlockId(Block block) - { - return block.getUnlocalizedName(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCWorldBlock.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCWorldBlock.java deleted file mode 100644 index 085a299..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/block/MCWorldBlock.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.block; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.block.BlockPatternOr; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.data.IData; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCWorldBlock implements IBlock { - private final IBlockAccess blocks; - private final int x; - private final int y; - private final int z; - - public MCWorldBlock(IBlockAccess blocks, int x, int y, int z) { - this.blocks = blocks; - this.x = x; - this.y = y; - this.z = z; - } - - @Override - public IBlockDefinition getDefinition() { - return MineTweakerMC.getBlockDefinition(Block.blocksList[blocks.getBlockId(x, y, z)]); - } - - @Override - public int getMeta() { - return blocks.getBlockMetadata(x, y, z); - } - - @Override - public IData getTileData() { - TileEntity tileEntity = blocks.getBlockTileEntity(x, y, z); - - if (tileEntity == null) - return null; - - NBTTagCompound nbt = new NBTTagCompound(); - tileEntity.writeToNBT(nbt); - return MineTweakerMC.getIData(nbt); - } - - @Override - public String getDisplayName() { - int blockId = blocks.getBlockId(x, y, z); - if (Item.itemsList[blockId] != null) { - return (new ItemStack(blockId, 1, getMeta())).getDisplayName(); - } else { - return Block.blocksList[blockId].getLocalizedName(); - } - } - - @Override - public List getBlocks() { - return Collections.singletonList(this); - } - - @Override - public boolean matches(IBlock block) { - return getDefinition() == block.getDefinition() - && (getMeta() == OreDictionary.WILDCARD_VALUE || getMeta() == block.getMeta()) - && (getTileData() == null || (block.getTileData() != null && block.getTileData().contains(getTileData()))); - } - - @Override - public IBlockPattern or(IBlockPattern pattern) { - return new BlockPatternOr(this, pattern); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/ItemBracketHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/ItemBracketHandler.java deleted file mode 100644 index 5bed0c4..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/ItemBracketHandler.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.brackets; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import minetweaker.IBracketHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.BracketHandler; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStackWildcardSize; -import net.minecraft.item.Item; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.ZenTokener; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionInt; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.ZenType; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * - * @author Stan - */ -@BracketHandler(priority=100) -public class ItemBracketHandler implements IBracketHandler { - private static final Map itemNames; - - static { - itemNames = new HashMap(); - for (Item item : Item.itemsList) { - if (item == null) continue; - - itemNames.put(item.getUnlocalizedName().replace(" ", ""), item); - } - } - - public static IItemStack getItem(String name, int meta) { - Item item = itemNames.get(name); - if (item != null) { - return getIItemStackWildcardSize(item, meta); - } else { - return null; - } - } - - public static IItemStack getItem(int id, int meta) { - Item item = Item.itemsList[id]; - if (item != null) { - return getIItemStackWildcardSize(item, meta); - } else { - return null; - } - } - - private final IZenSymbol symbolAny; - private final IJavaMethod method; - private final IJavaMethod method2; - - public ItemBracketHandler() { - symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol( - IngredientAny.class, - "INSTANCE"); - method = MineTweakerAPI.getJavaMethod( - ItemBracketHandler.class, - "getItem", - String.class, int.class); - method2 = MineTweakerAPI.getJavaMethod( - ItemBracketHandler.class, - "getItem", - int.class, int.class); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - // any symbol - if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) { - return symbolAny; - } - - // detect special cases: - // item: at the start means item-specific syntax - // :xxx with xxx an integer means sub-item syntax - // :* means any-subitem-syntax - int fromIndex = 0; - int toIndex = tokens.size(); - int meta = 0; - - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("item") && tokens.get(1).getValue().equals(":")) { - fromIndex = 2; - } - if (tokens.get(tokens.size() - 1).getType() == ZenTokener.T_INTVALUE - && tokens.get(tokens.size() - 2).getValue().equals(":")) { - toIndex = tokens.size() - 2; - meta = Integer.parseInt(tokens.get(tokens.size() - 1).getValue()); - } else if (tokens.get(tokens.size() - 1).getValue().equals("*") - && tokens.get(tokens.size() - 2).getValue().equals(":")) { - toIndex = tokens.size() - 2; - meta = OreDictionary.WILDCARD_VALUE; - } - } - - return find(environment, tokens, fromIndex, toIndex, meta); - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex, int meta) { - if (endIndex == startIndex + 1 && tokens.get(startIndex).getType() == ZenTokener.T_INTVALUE) { - int id = Integer.parseInt(tokens.get(startIndex).getValue()); - if (id < 0 || id > Item.itemsList.length || Item.itemsList[id] == null) { - return null; - } - - return new ItemReferenceSymbolId(environment, id, meta); - } - - StringBuilder valueBuilder = new StringBuilder(); - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - valueBuilder.append(token.getValue()); - } - - if (itemNames.containsKey(valueBuilder.toString())) { - return new ItemReferenceSymbol(environment, valueBuilder.toString(), meta); - } - - return null; - } - - private class ItemReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - private final int meta; - - public ItemReferenceSymbol(IEnvironmentGlobal environment, String name, int meta) { - this.environment = environment; - this.name = name; - this.meta = meta; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name), - new ExpressionInt(position, meta, ZenType.INT)); - } - } - - private class ItemReferenceSymbolId implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final int id; - private final int meta; - - public ItemReferenceSymbolId(IEnvironmentGlobal environment, int id, int meta) { - this.environment = environment; - this.id = id; - this.meta = meta; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - return new ExpressionCallStatic( - position, - environment, - method2, - new ExpressionInt(position, id, ZenType.INT), - new ExpressionInt(position, meta, ZenType.INT)); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/LiquidBracketHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/LiquidBracketHandler.java deleted file mode 100644 index bee40e9..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/LiquidBracketHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -package minetweaker.mc164.brackets; - -import java.util.List; -import minetweaker.IBracketHandler; -import minetweaker.annotations.BracketHandler; -import minetweaker.mc164.liquid.MCLiquidStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.runtime.GlobalRegistry; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.type.natives.JavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * - * @author Stan - */ -@BracketHandler -public class LiquidBracketHandler implements IBracketHandler { - public static ILiquidStack getLiquid(String name) { - Fluid fluid = FluidRegistry.getFluid(name); - if (fluid != null) { - return new MCLiquidStack(new FluidStack(fluid, 1)); - } else { - return null; - } - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("liquid") && tokens.get(1).getValue().equals(":")) { - return find(environment, tokens, 2, tokens.size()); - } - } - - return null; - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex) { - StringBuilder valueBuilder = new StringBuilder(); - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - valueBuilder.append(token.getValue()); - } - - Fluid fluid = FluidRegistry.getFluid(valueBuilder.toString()); - if (fluid != null) { - return new LiquidReferenceSymbol(environment, valueBuilder.toString()); - } - - return null; - } - - private class LiquidReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - - public LiquidReferenceSymbol(IEnvironmentGlobal environment, String name) { - this.environment = environment; - this.name = name; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - IJavaMethod method = JavaMethod.get( - GlobalRegistry.getTypeRegistry(), - LiquidBracketHandler.class, - "getLiquid", - String.class); - - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name)); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/OreBracketHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/OreBracketHandler.java deleted file mode 100644 index a64cc05..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/brackets/OreBracketHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.brackets; - -import java.util.List; -import minetweaker.IBracketHandler; -import minetweaker.annotations.BracketHandler; -import static minetweaker.api.minecraft.MineTweakerMC.getOreDict; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.runtime.GlobalRegistry; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.type.natives.JavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * - * @author Stan - */ -@BracketHandler -public class OreBracketHandler implements IBracketHandler { - public static IOreDictEntry getOre(String name) { - return getOreDict(name); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("ore") && tokens.get(1).getValue().equals(":")) { - return find(environment, tokens, 2, tokens.size()); - } - } - - return null; - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex) { - StringBuilder valueBuilder = new StringBuilder(); - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - valueBuilder.append(token.getValue()); - } - - return new OreReferenceSymbol(environment, valueBuilder.toString()); - } - - private class OreReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - - public OreReferenceSymbol(IEnvironmentGlobal environment, String name) { - this.environment = environment; - this.name = name; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - IJavaMethod method = JavaMethod.get( - GlobalRegistry.getTypeRegistry(), - OreBracketHandler.class, - "getOre", - String.class); - - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name)); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/chat/MCChatMessage.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/chat/MCChatMessage.java deleted file mode 100644 index 63a7468..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/chat/MCChatMessage.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.chat; - -import minetweaker.api.chat.IChatMessage; -import net.minecraft.util.ChatMessageComponent; - -/** - * - * @author Stan - */ -public class MCChatMessage implements IChatMessage { - private final ChatMessageComponent data; - - public MCChatMessage(String message) { - data = ChatMessageComponent.createFromText(message); - } - - public MCChatMessage(ChatMessageComponent data) { - this.data = data; - } - - @Override - public IChatMessage add(IChatMessage other) { - return new MCChatMessage(data.appendComponent((ChatMessageComponent) other.getInternal())); - } - - @Override - public Object getInternal() { - return data; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/client/MCClient.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/client/MCClient.java deleted file mode 100644 index 873aceb..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/client/MCClient.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.client; - -import cpw.mods.fml.client.FMLClientHandler; -import minetweaker.api.client.IClient; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import net.minecraft.client.Minecraft; - -/** - * - * @author Stan - */ -public class MCClient implements IClient { - @Override - public IPlayer getPlayer() { - return MineTweakerMC.getIPlayer(Minecraft.getMinecraft().thePlayer); - } - - @Override - public String getLanguage() { - return FMLClientHandler.instance().getCurrentLanguage(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/data/NBTConverter.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/data/NBTConverter.java deleted file mode 100644 index d8cc069..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/data/NBTConverter.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import minetweaker.mc164.util.MineTweakerHacks; -import minetweaker.api.data.DataByte; -import minetweaker.api.data.DataByteArray; -import minetweaker.api.data.DataDouble; -import minetweaker.api.data.DataFloat; -import minetweaker.api.data.DataInt; -import minetweaker.api.data.DataIntArray; -import minetweaker.api.data.DataList; -import minetweaker.api.data.DataLong; -import minetweaker.api.data.DataMap; -import minetweaker.api.data.DataShort; -import minetweaker.api.data.DataString; -import minetweaker.api.data.IData; -import minetweaker.api.data.IDataConverter; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagByteArray; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.nbt.NBTTagIntArray; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.nbt.NBTTagString; - -/** - * - * @author Stan - */ -public class NBTConverter implements IDataConverter { - private static final NBTConverter INSTANCE = new NBTConverter(); - - public static NBTBase from(IData data) { - return data.convert(INSTANCE); - } - - public static IData from(NBTBase nbt, boolean immutable) { - if (nbt == null) return null; - - switch (nbt.getId()) { - case 1: // byte - return new DataByte(((NBTTagByte) nbt).data); - case 2: // short - return new DataShort(((NBTTagShort) nbt).data); - case 3: // int - return new DataInt(((NBTTagInt) nbt).data); - case 4: // long - return new DataLong(((NBTTagLong) nbt).data); - case 5: // float - return new DataFloat(((NBTTagFloat) nbt).data); - case 6: // double - return new DataDouble(((NBTTagDouble) nbt).data); - case 7: // byte[] - return new DataByteArray(((NBTTagByteArray) nbt).byteArray, immutable); - case 8: // string - return new DataString(((NBTTagString) nbt).data); - case 9: { // list - NBTTagList listTag = (NBTTagList) nbt; - List values = new ArrayList(); - for (int i = 0; i < listTag.tagCount(); i++) { - values.add(from(listTag.tagAt(i), immutable)); - } - return new DataList(values, immutable); - } - case 10: { // compound - Map values = new HashMap(); - NBTTagCompound original = (NBTTagCompound) nbt; - Map tagMap = MineTweakerHacks.getNBTCompoundMap(original); - for (String key : tagMap.keySet()) { - values.put(key, from(original.getTag(key), immutable)); - } - return new DataMap(values, immutable); - } - case 11: // int[] - return new DataIntArray(((NBTTagIntArray) nbt).intArray, immutable); - default: - throw new RuntimeException("Unknown tag type: " + nbt.getId()); - } - } - - public static void updateMap(NBTTagCompound nbt, IData data) { - NBTUpdater updater = new NBTUpdater(nbt); - data.convert(updater); - } - - public NBTConverter() {} - - @Override - public NBTBase fromBool(boolean value) { - return new NBTTagInt(null, value ? 1 : 0); - } - - @Override - public NBTBase fromByte(byte value) { - return new NBTTagByte(null, value); - } - - @Override - public NBTBase fromShort(short value) { - return new NBTTagShort(null, value); - } - - @Override - public NBTBase fromInt(int value) { - return new NBTTagInt(null, value); - } - - @Override - public NBTBase fromLong(long value) { - return new NBTTagLong(null, value); - } - - @Override - public NBTBase fromFloat(float value) { - return new NBTTagFloat(null, value); - } - - @Override - public NBTBase fromDouble(double value) { - return new NBTTagDouble(null, value); - } - - @Override - public NBTBase fromString(String value) { - return new NBTTagString(null, value); - } - - @Override - public NBTBase fromList(List values) { - NBTTagList result = new NBTTagList(); - for (IData value : values) { - result.appendTag(from(value)); - } - return result; - } - - @Override - public NBTBase fromMap(Map values) { - NBTTagCompound result = new NBTTagCompound(); - for (Map.Entry entry : values.entrySet()) { - result.setTag(entry.getKey(), from(entry.getValue())); - } - return result; - } - - @Override - public NBTBase fromByteArray(byte[] value) { - return new NBTTagByteArray(null, value); - } - - @Override - public NBTBase fromIntArray(int[] value) { - return new NBTTagIntArray(null, value); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/data/NBTUpdater.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/data/NBTUpdater.java deleted file mode 100644 index 6bea533..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/data/NBTUpdater.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.data; - -import java.util.Map; -import minetweaker.api.data.IData; -import minetweaker.api.data.IDataConverter; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; - -/** - * - * @author Stan - */ -public class NBTUpdater extends NBTConverter implements IDataConverter { - private final NBTTagCompound nbt; - - public NBTUpdater(NBTTagCompound compound) { - this.nbt = compound; - } - - @Override - public NBTBase fromMap(Map map) { - for (Map.Entry entry : map.entrySet()) { - if (nbt.hasKey(entry.getKey())) { - if (entry.getValue() == null) { - nbt.removeTag(entry.getKey()); - } else { - if (nbt.getTag(entry.getKey()).getId() == 10) { - NBTTagCompound tag = (NBTTagCompound) nbt.getTag(entry.getKey()); - nbt.setTag(entry.getKey(), entry.getValue().convert(new NBTUpdater(nbt))); - } else { - nbt.setTag(entry.getKey(), NBTConverter.from(entry.getValue())); - } - } - } else if (entry.getValue() != null) { - nbt.setTag(entry.getKey(), from(entry.getValue())); - } - } - - return nbt; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/entity/MCEntityDefinition.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/entity/MCEntityDefinition.java deleted file mode 100644 index 689c43f..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/entity/MCEntityDefinition.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.entity; - -import cpw.mods.fml.common.registry.EntityRegistry; -import minetweaker.api.entity.IEntityDefinition; - -/** - * - * @author Stan - */ -public class MCEntityDefinition implements IEntityDefinition { - private final EntityRegistry.EntityRegistration registration; - - public MCEntityDefinition(EntityRegistry.EntityRegistration registration) { - this.registration = registration; - } - - @Override - public String getId() { - return registration.getEntityClass().getName(); - } - - @Override - public String getName() { - return registration.getEntityName(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedMarkupString.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedMarkupString.java deleted file mode 100644 index c3bdcca..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedMarkupString.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.formatting; - -import minetweaker.api.formatting.IFormattedText; -import net.minecraft.util.EnumChatFormatting; - -/** - * - * @author Stan - */ -public class FormattedMarkupString implements IMCFormattedString { - private final EnumChatFormatting markup; - private final IMCFormattedString contents; - - public FormattedMarkupString(EnumChatFormatting markup, IMCFormattedString contents) { - this.markup = markup; - this.contents = contents; - } - - @Override - public String getTooltipString() { - return markup + contents.getTooltipString(markup.toString()); - } - - @Override - public String getTooltipString(String context) { - return markup + contents.getTooltipString(context + markup); - } - - @Override - public IFormattedText add(IFormattedText other) { - return cat(other); - } - - @Override - public IFormattedText cat(IFormattedText other) { - return new FormattedStringJoin(this, (IMCFormattedString) other); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedString.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedString.java deleted file mode 100644 index 067a49c..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedString.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.formatting; - -import minetweaker.api.formatting.IFormattedText; - -/** - * - * @author Stan - */ -public class FormattedString implements IMCFormattedString { - private final String value; - - public FormattedString(String value) { - this.value = value; - } - - @Override - public String getTooltipString() { - return value; - } - - @Override - public String getTooltipString(String context) { - return value; - } - - @Override - public IFormattedText add(IFormattedText other) { - return cat(other); - } - - @Override - public IFormattedText cat(IFormattedText other) { - return new FormattedStringJoin(this, (IMCFormattedString) other); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedStringJoin.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedStringJoin.java deleted file mode 100644 index 2449cc5..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/FormattedStringJoin.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.formatting; - -import java.util.Arrays; -import minetweaker.api.formatting.IFormattedText; -import net.minecraft.util.EnumChatFormatting; - -/** - * - * @author Stan - */ -public class FormattedStringJoin implements IMCFormattedString { - private final IMCFormattedString[] values; - - public FormattedStringJoin(IMCFormattedString first, IMCFormattedString second) { - values = new IMCFormattedString[] { first, second }; - } - - public FormattedStringJoin(IMCFormattedString[] values) { - this.values = values; - } - - @Override - public String getTooltipString() { - StringBuilder result = new StringBuilder(); - for (IMCFormattedString value : values) { - result.append(value.getTooltipString()); - } - return result.toString(); - } - - @Override - public String getTooltipString(String context) { - boolean first = true; - - StringBuilder result = new StringBuilder(); - for (IMCFormattedString value : values) { - if (first) { - first = false; - } else { - result.append(context); - } - - result.append(value.getTooltipString()); - result.append(EnumChatFormatting.RESET); - } - - return result.toString(); - } - - @Override - public IFormattedText add(IFormattedText other) { - return cat(other); - } - - @Override - public IFormattedText cat(IFormattedText other) { - IMCFormattedString[] newValues = Arrays.copyOf(values, values.length + 1); - newValues[values.length] = (IMCFormattedString) other; - return new FormattedStringJoin(newValues); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/IMCFormattedString.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/IMCFormattedString.java deleted file mode 100644 index 3c2d84a..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/IMCFormattedString.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.formatting; - -import minetweaker.api.formatting.IFormattedText; - -/** - * - * @author Stan - */ -public interface IMCFormattedString extends IFormattedText { - public String getTooltipString(); - - public String getTooltipString(String context); -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/MCFormatter.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/MCFormatter.java deleted file mode 100644 index 18d350e..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/formatting/MCFormatter.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.formatting; - -import minetweaker.api.formatting.IFormattedText; -import minetweaker.api.formatting.IFormatter; -import net.minecraft.util.EnumChatFormatting; - -/** - * - * @author Stan - */ -public class MCFormatter implements IFormatter { - - @Override - public IFormattedText string(String text) { - return new FormattedString(text); - } - - @Override - public IFormattedText black(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.BLACK, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkBlue(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_BLUE, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkGreen(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_GREEN, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkAqua(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_AQUA, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkRed(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_RED, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkPurple(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_PURPLE, (IMCFormattedString) text); - } - - @Override - public IFormattedText gold(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.GOLD, (IMCFormattedString) text); - } - - @Override - public IFormattedText gray(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.GRAY, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkGray(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_GRAY, (IMCFormattedString) text); - } - - @Override - public IFormattedText blue(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.BLUE, (IMCFormattedString) text); - } - - @Override - public IFormattedText green(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.GREEN, (IMCFormattedString) text); - } - - @Override - public IFormattedText aqua(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.AQUA, (IMCFormattedString) text); - } - - @Override - public IFormattedText red(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.RED, (IMCFormattedString) text); - } - - @Override - public IFormattedText lightPurple(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.LIGHT_PURPLE, (IMCFormattedString) text); - } - - @Override - public IFormattedText yellow(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.YELLOW, (IMCFormattedString) text); - } - - @Override - public IFormattedText white(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.WHITE, (IMCFormattedString) text); - } - - @Override - public IFormattedText obfuscated(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.OBFUSCATED, (IMCFormattedString) text); - } - - @Override - public IFormattedText bold(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.BOLD, (IMCFormattedString) text); - } - - @Override - public IFormattedText strikethrough(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.STRIKETHROUGH, (IMCFormattedString) text); - } - - @Override - public IFormattedText underline(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.UNDERLINE, (IMCFormattedString) text); - } - - @Override - public IFormattedText italic(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.ITALIC, (IMCFormattedString) text); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/FuelTweaker.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/FuelTweaker.java deleted file mode 100644 index 18c83ce..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/FuelTweaker.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.furnace; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import cpw.mods.fml.common.IFuelHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; - -public class FuelTweaker { - public static final FuelTweaker INSTANCE = new FuelTweaker(); - - private List original; - private final HashMap> quickList = new HashMap>(); - - private FuelTweaker() {} - - public void register() { - try { - Field fuelHandlers = GameRegistry.class.getDeclaredField("fuelHandlers"); - fuelHandlers.setAccessible(true); - original = (List) fuelHandlers.get(null); - List modified = new ArrayList(); - modified.add(new OverridingFuelHandler()); - fuelHandlers.set(null, modified); - } catch (NoSuchFieldException ex) { - System.out.println("[MineTweaker] Error: could not get GameRegistry fuel handlers field. Cannot use custom fuel values."); - } catch (SecurityException ex) { - System.out.println("[MineTweaker] Error: could not alter GameRegistry fuel handlers field. Cannot use custom fuel values."); - } catch (IllegalAccessException ex) { - System.out.println("[MineTweaker] Error: could not alter GameRegistry fuel handlers field. Cannot use custom fuel values."); - } - } - - public void addFuelPattern(SetFuelPattern pattern) { - List items = pattern.getPattern().getItems(); - if (items == null) { - MineTweakerAPI.logError("Cannot set fuel for <*>"); - return; - } - - for (IItemStack item : pattern.getPattern().getItems()) { - if (!quickList.containsKey(item.getName())) { - quickList.put(item.getName(), new ArrayList()); - } - quickList.get(item.getName()).add(pattern); - } - } - - public void removeFuelPattern(SetFuelPattern pattern) { - for (IItemStack item : pattern.getPattern().getItems()) { - if (!quickList.containsKey(item.getName())) { - quickList.put(item.getName(), new ArrayList()); - } - quickList.get(item.getName()).add(pattern); - } - } - - private class OverridingFuelHandler implements IFuelHandler { - @Override - public int getBurnTime(ItemStack fuel) { - IItemStack stack = getIItemStack(fuel); - String name = fuel.getUnlocalizedName(); - if (quickList.containsKey(name)) { - for (SetFuelPattern override : quickList.get(name)) { - if (override.getPattern().matches(stack)) { - return override.getValue(); - } - } - } - - int max = 0; - for (IFuelHandler handler : original) { - max = Math.max(max, handler.getBurnTime(fuel)); - } - return max; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/MCFurnaceManager.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/MCFurnaceManager.java deleted file mode 100644 index 4477d08..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/MCFurnaceManager.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.furnace; - -import cpw.mods.fml.common.registry.GameRegistry; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.api.recipes.IFurnaceManager; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCFurnaceManager implements IFurnaceManager { - public MCFurnaceManager() { - - } - - @Override - public void remove(IIngredient output, IIngredient input) { - if (output == null) throw new IllegalArgumentException("output cannot be null"); - - Map smeltingList = FurnaceRecipes.smelting().getSmeltingList(); - Map, ItemStack> metaSmeltingList = FurnaceRecipes.smelting().getMetaSmeltingList(); - - List toRemove = new ArrayList(); - List> toRemoveMeta = new ArrayList>(); - List toRemoveValues = new ArrayList(); - List toRemoveMetaValues = new ArrayList(); - - for (Map.Entry entry : smeltingList.entrySet()) { - if (output.matches(getIItemStack(entry.getValue())) - && (input == null || input.matches(getIItemStack(new ItemStack(entry.getKey(), 1, 0))))) { - toRemove.add(entry.getKey()); - toRemoveValues.add(entry.getValue()); - } - } - - for (Map.Entry, ItemStack> entry : metaSmeltingList.entrySet()) { - if (output.matches(getIItemStack(entry.getValue())) - && (input == null || input.matches(getIItemStack(new ItemStack(entry.getKey().get(0), 1, entry.getKey().get(1)))))) { - toRemoveMeta.add(entry.getKey()); - toRemoveMetaValues.add(entry.getValue()); - } - } - - if (toRemove.isEmpty() && toRemoveMeta.isEmpty()) { - MineTweakerAPI.logWarning("No furnace recipes for " + output.toString()); - } else { - MineTweakerAPI.apply(new RemoveAction(toRemove, toRemoveValues, toRemoveMeta, toRemoveMetaValues)); - } - } - - @Override - public void addRecipe(IItemStack output, IIngredient input, double xp) { - List items = input.getItems(); - if (items == null) { - MineTweakerAPI.logError("Cannot turn " + input.toString() + " into a furnace recipe"); - } - - ItemStack[] items2 = getItemStacks(items); - ItemStack output2 = getItemStack(output); - MineTweakerAPI.apply(new AddRecipeAction(input, items2, output2, xp)); - } - - @Override - public void setFuel(IIngredient item, int fuel) { - MineTweakerAPI.apply(new SetFuelAction(new SetFuelPattern(item, fuel))); - } - - @Override - public int getFuel(IItemStack item) { - return GameRegistry.getFuelValue(getItemStack(item)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class RemoveAction implements IUndoableAction { - private final List items; - private final List values; - private final List> metaItems; - private final List metaValues; - - public RemoveAction(List items, List values, List> metaItems, List metaValues) { - this.items = items; - this.values = values; - this.metaItems = metaItems; - this.metaValues = metaValues; - } - - @Override - public void apply() { - for (Integer item : items) { - FurnaceRecipes.smelting().getSmeltingList().remove(item); - } - for (List item : metaItems) { - FurnaceRecipes.smelting().getMetaSmeltingList().remove(item); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (int i = 0; i < items.size(); i++) { - FurnaceRecipes.smelting().getSmeltingList().put(items.get(i), values.get(i)); - } - for (int i = 0; i < metaItems.size(); i++) { - FurnaceRecipes.smelting().getMetaSmeltingList().put(metaItems.get(i), metaValues.get(i)); - } - } - - @Override - public String describe() { - return "Removing " + items.size() + " furnace recipes"; - } - - @Override - public String describeUndo() { - return "Restoring " + items.size() + " furnace recipes"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddRecipeAction implements IUndoableAction { - private final IIngredient ingredient; - private final ItemStack[] input; - private final ItemStack output; - private final double xp; - - public AddRecipeAction(IIngredient ingredient, ItemStack[] input, ItemStack output, double xp) { - this.ingredient = ingredient; - this.input = input; - this.output = output; - this.xp = xp; - } - - @Override - public void apply() { - for (ItemStack inputStack : input) { - if (inputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - FurnaceRecipes.smelting().addSmelting(inputStack.itemID, output, (float) xp); - } else { - FurnaceRecipes.smelting().addSmelting(inputStack.itemID, inputStack.getItemDamage(), output, (float) xp); - } - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (ItemStack inputStack : input) { - FurnaceRecipes.smelting().getSmeltingList().remove(inputStack); - } - } - - @Override - public String describe() { - return "Adding furnace recipe for " + ingredient; - } - - @Override - public String describeUndo() { - return "Removing furnace recipe for " + ingredient; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class SetFuelAction implements IUndoableAction { - private final SetFuelPattern pattern; - - public SetFuelAction(SetFuelPattern pattern) { - this.pattern = pattern; - } - - @Override - public void apply() { - FuelTweaker.INSTANCE.addFuelPattern(pattern); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FuelTweaker.INSTANCE.removeFuelPattern(pattern); - } - - @Override - public String describe() { - return "Setting fuel for " + pattern.getPattern(); - } - - @Override - public String describeUndo() { - return "Removing fuel for " + pattern.getPattern(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/SetFuelPattern.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/SetFuelPattern.java deleted file mode 100644 index f1f1274..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/furnace/SetFuelPattern.java +++ /dev/null @@ -1,21 +0,0 @@ -package minetweaker.mc164.furnace; - -import minetweaker.api.item.IIngredient; - -public class SetFuelPattern { - private final IIngredient pattern; - private final int value; - - public SetFuelPattern(IIngredient pattern, int value) { - this.pattern = pattern; - this.value = value; - } - - public IIngredient getPattern() { - return pattern; - } - - public int getValue() { - return value; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/game/MCGame.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/game/MCGame.java deleted file mode 100644 index 23381a7..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/game/MCGame.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.game; - -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.entity.IEntityDefinition; -import minetweaker.api.game.IGame; -import minetweaker.api.item.IItemDefinition; -import minetweaker.api.liquid.ILiquidDefinition; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.world.IBiome; -import minetweaker.mc164.entity.MCEntityDefinition; -import minetweaker.mc164.item.MCItemDefinition; -import minetweaker.mc164.liquid.MCLiquidDefinition; -import minetweaker.mc164.util.MineTweakerHacks; -import minetweaker.mc164.util.MineTweakerPlatformUtils; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -/** - * - * @author Stan - */ -public class MCGame implements IGame { - private static final Map TRANSLATIONS = MineTweakerHacks.getTranslations(); - - public static final MCGame INSTANCE = new MCGame(); - - private MCGame() {} - - @Override - public List getItems() { - List result = new ArrayList(); - - for (Item item : Item.itemsList) { - if (item == null) continue; - result.add(new MCItemDefinition(item)); - } - - return result; - } - - @Override - public List getBlocks() { - List result = new ArrayList(); - - for (Block block : Block.blocksList) { - if (block == null) continue; - - result.add(MineTweakerMC.getBlockDefinition(block)); - } - - return result; - } - - @Override - public List getLiquids() { - List result = new ArrayList(); - for (Map.Entry entry : FluidRegistry.getRegisteredFluids().entrySet()) { - result.add(new MCLiquidDefinition(entry.getValue())); - } - return result; - } - - @Override - public List getBiomes() { - List result = new ArrayList(); - for (IBiome biome : MineTweakerMC.biomes) { - if (biome != null) { - result.add(biome); - } - } - return result; - } - - @Override - public List getEntities() { - List result = new ArrayList(); - - for (EntityRegistry.EntityRegistration entityRegistration : MineTweakerHacks.getEntityClassRegistrations().values()) { - result.add(new MCEntityDefinition(entityRegistration)); - } - - return result; - } - - @Override - public void setLocalization(String key, String value) { - MineTweakerAPI.apply(new SetTranslation(null, key, value)); - } - - @Override - public void setLocalization(String lang, String key, String value) { - MineTweakerAPI.apply(new SetTranslation(lang, key, value)); - } - - @Override - public String localize(String key) { - return LanguageRegistry.instance().getStringLocalization(key); - } - - @Override - public String localize(String key, String lang) { - return LanguageRegistry.instance().getStringLocalization(key, lang); - } - - // ###################### - // ### Action classes ### - // ###################### - - /** - * Ported from ModTweaker. - * - * @author Joshiejack - */ - private static class SetTranslation implements IUndoableAction { - private String original; - private final String lang; - private final String key; - private final String text; - private boolean added; - - public SetTranslation(String lang, String key, String text) { - this.lang = lang; - this.key = key; - this.text = text; - } - - @Override - public void apply() { - if (lang == null || MineTweakerPlatformUtils.isLanguageActive(lang)) { - original = TRANSLATIONS.get(key); - TRANSLATIONS.put(key, text); - added = true; - } else { - added = false; - } - } - - @Override - public boolean canUndo() { - return TRANSLATIONS != null; - } - - @Override - public void undo() { - if (added) { - if (original == null) { - TRANSLATIONS.remove(key); - } else { - TRANSLATIONS.put(key, original); - } - } - } - - @Override - public String describe() { - return "Setting localization for the key: " + key + " to " + text; - } - - @Override - public String describeUndo() { - return "Setting localization for the key: " + key + " to " + original; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/item/MCItemDefinition.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/item/MCItemDefinition.java deleted file mode 100644 index b0a6d2e..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/item/MCItemDefinition.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.item; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemDefinition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.oredict.IOreDictEntry; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCItemDefinition implements IItemDefinition { - private final Item item; - - public MCItemDefinition(Item item) { - this.item = item; - } - - @Override - public String getId() { - return item.getUnlocalizedName(); - } - - @Override - public String getName() { - return item.getUnlocalizedName(); - } - - @Override - public IItemStack makeStack(int meta) { - return MineTweakerMC.getIItemStackWildcardSize(new ItemStack(item, 1, meta)); - } - - @Override - public List getOres() { - List result = new ArrayList(); - - for (String key : OreDictionary.getOreNames()) { - for (ItemStack is : OreDictionary.getOres(key)) { - if (is.getItem() == item) { - result.add(MineTweakerAPI.oreDict.get(key)); - break; - } - } - } - - return result; - } - - // ############################# - // ### Object implementation ### - // ############################# - - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.item != null ? this.item.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MCItemDefinition other = (MCItemDefinition) obj; - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/item/MCItemStack.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/item/MCItemStack.java deleted file mode 100644 index 3abf5b3..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/item/MCItemStack.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.item; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import minetweaker.MineTweakerAPI; -import minetweaker.api.block.IBlock; -import minetweaker.api.data.DataMap; -import minetweaker.mc164.data.NBTConverter; -import minetweaker.mc164.liquid.MCLiquidStack; -import minetweaker.api.data.IData; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemDefinition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.item.IngredientItem; -import minetweaker.api.item.IngredientOr; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.api.player.IPlayer; -import minetweaker.mc164.actions.SetTranslationAction; -import minetweaker.mc164.block.MCItemBlock; -import minetweaker.util.ArrayUtil; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCItemStack implements IItemStack { - private final ItemStack stack; - private final List items; - private IData tag = null; - private boolean wildcardSize; - - public MCItemStack(ItemStack itemStack) { - if (itemStack == null) throw new IllegalArgumentException("stack cannot be null"); - - stack = itemStack.copy(); - items = Collections.singletonList(this); - } - - public MCItemStack(ItemStack itemStack, boolean wildcardSize) { - this(itemStack); - - this.wildcardSize = wildcardSize; - } - - private MCItemStack(ItemStack itemStack, IData tag) { - if (itemStack == null) throw new IllegalArgumentException("stack cannot be null"); - - stack = itemStack; - items = Collections.singletonList(this); - this.tag = tag; - } - - private MCItemStack(ItemStack itemStack, IData tag, boolean wildcardSize) { - stack = itemStack; - items = Collections.singletonList(this); - this.tag = tag; - this.wildcardSize = wildcardSize; - } - - @Override - public IItemDefinition getDefinition() { - return new MCItemDefinition(stack.getItem()); - } - - @Override - public String getName() { - return stack.getUnlocalizedName(); - } - - @Override - public String getDisplayName() { - return stack.getDisplayName(); - } - - @Override - public void setDisplayName(String name) { - MineTweakerAPI.apply(new SetTranslationAction(getName() + ".name", name)); - } - - @Override - public int getDamage() { - return stack.getItemDamage(); - } - - @Override - public IData getTag() { - if (tag == null) { - if (stack.stackTagCompound == null) { - return DataMap.EMPTY; - } - - tag = NBTConverter.from(stack.stackTagCompound, true); - } - return tag; - } - - @Override - public int getMaxDamage() { - return stack.getMaxDamage(); - } - - @Override - public ILiquidStack getLiquid() { - FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack); - return liquid == null ? null : new MCLiquidStack(liquid); - } - - @Override - public IIngredient anyDamage() { - if (stack.getItem().getHasSubtypes()) { - MineTweakerAPI.logWarning("subitems don't have damaged states"); - return this; - } else { - ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, OreDictionary.WILDCARD_VALUE); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag); - } - } - - @Override - public IItemStack withDamage(int damage) { - if (stack.getItem().getHasSubtypes()) { - MineTweakerAPI.logWarning("subitems don't have damaged states"); - return this; - } else { - ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, damage); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag); - } - } - - @Override - public IItemStack withAmount(int amount) { - ItemStack result = new ItemStack(stack.getItem(), amount, stack.getItemDamage()); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag); - } - - @Override - public IItemStack anyAmount() { - ItemStack result = new ItemStack(stack.getItem(), 1, stack.getItemDamage()); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag, true); - } - - @Override - public IItemStack withTag(IData tag) { - ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, stack.getItemDamage()); - if (tag == null) { - result.stackTagCompound = null; - } else { - result.stackTagCompound = (NBTTagCompound) NBTConverter.from(tag); - } - return new MCItemStack(result, tag); - } - - @Override - public IItemStack updateTag(IData tagUpdate) { - if (tag == null) { - if (stack.stackTagCompound == null) { - return withTag(tagUpdate); - } - - tag = NBTConverter.from(stack.stackTagCompound, true); - } - - IData updated = tag.update(tagUpdate); - return withTag(updated); - } - - @Override - public String getMark() { - return null; - } - - @Override - public int getAmount() { - return stack.stackSize; - } - - @Override - public List getItems() { - return items; - } - - @Override - public List getLiquids() { - return Collections.emptyList(); - } - - @Override - public IItemStack amount(int amount) { - return withAmount(amount); - } - - @Override - public WeightedItemStack percent(float chance) { - return new WeightedItemStack(this, chance * 0.01f); - } - - @Override - public WeightedItemStack weight(float chance) { - return new WeightedItemStack(this, chance); - } - - @Override - public IIngredient transform(IItemTransformer transformer) { - return new IngredientItem(this, null, ArrayUtil.EMPTY_CONDITIONS, new IItemTransformer[] { transformer }); - } - - @Override - public IIngredient only(IItemCondition condition) { - return new IngredientItem(this, null, new IItemCondition[] { condition }, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient marked(String mark) { - return new IngredientItem(this, mark, ArrayUtil.EMPTY_CONDITIONS, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient or(IIngredient ingredient) { - return new IngredientOr(this, ingredient); - } - - @Override - public boolean matches(IItemStack item) { - if (item == null) - return false; - - ItemStack internal = getItemStack(item); - if (internal == null) { - throw new RuntimeException("Invalid item: " + item); - } - - return internal.getItem() == stack.getItem() - && (wildcardSize || internal.stackSize >= stack.stackSize) - && (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE - || stack.getItemDamage() == internal.getItemDamage() - || (!stack.getHasSubtypes() && !stack.getItem().isDamageable())); - } - - @Override - public boolean matches(ILiquidStack liquid) { - return false; - } - - @Override - public boolean contains(IIngredient ingredient) { - if (ingredient == null) - return false; - - List iitems = ingredient.getItems(); - if (iitems == null || iitems.size() != 1) return false; - return matches(iitems.get(0)); - } - - @Override - public IItemStack applyTransform(IItemStack item, IPlayer byPlayer) { - return item; - } - - @Override - public boolean hasTransformers() { - return false; - } - - @Override - public IBlock asBlock() { - if (stack.itemID >= Block.blocksList.length || Block.blocksList[stack.itemID] == null) { - throw new ClassCastException("This item is not a block"); - } else { - return new MCItemBlock(stack); - } - } - - @Override - public Object getInternal() { - return stack; - } - - @Override - public List getOres() { - List result = new ArrayList(); - - for (String key : OreDictionary.getOreNames()) { - for (ItemStack is : OreDictionary.getOres(key)) { - if (is.getItem() == stack.getItem() - && (is.getItemDamage() == OreDictionary.WILDCARD_VALUE || is.getItemDamage() == stack.getItemDamage())) { - result.add(MineTweakerAPI.oreDict.get(key)); - break; - } - } - } - - return result; - } - - // ############################# - // ### Object implementation ### - // ############################# - - @Override - public int hashCode() { - int hash = 7; - hash = 41 * hash + stack.itemID; - hash = 41 * hash + stack.getItemDamage(); - hash = 41 * hash + stack.stackSize; - hash = 41 * hash + (stack.stackTagCompound == null ? 0 : stack.stackTagCompound.hashCode()); - hash = 41 * hash + (this.wildcardSize ? 1 : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MCItemStack other = (MCItemStack) obj; - if (this.stack.itemID != other.stack.itemID) return false; - if (this.stack.getItemDamage() != other.stack.getItemDamage()) return false; - if (this.stack.stackSize != other.stack.stackSize) return false; - if (this.stack.stackTagCompound != other.stack.stackTagCompound && (this.stack == null || this.stack.equals(other.stack))) return false; - if (this.wildcardSize != other.wildcardSize) return false; - return true; - } - - @Override - public String toString() { - StringBuilder result = new StringBuilder(); - result.append('<'); - result.append(stack.getItem().getUnlocalizedName()); - - if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - result.append(":*"); - } else if (stack.getItemDamage() > 0) { - result.append(':').append(stack.getItemDamage()); - } - result.append('>'); - - if (stack.getTagCompound() != null) { - result.append(".withTag("); - result.append(NBTConverter.from(stack.getTagCompound(), wildcardSize).toString()); - result.append(")"); - } - - if (!wildcardSize) { - result.append(" * ").append(stack.stackSize); - } - - return result.toString(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/liquid/MCLiquidDefinition.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/liquid/MCLiquidDefinition.java deleted file mode 100644 index 4978302..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/liquid/MCLiquidDefinition.java +++ /dev/null @@ -1,441 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.liquid; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidDefinition; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.mc164.util.MineTweakerHacks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.fluids.FluidStack; - -/** - * - * @author Stan - */ -public class MCLiquidDefinition implements ILiquidDefinition { - private static final Map containerFluidMap = MineTweakerHacks.getFluidContainerMap(); - private static final Map filledContainerMap = MineTweakerHacks.getFilledContainerMap(); - private static final Set emptyContainers = MineTweakerHacks.getEmptyContainers(); - - private final Fluid fluid; - - public MCLiquidDefinition(Fluid fluid) { - this.fluid = fluid; - } - - @Override - public String getName() { - return fluid.getName(); - } - - @Override - public String getDisplayName() { - return fluid.getLocalizedName(); - } - - @Override - public ILiquidStack asStack(int millibuckets) { - return new MCLiquidStack(new FluidStack(fluid, millibuckets)); - } - - @Override - public int getLuminosity() { - return fluid.getLuminosity(); - } - - @Override - public void setLuminosity(int value) { - MineTweakerAPI.apply(new ActionSetLuminosity(value)); - } - - @Override - public int getDensity() { - return fluid.getDensity(); - } - - @Override - public void setDensity(int density) { - MineTweakerAPI.apply(new ActionSetDensity(density)); - } - - @Override - public int getTemperature() { - return fluid.getTemperature(); - } - - @Override - public void setTemperature(int temperature) { - MineTweakerAPI.apply(new ActionSetTemperature(temperature)); - } - - @Override - public int getViscosity() { - return fluid.getViscosity(); - } - - @Override - public void setViscosity(int viscosity) { - MineTweakerAPI.apply(new ActionSetViscosity(viscosity)); - } - - @Override - public boolean isGaseous() { - return fluid.isGaseous(); - } - - @Override - public void setGaseous(boolean gaseous) { - MineTweakerAPI.apply(new ActionSetGaseous(gaseous)); - } - - @Override - public List getContainers() { - List result = new ArrayList(); - for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.fluid.getFluid() == fluid) { - result.add(MineTweakerMC.getIItemStack(data.filledContainer)); - } - } - return result; - } - - @Override - public void addContainer(IItemStack filled, IItemStack empty, int amount) { - MineTweakerAPI.apply(new AddContainerAction(filled, empty, amount)); - } - - @Override - public void removeContainer(IItemStack filled) { - MineTweakerAPI.apply(new RemoveContainerAction(filled)); - } - - // ####################### - // ### Private methods ### - // ####################### - - private void removeContainerInner(IItemStack filled) { - ItemStack filledItem = MineTweakerMC.getItemStack(filled); - FluidContainerData data = filledContainerMap.get(Arrays.asList(filledItem.itemID, filledItem.getItemDamage())); - if (data != null) { - filledContainerMap.remove(Arrays.asList(filledItem.itemID, filledItem.getItemDamage())); - containerFluidMap.remove(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage())); - - // rebuild empty containers set - emptyContainers.clear(); - for (FluidContainerData fdata : filledContainerMap.values()) { - emptyContainers.add(Arrays.asList(fdata.emptyContainer.itemID, fdata.emptyContainer.getItemDamage())); - } - } - } - - private FluidContainerData getData(IItemStack filled) { - ItemStack filledStack = MineTweakerMC.getItemStack(filled); - return filledContainerMap.get(Arrays.asList(filledStack.itemID, filledStack.getItemDamage())); - } - - // ###################### - // ### Action classes ### - // ###################### - - private class AddContainerAction implements IUndoableAction { - private final IItemStack filled; - private final IItemStack empty; - private final int amount; - - public AddContainerAction(IItemStack filled, IItemStack empty, int amount) { - this.filled = filled; - this.empty = empty; - this.amount = amount; - } - - @Override - public void apply() { - FluidContainerRegistry.registerFluidContainer(new FluidStack(fluid, amount), MineTweakerMC.getItemStack(filled), MineTweakerMC.getItemStack(empty)); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - removeContainerInner(filled); - } - - @Override - public String describe() { - return "Adding " + filled.getDisplayName() + " as liquid container for " + fluid.getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Removing liquid container " + filled; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class RemoveContainerAction implements IUndoableAction { - private final IItemStack filled; - private final IItemStack empty; - private final FluidStack amount; - - public RemoveContainerAction(IItemStack filled) { - this.filled = filled; - - FluidContainerData data = getData(filled); - empty = MineTweakerMC.getIItemStack(data.emptyContainer); - amount = data.fluid; - } - - @Override - public void apply() { - removeContainerInner(filled); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FluidContainerRegistry.registerFluidContainer(amount, MineTweakerMC.getItemStack(filled), MineTweakerMC.getItemStack(empty)); - } - - @Override - public String describe() { - return "Removing liquid container " + filled; - } - - @Override - public String describeUndo() { - return "Restoring liquid container " + filled; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetLuminosity implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetLuminosity(int newValue) { - oldValue = getLuminosity(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setLuminosity(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setLuminosity(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " luminosity to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " luminosity to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetDensity implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetDensity(int newValue) { - oldValue = getDensity(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setDensity(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setDensity(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " density to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " density to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetTemperature implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetTemperature(int newValue) { - oldValue = getTemperature(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setTemperature(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setTemperature(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " temperature to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " temperature to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetViscosity implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetViscosity(int newValue) { - oldValue = getViscosity(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setViscosity(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setViscosity(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " viscosity to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " viscosity to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetGaseous implements IUndoableAction { - private final boolean oldValue; - private final boolean newValue; - - public ActionSetGaseous(boolean newValue) { - oldValue = isGaseous(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setGaseous(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setGaseous(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " gaseous to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " gaseous to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/liquid/MCLiquidStack.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/liquid/MCLiquidStack.java deleted file mode 100644 index bbff5f3..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/liquid/MCLiquidStack.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.liquid; - -import java.util.Collections; -import java.util.List; -import minetweaker.mc164.data.NBTConverter; -import minetweaker.api.data.IData; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.item.IngredientOr; -import minetweaker.api.liquid.ILiquidDefinition; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.player.IPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; - -/** - * - * @author Stan - */ -public class MCLiquidStack implements ILiquidStack { - private final FluidStack stack; - private IData tag = null; - - public MCLiquidStack(FluidStack stack) { - this.stack = stack; - } - - private MCLiquidStack(FluidStack stack, IData tag) { - this.stack = stack; - this.tag = tag; - } - - @Override - public ILiquidDefinition getDefinition() { - return new MCLiquidDefinition(stack.getFluid()); - } - - @Override - public String getName() { - return stack.getFluid().getName(); - } - - @Override - public String getDisplayName() { - return stack.getFluid().getLocalizedName(); - } - - @Override - public int getAmount() { - return stack.amount; - } - - @Override - public IData getTag() { - if (tag == null) { - if (stack.tag == null) { - return null; - } - - tag = NBTConverter.from(stack.tag, true); - } - - return tag; - } - - @Override - public ILiquidStack withTag(IData data) { - FluidStack result = new FluidStack(stack.fluidID, stack.amount); - result.tag = (NBTTagCompound) NBTConverter.from(data); - return new MCLiquidStack(result, data.immutable()); - } - - @Override - public ILiquidStack withAmount(int amount) { - FluidStack result = new FluidStack(stack.fluidID, amount); - result.tag = stack.tag; - return new MCLiquidStack(result, tag); - } - - @Override - public int getLuminosity() { - return stack.getFluid().getLuminosity(stack); - } - - @Override - public int getDensity() { - return stack.getFluid().getDensity(stack); - } - - @Override - public int getTemperature() { - return stack.getFluid().getTemperature(stack); - } - - @Override - public int getViscosity() { - return stack.getFluid().getViscosity(stack); - } - - @Override - public boolean isGaseous() { - return stack.getFluid().isGaseous(stack); - } - - @Override - public Object getInternal() { - return stack; - } - - // ################################## - // ### IIngredient implementation ### - // ################################## - - @Override - public String getMark() - { - return null; - } - - @Override - public List getItems() - { - return Collections.emptyList(); - } - - @Override - public List getLiquids() - { - return Collections.singletonList(this); - } - - @Override - public IIngredient amount(int amount) - { - return withAmount(amount); - } - - @Override - public IIngredient or(IIngredient ingredient) - { - return new IngredientOr(this, ingredient); - } - - @Override - public IIngredient transform(IItemTransformer transformer) - { - throw new UnsupportedOperationException("Liquid stack can't have transformers"); - } - - @Override - public IIngredient only(IItemCondition condition) - { - throw new UnsupportedOperationException("Liquid stack can't have conditions"); - } - - @Override - public IIngredient marked(String mark) - { - throw new UnsupportedOperationException("Liquid stack can't be marked"); - } - - @Override - public boolean matches(IItemStack item) - { - return false; - } - - @Override - public boolean matches(ILiquidStack liquid) - { - return getDefinition().equals(liquid.getDefinition()) - && getAmount() <= liquid.getAmount(); - } - - @Override - public boolean contains(IIngredient ingredient) - { - if (!ingredient.getItems().isEmpty()) - return false; - - for (ILiquidStack liquid : ingredient.getLiquids()) - { - if (!matches(liquid)) - return false; - } - - return false; - } - - @Override - public IItemStack applyTransform(IItemStack item, IPlayer byPlayer) - { - return item; - } - - @Override - public boolean hasTransformers() - { - return false; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/mods/MCLoadedMods.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/mods/MCLoadedMods.java deleted file mode 100644 index 03304a5..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/mods/MCLoadedMods.java +++ /dev/null @@ -1,44 +0,0 @@ -package minetweaker.mc164.mods; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import java.util.Iterator; -import java.util.List; -import minetweaker.api.mods.ILoadedMods; -import minetweaker.api.mods.IMod; -import stanhebben.zenscript.util.MappingIterator; - -/** - * - * @author Stan - */ -public class MCLoadedMods implements ILoadedMods { - public MCLoadedMods() {} - - @Override - public boolean contains(String name) { - return Loader.isModLoaded(name); - } - - @Override - public IMod get(String name) { - for (ModContainer mod : Loader.instance().getActiveModList()) { - if (mod.getModId().equals(name)) { - return new MCMod(mod); - } - } - - return null; - } - - @Override - public Iterator iterator() { - List mods = Loader.instance().getActiveModList(); - return new MappingIterator(mods.iterator()) { - @Override - public IMod map(ModContainer value) { - return new MCMod(value); - } - }; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/mods/MCMod.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/mods/MCMod.java deleted file mode 100644 index c56b6e9..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/mods/MCMod.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.mods; - -import cpw.mods.fml.common.ModContainer; -import minetweaker.api.mods.IMod; - -/** - * - * @author Stan - */ -public class MCMod implements IMod { - private final ModContainer mod; - - public MCMod(ModContainer mod) { - this.mod = mod; - } - - @Override - public String getId() { - return mod.getModId(); - } - - @Override - public String getName() { - return mod.getName(); - } - - @Override - public String getVersion() { - return mod.getVersion(); - } - - @Override - public String getDescription() { - return mod.getMetadata().description; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/network/MCConnectionHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/network/MCConnectionHandler.java deleted file mode 100644 index a0439e0..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/network/MCConnectionHandler.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.network; - -import net.minecraft.network.INetworkManager; -import net.minecraft.network.NetLoginHandler; -import net.minecraft.network.packet.NetHandler; -import net.minecraft.network.packet.Packet1Login; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.server.MinecraftServer; -import cpw.mods.fml.common.network.IConnectionHandler; -import cpw.mods.fml.common.network.Player; -import minetweaker.MineTweakerAPI; -import minetweaker.mc164.MineTweakerMod; - -public class MCConnectionHandler implements IConnectionHandler { - @Override - public void playerLoggedIn(Player player, NetHandler netHandler, - INetworkManager manager) { - System.out.println("Player logged in: " + netHandler.getPlayer().username); - - byte[] scriptData = MineTweakerAPI.tweaker.getScriptData(); - System.out.println("Sending script data: " + scriptData.length + " bytes"); - - manager.addToSendQueue(new Packet250CustomPayload( - MCPacketHandler.CHANNEL_SERVERSCRIPT, - MineTweakerAPI.tweaker.getScriptData())); - - MineTweakerMod.INSTANCE.onPlayerLogin(player, netHandler, manager); - } - - @Override - public String connectionReceived(NetLoginHandler netHandler, - INetworkManager manager) { - return null; - } - - @Override - public void connectionOpened(NetHandler netClientHandler, String server, - int port, INetworkManager manager) { - } - - @Override - public void connectionOpened(NetHandler netClientHandler, - MinecraftServer server, INetworkManager manager) { - } - - @Override - public void connectionClosed(INetworkManager manager) { - MineTweakerMod.INSTANCE.onPlayerLogout(manager); - } - - @Override - public void clientLoggedIn(NetHandler clientHandler, - INetworkManager manager, Packet1Login login) { - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/network/MCPacketHandler.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/network/MCPacketHandler.java deleted file mode 100644 index a428b51..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/network/MCPacketHandler.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.network; - -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; -import cpw.mods.fml.common.network.IPacketHandler; -import cpw.mods.fml.common.network.Player; -import java.awt.Desktop; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.mc164.client.MCClient; -import minetweaker.runtime.providers.ScriptProviderMemory; - -public class MCPacketHandler implements IPacketHandler { - public static final Charset UTF8 = Charset.forName("utf-8"); - - public static final String CHANNEL_SERVERSCRIPT = "MTServerScript"; - public static final String CHANNEL_OPENBROWSER = "MTOpenBrowser"; - public static final String CHANNEL_COPYTOCLIPBOARD = "MTCopyToClipboard"; - - @Override - public void onPacketData(INetworkManager manager, - Packet250CustomPayload packet, Player player) { - // catches some special cases caused by unknown reasons - if (packet == null || packet.channel == null || packet.data == null) return; - - if (packet.channel.equals(CHANNEL_SERVERSCRIPT)) { - System.out.println("Received script data: " + packet.data.length + " bytes"); - - if (MineTweakerAPI.server == null) { - MineTweakerAPI.client = new MCClient(); - - MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderMemory(packet.data)); - MineTweakerImplementationAPI.reload(); - } - } else if (packet.channel.equals(CHANNEL_OPENBROWSER)) { - String url = UTF8.decode(ByteBuffer.wrap(packet.data)).toString().trim(); - - if (Desktop.isDesktopSupported()){ - Desktop desktop = Desktop.getDesktop(); - try { - desktop.browse(new URI(url)); - } catch (IOException e) { - } catch (URISyntaxException e) { - } - } - } else if (packet.channel.equals(CHANNEL_COPYTOCLIPBOARD)) { - String message = UTF8.decode(ByteBuffer.wrap(packet.data)).toString().trim(); - - if (Desktop.isDesktopSupported()) { - StringSelection stringSelection = new StringSelection(message); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(stringSelection, null); - } - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/oredict/MCOreDict.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/oredict/MCOreDict.java deleted file mode 100644 index 9bff08d..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/oredict/MCOreDict.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.oredict; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getOreDict; -import minetweaker.api.oredict.IOreDict; -import minetweaker.api.oredict.IOreDictEntry; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCOreDict implements IOreDict { - @Override - public IOreDictEntry get(String name) { - return getOreDict(name); - } - - @Override - public List getEntries() { - List entries = new ArrayList(); - for (String key : OreDictionary.getOreNames()) { - if (!OreDictionary.getOres(key).isEmpty()) { - entries.add(MineTweakerMC.getOreDict(key)); - } - } - return entries; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/oredict/MCOreDictEntry.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/oredict/MCOreDictEntry.java deleted file mode 100644 index e802803..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/oredict/MCOreDictEntry.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.oredict; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.mc164.util.MineTweakerHacks; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.item.IngredientOr; -import minetweaker.api.item.IngredientStack; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStackWildcardSize; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.api.oredict.IngredientOreDict; -import minetweaker.api.player.IPlayer; -import minetweaker.util.ArrayUtil; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCOreDictEntry implements IOreDictEntry { - private final int id; - - public MCOreDictEntry(Integer id) { - this.id = id; - } - - public MCOreDictEntry(String id) { - this.id = OreDictionary.getOreID(id); - } - - // #################################### - // ### IOreDictEntry implementation ### - // #################################### - - @Override - public String getName() { - return OreDictionary.getOreName(id); - } - - @Override - public boolean isEmpty() { - return OreDictionary.getOres(id).isEmpty(); - } - - @Override - public void add(IItemStack item) { - ItemStack stack = getItemStack(item); - if (stack == null) { - MineTweakerAPI.logError("not a valid item"); - } else { - MineTweakerAPI.apply(new ActionAddItem(id, stack)); - } - } - - @Override - public void addAll(IOreDictEntry entry) { - if (entry instanceof MCOreDictEntry) { - MineTweakerAPI.apply(new ActionAddAll(id, ((MCOreDictEntry) entry).id)); - } else { - MineTweakerAPI.logError("not a valid entry"); - } - } - - @Override - public void remove(IItemStack item) { - ItemStack result = null; - for (ItemStack itemStack : OreDictionary.getOres(id)) { - if (item.matches(getIItemStackWildcardSize(itemStack))) { - result = itemStack; - break; - } - } - - if (result != null) { - MineTweakerAPI.apply(new ActionRemoveItem(id, result)); - } - } - - @Override - public boolean contains(IItemStack item) { - for (ItemStack itemStack : OreDictionary.getOres(id)) { - if (getIItemStackWildcardSize(itemStack).matches(item)) { - return true; - } - } - - return false; - } - - @Override - public void mirror(IOreDictEntry other) { - if (other instanceof MCOreDictEntry) { - MineTweakerAPI.apply(new ActionMirror(id, ((MCOreDictEntry) other).id)); - } else { - MineTweakerAPI.logError("not a valid oredict entry"); - } - } - - @Override - public String getMark() { - return null; - } - - @Override - public int getAmount() { - return 1; - } - - @Override - public List getItems() { - List result = new ArrayList(); - for (ItemStack item : OreDictionary.getOres(id)) { - result.add(getIItemStackWildcardSize(item)); - } - return result; - } - - @Override - public List getLiquids() { - return Collections.emptyList(); - } - - @Override - public IIngredient amount(int amount) { - return new IngredientStack(this, amount); - } - - @Override - public IIngredient transform(IItemTransformer transformer) { - return new IngredientOreDict(this, null, ArrayUtil.EMPTY_CONDITIONS, new IItemTransformer[] { transformer }); - } - - @Override - public IIngredient only(IItemCondition condition) { - return new IngredientOreDict(this, null, new IItemCondition[] { condition }, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient marked(String mark) { - return new IngredientOreDict(this, mark, ArrayUtil.EMPTY_CONDITIONS, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient or(IIngredient ingredient) { - return new IngredientOr(this, ingredient); - } - - @Override - public boolean matches(IItemStack item) { - return contains(item); - } - - @Override - public boolean matches(ILiquidStack liquid) { - return false; - } - - @Override - public boolean contains(IIngredient ingredient) { - List items = ingredient.getItems(); - for (IItemStack item : items) { - if (!matches(item)) return false; - } - - return true; - } - - @Override - public IItemStack applyTransform(IItemStack item, IPlayer byPlayer) { - return item; - } - - @Override - public boolean hasTransformers() { - return false; - } - - @Override - public Object getInternal() { - return OreDictionary.getOreName(id); - } - - // ############################# - // ### Object implementation ### - // ############################# - - @Override - public String toString() { - return ""; - } - - @Override - public int hashCode() { - return id; - } - - @Override - public boolean equals(Object other) { - if (!(other instanceof MCOreDictEntry)) return false; - return ((MCOreDictEntry) other).id == id; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class ActionAddItem implements IUndoableAction { - private final Integer id; - private final ItemStack item; - - public ActionAddItem(Integer id, ItemStack item) { - this.id = id; - this.item = item; - } - - @Override - public void apply() { - OreDictionary.registerOre(id, item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - OreDictionary.getOres(id).remove(item); - } - - @Override - public String describe() { - return "Adding " + item.getDisplayName() + " to ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public String describeUndo() { - return "Removing " + item.getDisplayName() + " from ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class ActionMirror implements IUndoableAction { - private final Integer idTarget; - private final Integer idSource; - - private final ArrayList targetCopy; - - public ActionMirror(Integer idTarget, Integer idSource) { - this.idTarget = idTarget; - this.idSource = idSource; - - targetCopy = OreDictionary.getOres(idTarget); - } - - @Override - public void apply() { - MineTweakerHacks.getOreStacks().put(idTarget, OreDictionary.getOres(idSource)); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MineTweakerHacks.getOreStacks().put(idTarget, targetCopy); - } - - @Override - public String describe() { - return "Mirroring " + OreDictionary.getOreName(idSource) + " to " + OreDictionary.getOreName(idTarget); - } - - @Override - public String describeUndo() { - return "Undoing mirror of " + OreDictionary.getOreName(idSource) + " to " + OreDictionary.getOreName(idTarget); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class ActionRemoveItem implements IUndoableAction { - private final Integer id; - private final ItemStack item; - - public ActionRemoveItem(Integer id, ItemStack item) { - this.id = id; - this.item = item; - } - - @Override - public void apply() { - OreDictionary.getOres(id).remove(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - OreDictionary.getOres(id).add(item); - } - - @Override - public String describe() { - return "Removing " + item.getDisplayName() + " from ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public String describeUndo() { - return "Restoring " + item.getDisplayName() + " to ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class ActionAddAll implements IUndoableAction { - private final Integer idTarget; - private final Integer idSource; - - public ActionAddAll(Integer idTarget, Integer idSource) { - this.idTarget = idTarget; - this.idSource = idSource; - } - - @Override - public void apply() { - List ores = OreDictionary.getOres(idTarget); - for (ItemStack stack : OreDictionary.getOres(idSource)) { - ores.add(stack); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - List ores = OreDictionary.getOres(idTarget); - for (ItemStack stack : OreDictionary.getOres(idSource)) { - ores.remove(stack); - } - } - - @Override - public String describe() { - return "Copying contents of ore dictionary entry " + OreDictionary.getOreName(idSource) + " to " + OreDictionary.getOreName(idTarget); - } - - @Override - public String describeUndo() { - return "Removing contents of ore dictionary entry " + OreDictionary.getOreName(idSource) + " from " + OreDictionary.getOreName(idTarget); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/player/MCPlayer.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/player/MCPlayer.java deleted file mode 100644 index 7dd7642..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/player/MCPlayer.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.player; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.chat.IChatMessage; -import minetweaker.mc164.data.NBTConverter; -import minetweaker.api.data.IData; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.mc164.MineTweakerMod; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatMessageComponent; - -/** - * - * @author Stan - */ -public class MCPlayer implements IPlayer { - private final EntityPlayer player; - - public MCPlayer(EntityPlayer player) { - this.player = player; - } - - public EntityPlayer getInternal() { - return player; - } - - @Override - public String getId() { - return null; - } - - @Override - public String getName() { - return player.getCommandSenderName(); - } - - @Override - public IData getData() { - return NBTConverter.from(player.getEntityData(), true); - } - - @Override - public void update(IData data) { - NBTConverter.updateMap(player.getEntityData(), data); - } - - @Override - public void sendChat(IChatMessage message) { - Object internal = message.getInternal(); - if (!(internal instanceof ChatMessageComponent)) { - //throw new RuntimeException("Not a valid chat message: " + internal); - MineTweakerAPI.logError("not a valid chat message"); - return; - } - player.sendChatToPlayer((ChatMessageComponent) internal); - } - - @Override - public void sendChat(String message) { - player.sendChatToPlayer(ChatMessageComponent.createFromText(message)); - } - - @Override - public int getHotbarSize() { - return 9; - } - - @Override - public IItemStack getHotbarStack(int i) { - return i < 0 || i >= 9 ? null : MineTweakerMC.getIItemStack(player.inventory.getStackInSlot(i)); - } - - @Override - public int getInventorySize() { - return player.inventory.getSizeInventory(); - } - - @Override - public IItemStack getInventoryStack(int i) { - return MineTweakerMC.getIItemStack(player.inventory.getStackInSlot(i)); - } - - @Override - public IItemStack getCurrentItem() { - return MineTweakerMC.getIItemStack(player.getCurrentEquippedItem()); - } - - @Override - public boolean isCreative() { - return player.capabilities.isCreativeMode; - } - - @Override - public boolean isAdventure() { - return !player.capabilities.allowEdit; - } - - @Override - public void openBrowser(String url) { - if (player instanceof EntityPlayerMP) { - MineTweakerMod.INSTANCE.openBrowser(player.username, url); - } - } - - @Override - public void copyToClipboard(String value) { - if (player instanceof EntityPlayerMP) { - MineTweakerMod.INSTANCE.copyToClipboard(player.username, value); - } - } - - @Override - public void give(IItemStack stack) { - player.inventory.addItemStackToInventory(MineTweakerMC.getItemStack(stack).copy()); - } - - @Override - public int hashCode() { - int hash = 3; - hash = 59 * hash + (this.player != null ? this.player.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MCPlayer other = (MCPlayer) obj; - if (this.player != other.player && (this.player == null || !this.player.equals(other.player))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/MCCraftingInventory.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/MCCraftingInventory.java deleted file mode 100644 index c09ab3b..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/MCCraftingInventory.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import java.util.List; -import minetweaker.mc164.util.MineTweakerHacks; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.player.IPlayer; -import minetweaker.api.recipes.ICraftingInventory; -import minetweaker.mc164.player.MCPlayer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotCrafting; -import net.minecraft.item.ItemStack; - -/** - * - * @author Stan - */ -public class MCCraftingInventory implements ICraftingInventory { - private static final ThreadLocal cache = new ThreadLocal(); - private static final ThreadLocal cache2 = new ThreadLocal(); - - public static MCCraftingInventory get(InventoryCrafting inventory) { - if (cache.get() == null || cache.get().inventory != inventory) { - MCCraftingInventory result = new MCCraftingInventory(inventory); - cache.set(result); - return result; - } else { - MCCraftingInventory result = cache.get(); - result.update(); - return result; - } - } - - public static MCCraftingInventory get(IInventory inventory, EntityPlayer player) { - if (cache2.get() == null || cache2.get().inventory != inventory || cache2.get().player != player) { - MCCraftingInventory result = new MCCraftingInventory(inventory, player); - cache2.set(result); - return result; - } else { - MCCraftingInventory result = cache2.get(); - result.update(); - return result; - } - } - - private int width; - private int height; - private final IInventory inventory; - private IItemStack[] stacks; - private ItemStack[] original; - private int stackCount; - private final IPlayer player; - private final EntityPlayer playerOrig; - - private MCCraftingInventory(InventoryCrafting inventory) { - this.inventory = inventory; - width = height = (int) Math.sqrt(inventory.getSizeInventory()); - stacks = new IItemStack[width * height]; - original = new ItemStack[stacks.length]; - stackCount = 0; - update(); - - Container container = MineTweakerHacks.getCraftingContainer(inventory); - if (container != null) { - List slots = container.inventorySlots; - if (!slots.isEmpty() && slots.get(0) instanceof SlotCrafting) { - SlotCrafting slotCrafting = (SlotCrafting) slots.get(0); - playerOrig = MineTweakerHacks.getCraftingSlotPlayer(slotCrafting); - player = new MCPlayer(playerOrig); - } else { - playerOrig = null; - player = null; - } - } else { - playerOrig = null; - player = null; - } - } - - public MCCraftingInventory(IInventory inventory, EntityPlayer player) { - this.inventory = inventory; - width = height = (int) Math.sqrt(inventory.getSizeInventory()); - stacks = new IItemStack[width * height]; - original = new ItemStack[stacks.length]; - stackCount = 0; - update(); - - playerOrig = player; - this.player = player == null ? null : new MCPlayer(player); - } - - private void update() { - if (inventory.getSizeInventory() != original.length) { - width = height = (int) Math.sqrt(inventory.getSizeInventory()); - stacks = new IItemStack[inventory.getSizeInventory()]; - original = new ItemStack[stacks.length]; - stackCount = 0; - } - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - if (changed(i)) { - //System.out.println("Slot " + i + " changed"); - original[i] = inventory.getStackInSlot(i); - if (inventory.getStackInSlot(i) != null) { - if (stacks[i] == null) stackCount++; - stacks[i] = getIItemStack(original[i]); - } else { - if (stacks[i] != null) stackCount--; - stacks[i] = null; - } - } - } - //System.out.println("Num stack count: " + stackCount); - } - - @Override - public IPlayer getPlayer() { - return player; - } - - @Override - public int getSize() { - return width * height; - } - - @Override - public int getWidth() { - return width; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public int getStackCount() { - return stackCount; - } - - @Override - public IItemStack getStack(int i) { - return stacks[i]; - } - - @Override - public IItemStack getStack(int x, int y) { - return stacks[y * width + x]; - } - - @Override - public void setStack(int x, int y, IItemStack stack) { - //System.out.println("SetStack(" + x + ", " + y + ") " + stack); - - int ix = y * width + x; - if (stack != stacks[ix]) { - if (stack == null) { - stackCount--; - inventory.setInventorySlotContents(ix, null); - } else { - inventory.setInventorySlotContents(ix, getItemStack(stack)); - - if (stacks[ix] == null) { - stackCount++; - } - } - stacks[ix] = stack; - } - } - - @Override - public void setStack(int i, IItemStack stack) { - //System.out.println("SetStack(" + i + ") " + stack); - - if (stack != stacks[i]) { - if (stack == null) { - stackCount--; - inventory.setInventorySlotContents(i, null); - } else { - inventory.setInventorySlotContents(i, getItemStack(stack)); - - if (stacks[i] == null) { - stackCount++; - } - } - stacks[i] = stack; - } - } - - private boolean changed(int i) { - if (original[i] != inventory.getStackInSlot(i)) return true; - if (original[i] != null && stacks[i].getAmount() != original[i].stackSize) return true; - - return false; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/MCRecipeManager.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/MCRecipeManager.java deleted file mode 100644 index 5eb12f9..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/MCRecipeManager.java +++ /dev/null @@ -1,419 +0,0 @@ -package minetweaker.mc164.recipes; - -import minetweaker.api.recipes.ShapedRecipe; -import minetweaker.api.recipes.ShapelessRecipe; -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.mc164.util.MineTweakerHacks; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getOreDict; -import minetweaker.api.player.IPlayer; -import minetweaker.api.recipes.ICraftingInventory; -import minetweaker.api.recipes.ICraftingRecipe; -import minetweaker.api.recipes.IRecipeFunction; -import minetweaker.api.recipes.IRecipeManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -/** - * - * @author Stan - */ -public class MCRecipeManager implements IRecipeManager { - private final List recipes; - private final List transformerRecipes; - - public MCRecipeManager() { - recipes = (List) CraftingManager.getInstance().getRecipeList(); - transformerRecipes = new ArrayList(); - } - - public boolean hasTransformerRecipes() { - return transformerRecipes.size() > 0; - } - - public void applyTransformations(ICraftingInventory inventory, IPlayer player) { - for (ICraftingRecipe recipe : transformerRecipes) { - if (recipe.matches(inventory)) { - recipe.applyTransformers(inventory, player); - return; - } - } - } - - @Override - public List getRecipesFor(IIngredient ingredient) { - List results = new ArrayList(); - - for (IRecipe recipe : recipes) { - if (ingredient.matches(MineTweakerMC.getIItemStack(recipe.getRecipeOutput()))) { - ICraftingRecipe converted = RecipeConverter.toCraftingRecipe(recipe); - results.add(converted); - } - } - - return results; - } - - @Override - public List getAll() { - List results = new ArrayList(); - - for (IRecipe recipe : recipes) { - ICraftingRecipe converted = RecipeConverter.toCraftingRecipe(recipe); - results.add(converted); - } - - return results; - } - - @Override - public int remove(IIngredient output) { - List toRemove = new ArrayList(); - List removeIndex = new ArrayList(); - for (int i = 0; i < recipes.size(); i++) { - IRecipe recipe = recipes.get(i); - - // certain special recipes have no predefined output. ignore those - // since these cannot be removed with MineTweaker scripts - if (recipe.getRecipeOutput() != null) { - if (output.matches(getIItemStack(recipe.getRecipeOutput()))) { - toRemove.add(recipe); - removeIndex.add(i); - } - } - } - - MineTweakerAPI.apply(new ActionRemoveRecipes(toRemove, removeIndex)); - return toRemove.size(); - } - - @Override - public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) { - addShaped(output, ingredients, null, false); - } - - @Override - public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) { - addShaped(output, ingredients, null, true); - } - - @Override - public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function) { - ShapelessRecipe recipe = new ShapelessRecipe(output, ingredients, function); - IRecipe irecipe = RecipeConverter.convert(recipe); - MineTweakerAPI.apply(new ActionAddRecipe(irecipe, recipe)); - } - - @Override - public int removeShaped(IIngredient output, IIngredient[][] ingredients) { - int ingredientsWidth = 0; - int ingredientsHeight = 0; - - if (ingredients != null) { - ingredientsHeight = ingredients.length; - - for (int i = 0; i < ingredients.length; i++) { - ingredientsWidth = Math.max(ingredientsWidth, ingredients[i].length); - } - } - - List toRemove = new ArrayList(); - List removeIndex = new ArrayList(); - outer: for (int i = 0; i < recipes.size(); i++) { - IRecipe recipe = recipes.get(i); - - if (recipe.getRecipeOutput() == null || !output.matches(getIItemStack(recipe.getRecipeOutput()))) { - continue; - } - - if (ingredients != null) { - if (recipe instanceof ShapedRecipes) { - ShapedRecipes srecipe = (ShapedRecipes) recipe; - if (ingredientsWidth != srecipe.recipeWidth || ingredientsHeight != srecipe.recipeHeight) { - continue; - } - - for (int j = 0; j < ingredientsHeight; j++) { - IIngredient[] row = ingredients[j]; - for (int k = 0; k < ingredientsWidth; k++) { - IIngredient ingredient = k > row.length ? null : row[k]; - ItemStack recipeIngredient = srecipe.recipeItems[j * srecipe.recipeWidth + k]; - - if (!matches(recipeIngredient, ingredient)) { - continue outer; - } - } - } - } else if (recipe instanceof ShapedOreRecipe) { - ShapedOreRecipe srecipe = (ShapedOreRecipe) recipe; - int recipeWidth = MineTweakerHacks.getShapedOreRecipeWidth(srecipe); - int recipeHeight = srecipe.getRecipeSize() / recipeWidth; - if (ingredientsWidth != recipeWidth || ingredientsHeight != recipeHeight) { - continue; - } - - for (int j = 0; j < ingredientsHeight; j++) { - IIngredient[] row = ingredients[j]; - for (int k = 0; k < ingredientsWidth; k++) { - IIngredient ingredient = k > row.length ? null : row[k]; - Object input = srecipe.getInput()[j * recipeWidth + k]; - if (!matches(input, ingredient)) { - continue outer; - } - } - } - } - } else { - if (recipe instanceof ShapedRecipes) { - - } else if (recipe instanceof ShapedOreRecipe) { - - } else { - continue; - } - } - - toRemove.add(recipe); - removeIndex.add(i); - } - - MineTweakerAPI.apply(new ActionRemoveRecipes(toRemove, removeIndex)); - return toRemove.size(); - } - - @Override - public int removeShapeless(IIngredient output, IIngredient[] ingredients, boolean wildcard) { - List toRemove = new ArrayList(); - List removeIndex = new ArrayList(); - outer: for (int i = 0; i < recipes.size(); i++) { - IRecipe recipe = recipes.get(i); - - if (recipe.getRecipeOutput() == null || !output.matches(getIItemStack(recipe.getRecipeOutput()))) { - continue; - } - - if (ingredients != null) { - if (recipe instanceof ShapelessRecipes) { - ShapelessRecipes srecipe = (ShapelessRecipes) recipe; - - if (ingredients.length > srecipe.getRecipeSize()) { - continue; - } else if (!wildcard && ingredients.length < srecipe.getRecipeSize()) { - continue; - } - - checkIngredient: for (int j = 0; j < ingredients.length; j++) { - for (int k = 0; k < srecipe.getRecipeSize(); k++) { - if (matches(srecipe.recipeItems.get(k), ingredients[j])) { - continue checkIngredient; - } - } - - continue outer; - } - } else if (recipe instanceof ShapelessOreRecipe) { - ShapelessOreRecipe srecipe = (ShapelessOreRecipe) recipe; - ArrayList inputs = srecipe.getInput(); - - if (inputs.size() < ingredients.length) { - continue; - } if (!wildcard && inputs.size() > ingredients.length) { - continue; - } - - checkIngredient: for (int j = 0; j < ingredients.length; j++) { - for (int k = 0; k < srecipe.getRecipeSize(); k++) { - if (matches(inputs.get(k), ingredients[j])) { - continue checkIngredient; - } - } - - continue outer; - } - } - } else { - if (recipe instanceof ShapelessRecipes) { - - } else if (recipe instanceof ShapelessOreRecipe) { - - } else { - continue; - } - } - - toRemove.add(recipe); - removeIndex.add(i); - } - - MineTweakerAPI.apply(new ActionRemoveRecipes(toRemove, removeIndex)); - return toRemove.size(); - } - - @Override - public IItemStack craft(IItemStack[][] contents) { - Container container = new ContainerVirtual(); - - int width = 0; - int height = contents.length; - for (IItemStack[] row : contents) { - width = Math.max(width, row.length); - } - - ItemStack[] iContents = new ItemStack[width * height]; - for (int i = 0; i < height; i++) { - for (int j = 0; j < contents[i].length; j++) { - if (contents[i][j] != null) { - iContents[i * width + j] = getItemStack(contents[j][j]); - } - } - } - - InventoryCrafting inventory = new InventoryCrafting(container, width, height); - for (int i = 0; i < iContents.length; i++) { - inventory.setInventorySlotContents(i, iContents[i]); - } - ItemStack result = CraftingManager.getInstance().findMatchingRecipe(inventory, null); - if (result == null) { - return null; - } else { - return getIItemStack(result); - } - } - - private class ContainerVirtual extends Container { - @Override - public boolean canInteractWith(EntityPlayer var1) { - return false; - } - } - - private class ActionRemoveRecipes implements IUndoableAction { - private final List removingIndices; - private final List removingRecipes; - - public ActionRemoveRecipes(List recipes, List indices) { - this.removingIndices = indices; - this.removingRecipes = recipes; - } - - @Override - public void apply() { - for (int i = removingIndices.size() - 1; i >= 0; i--) { - recipes.remove((int) removingIndices.get(i)); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (int i = 0; i < removingIndices.size(); i++) { - int index = Math.min(recipes.size(), removingIndices.get(i)); - recipes.add(index, removingRecipes.get(i)); - } - } - - @Override - public String describe() { - return "Removing " + removingIndices.size() + " recipes"; - } - - @Override - public String describeUndo() { - return "Restoring " + removingIndices.size() + " recipes"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionAddRecipe implements IUndoableAction { - private final IRecipe recipe; - private final ICraftingRecipe craftingRecipe; - - public ActionAddRecipe(IRecipe recipe, ICraftingRecipe craftingRecipe) { - this.recipe = recipe; - this.craftingRecipe = craftingRecipe; - } - - @Override - public void apply() { - recipes.add(recipe); - if (craftingRecipe.hasTransformers()) { - transformerRecipes.add(craftingRecipe); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - recipes.remove(recipe); - if (craftingRecipe.hasTransformers()) { - transformerRecipes.remove(craftingRecipe); - } - } - - @Override - public String describe() { - return "Adding recipe for " + recipe.getRecipeOutput().getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing recipe for " + recipe.getRecipeOutput().getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static boolean matches(Object input, IIngredient ingredient) { - if ((input == null) != (ingredient == null)) { - return false; - } else if (ingredient != null) { - if (input instanceof ItemStack) { - if (!ingredient.matches(getIItemStack((ItemStack) input))) { - return false; - } - } else if (input instanceof String) { - if (!ingredient.contains(getOreDict((String) input))) { - return false; - } - } - } - - return true; - } - - private void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, boolean mirrored) { - ShapedRecipe recipe = new ShapedRecipe(output, ingredients, function, mirrored); - IRecipe irecipe = RecipeConverter.convert(recipe); - MineTweakerAPI.apply(new ActionAddRecipe(irecipe, recipe)); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/RecipeConverter.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/RecipeConverter.java deleted file mode 100644 index aeb85db..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/RecipeConverter.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import minetweaker.api.recipes.ShapedRecipe; -import minetweaker.api.recipes.ShapelessRecipe; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ICraftingRecipe; -import minetweaker.api.recipes.UnknownRecipe; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -/** - * - * @author Stan - */ -public class RecipeConverter { - private RecipeConverter() {} - - public static final int TYPE_ADVANCED = 0; - public static final int TYPE_ORE = 1; - public static final int TYPE_BASIC = 2; - - private static int getIngredientType(IIngredient pattern) { - Object internal = pattern.getInternal(); - if (internal == null) { - return TYPE_ADVANCED; - } else if (internal instanceof ItemStack) { - return TYPE_BASIC; - } else { - return TYPE_ORE; - } - } - - private static int getRecipeType(IIngredient[] ingredients) { - int type = TYPE_BASIC; - for (IIngredient ingredient : ingredients) { - type = Math.min(type, getIngredientType(ingredient)); - } - return type; - } - - public static IRecipe convert(ShapelessRecipe recipe) { - IIngredient[] ingredients = recipe.getIngredients(); - int type = getRecipeType(ingredients); - - if (type == TYPE_BASIC) { - ItemStack[] items = new ItemStack[ingredients.length]; - for (int i = 0; i < ingredients.length; i++) { - items[i] = getItemStack(ingredients[i]); - } - return new ShapelessRecipeBasic(items, recipe); - } else if (type == TYPE_ORE) { - Object[] items = new Object[ingredients.length]; - for (int i = 0; i < ingredients.length; i++) { - items[i] = ingredients[i].getInternal(); - } - return new ShapelessRecipeOre(items, recipe); - } else { - return new ShapelessRecipeAdvanced(recipe); - } - } - - public static IRecipe convert(ShapedRecipe recipe) { - IIngredient[] ingredients = recipe.getIngredients(); - byte[] posx = recipe.getIngredientsX(); - byte[] posy = recipe.getIngredientsY(); - - // determine recipe type - int type = getRecipeType(ingredients); - - // construct recipe - if (type == TYPE_BASIC) { - System.out.println("Converted to basic recipe"); - ItemStack[] basicIngredients = new ItemStack[recipe.getHeight() * recipe.getWidth()]; - for (int i = 0; i < ingredients.length; i++) { - basicIngredients[posx[i] + posy[i] * recipe.getWidth()] = getItemStack(ingredients[i]); - } - - return new ShapedRecipeBasic(basicIngredients, recipe); - } else if (type == TYPE_ORE) { - System.out.println("Converted to ore recipe"); - Object[] converted = new Object[recipe.getHeight() * recipe.getWidth()]; - for (int i = 0; i < ingredients.length; i++) { - converted[posx[i] + posy[i] * recipe.getWidth()] = ingredients[i].getInternal(); - } - - // arguments contents: - // 1) recipe patterns - // 2) characters + ingredients - - int counter = 0; - String[] parts = new String[recipe.getHeight()]; - ArrayList rarguments = new ArrayList(); - for (int i = 0; i < recipe.getHeight(); i++) { - char[] pattern = new char[recipe.getWidth()]; - for (int j = 0; j < recipe.getWidth(); j++) { - int off = i * recipe.getWidth() + j; - if (converted[off] == null) { - pattern[j] = ' '; - } else { - pattern[j] = (char) ('A' + counter); - rarguments.add(pattern[j]); - rarguments.add(converted[off]); - counter++; - } - } - parts[i] = new String(pattern); - } - - rarguments.addAll(0, Arrays.asList(parts)); - - return new ShapedRecipeOre(rarguments.toArray(), recipe); - } else { - System.out.println("Converted to advanced recipe"); - return new ShapedRecipeAdvanced(recipe); - } - } - - public static ICraftingRecipe toCraftingRecipe(IRecipe recipe) { - IItemStack output = MineTweakerMC.getIItemStack(recipe.getRecipeOutput()); - - if (recipe instanceof ShapelessRecipes) { - ShapelessRecipes shapeless = (ShapelessRecipes) recipe; - - IIngredient[] ingredients = new IIngredient[shapeless.recipeItems.size()]; - for (int i = 0; i < ingredients.length; i++) { - ingredients[i] = MineTweakerMC.getIIngredient(shapeless.recipeItems.get(i)); - } - - return new ShapelessRecipe(output, ingredients, null); - } else if (recipe instanceof ShapedRecipes) { - ShapedRecipes shaped = (ShapedRecipes) recipe; - - IIngredient[][] ingredients = new IIngredient[shaped.recipeHeight][shaped.recipeWidth]; - for (int i = 0; i < shaped.recipeHeight; i++) { - for (int j = 0; j < shaped.recipeWidth; j++) { - ingredients[i][j] = MineTweakerMC.getIItemStack(shaped.recipeItems[i * shaped.recipeWidth + j]); - } - } - - return new ShapedRecipe(output, ingredients, null, false); - } else if (recipe instanceof ShapedOreRecipe) { - ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; - - int width = (int) Math.sqrt(recipe.getRecipeSize()); - int height = recipe.getRecipeSize() / width; - - IIngredient[][] recipeIngredients = new IIngredient[height][width]; - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - recipeIngredients[i][j] = MineTweakerMC.getIIngredient(shaped.getInput()[i * width + j]); - } - } - - return new ShapedRecipe(output, recipeIngredients, null, false); - } else if (recipe instanceof ShapelessOreRecipe) { - ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; - - IIngredient[] ingredients = new IIngredient[shapeless.getRecipeSize()]; - for (int i = 0; i < ingredients.length; i++) { - ingredients[i] = MineTweakerMC.getIIngredient(shapeless.getInput().get(i)); - } - - return new ShapelessRecipe(output, ingredients, null); - } else { - return new UnknownRecipe(output); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeAdvanced.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeAdvanced.java deleted file mode 100644 index 7e2bcc8..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeAdvanced.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapedRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -/** - * TODO: NEI integration for this kind of recipes. - * - * @author Stan - */ -public class ShapedRecipeAdvanced implements IRecipe { - private final ShapedRecipe recipe; - - public ShapedRecipeAdvanced(ShapedRecipe recipe) { - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } - - @Override - public int getRecipeSize() { - return recipe.getWidth() * recipe.getHeight(); - } - - @Override - public ItemStack getRecipeOutput() { - return getItemStack(recipe.getOutput()); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeBasic.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeBasic.java deleted file mode 100644 index e120ef3..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeBasic.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapedRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class ShapedRecipeBasic extends ShapedRecipes { - private final ShapedRecipe recipe; - - public ShapedRecipeBasic(ItemStack[] basicInputs, ShapedRecipe recipe) { - super(recipe.getWidth(), recipe.getHeight(), basicInputs, getItemStack(recipe.getOutput())); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - IItemStack result = recipe.getCraftingResult(MCCraftingInventory.get(inventory)); - if (result == null) { - return null; - } else { - return getItemStack(result).copy(); - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeOre.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeOre.java deleted file mode 100644 index c39fcff..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapedRecipeOre.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapedRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.oredict.ShapedOreRecipe; - -/** - * - * @author Stan - */ -public class ShapedRecipeOre extends ShapedOreRecipe { - private final ShapedRecipe recipe; - - public ShapedRecipeOre(Object[] contents, ShapedRecipe recipe) { - super(getItemStack(recipe.getOutput()), contents); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeAdvanced.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeAdvanced.java deleted file mode 100644 index 7226231..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeAdvanced.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapelessRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class ShapelessRecipeAdvanced implements IRecipe { - private final ShapelessRecipe recipe; - - public ShapelessRecipeAdvanced(ShapelessRecipe recipe) { - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } - - @Override - public int getRecipeSize() { - return recipe.getSize(); - } - - @Override - public ItemStack getRecipeOutput() { - return getItemStack(recipe.getOutput()); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeBasic.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeBasic.java deleted file mode 100644 index 62203ac..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeBasic.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import minetweaker.api.recipes.ShapelessRecipe; -import java.util.Arrays; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class ShapelessRecipeBasic extends ShapelessRecipes { - private final ShapelessRecipe recipe; - - public ShapelessRecipeBasic(ItemStack[] ingredients, ShapelessRecipe recipe) { - super(getItemStack(recipe.getOutput()), Arrays.asList(ingredients)); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeOre.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeOre.java deleted file mode 100644 index 2969aeb..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/recipes/ShapelessRecipeOre.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapelessRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -/** - * - * @author Stan - */ -public class ShapelessRecipeOre extends ShapelessOreRecipe { - private final ShapelessRecipe recipe; - - public ShapelessRecipeOre(Object[] ingredients, ShapelessRecipe recipe) { - super(getItemStack(recipe.getOutput()), ingredients); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/server/MCServer.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/server/MCServer.java deleted file mode 100644 index f425def..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/server/MCServer.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.server; - -import java.util.Arrays; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.AbstractServer; -import minetweaker.api.server.ICommandFunction; -import minetweaker.api.server.ICommandTabCompletion; -import minetweaker.api.server.ICommandValidator; -import net.minecraft.command.CommandHandler; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; - -/** - * - * @author Stan - */ -public class MCServer extends AbstractServer { - private final MinecraftServer server; - - public MCServer(MinecraftServer server) { - this.server = server; - } - - @Override - public void addCommand(String name, String usage, String[] aliases, ICommandFunction function, ICommandValidator validator, ICommandTabCompletion completion) { - ICommand command = new MCCommand(name, usage, aliases, function, validator, completion); - MineTweakerAPI.apply(new AddCommandAction(command)); - } - - @Override - public void removeCommand(String name) { - ICommand command = (ICommand)((CommandHandler) server.getCommandManager()).getCommands().get(name); - if (command == null) { - MineTweakerAPI.logWarning("No such command: " + name); - } else { - MineTweakerAPI.apply(new RemoveCommandAction(command)); - } - } - - @Override - public boolean isOp(IPlayer player) { - return MinecraftServer.getServer().getConfigurationManager().getOps().isEmpty() - || MinecraftServer.getServer().getConfigurationManager().getOps().contains(player.getName()) - || player == ServerPlayer.INSTANCE; - } - - private static IPlayer getPlayer(ICommandSender commandSender) { - if (commandSender instanceof EntityPlayer) { - return MineTweakerMC.getIPlayer((EntityPlayer) commandSender); - } else if (commandSender instanceof DedicatedServer) { - return ServerPlayer.INSTANCE; - } else { - System.out.println("Unsupported command sender: " + commandSender); - System.out.println("player name: " + commandSender.getCommandSenderName()); - return null; - } - } - - private static void removeCommand(ICommand command) { - CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); - ch.getCommands().remove(command.getCommandName()); - - if (command.getCommandAliases() != null) { - for (String alias : (List)command.getCommandAliases()) { - ch.getCommands().remove(alias); - } - } - } - - private class MCCommand implements ICommand { - private final String name; - private final String usage; - private final List aliases; - private final ICommandFunction function; - private final ICommandValidator validator; - private final ICommandTabCompletion completion; - - public MCCommand(String name, String usage, String[] aliases, ICommandFunction function, ICommandValidator validator, ICommandTabCompletion completion) { - this.name = name; - this.usage = usage; - this.aliases = Arrays.asList(aliases); - this.function = function; - this.validator = validator; - this.completion = completion; - } - - @Override - public String getCommandName() { - return name; - } - - @Override - public String getCommandUsage(ICommandSender var1) { - return usage; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public void processCommand(ICommandSender var1, String[] var2) { - function.execute(var2, getPlayer(var1)); - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender var1) { - if (validator == null) { - return true; - } else { - return validator.canExecute(getPlayer(var1)); - } - } - - @Override - public List addTabCompletionOptions(ICommandSender var1, String[] var2) { - if (completion != null) { - return Arrays.asList(completion.getTabCompletionOptions(var2, getPlayer(var1))); - } else { - return null; - } - } - - @Override - public boolean isUsernameIndex(String[] var1, int var2) { - return false; - } - - @Override - public int compareTo(Object o) { - return 0; - } - } - - private class AddCommandAction implements IUndoableAction { - private final ICommand command; - - public AddCommandAction(ICommand command) { - this.command = command; - } - - @Override - public void apply() { - CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); - ch.registerCommand(command); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - removeCommand(command); - } - - @Override - public String describe() { - return "Adding command " + command.getCommandName(); - } - - @Override - public String describeUndo() { - return "Removing command " + command.getCommandName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class RemoveCommandAction implements IUndoableAction { - private final ICommand command; - - public RemoveCommandAction(ICommand command) { - this.command = command; - } - - @Override - public void apply() { - removeCommand(command); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); - ch.registerCommand(command); - } - - @Override - public String describe() { - return "Adding command " + command.getCommandName(); - } - - @Override - public String describeUndo() { - return "Removing command " + command.getCommandName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/server/ServerPlayer.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/server/ServerPlayer.java deleted file mode 100644 index 15337f5..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/server/ServerPlayer.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.server; - -import java.awt.Desktop; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.io.IOException; -import java.net.URI; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.api.chat.IChatMessage; -import minetweaker.api.data.IData; -import minetweaker.api.item.IItemStack; -import minetweaker.api.player.IPlayer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.util.ChatMessageComponent; - -/** - * - * @author Stan - */ -public class ServerPlayer implements IPlayer { - public static final ServerPlayer INSTANCE = new ServerPlayer(); - - private ServerPlayer() { - - } - - @Override - public String getId() { - return "server"; - } - - @Override - public String getName() { - return "Server"; - } - - @Override - public IData getData() { - // TODO: implement - return null; - } - - @Override - public void update(IData data) { - // TODO: implement - } - - @Override - public void sendChat(IChatMessage message) { - DedicatedServer.getServer().sendChatToPlayer((ChatMessageComponent) message.getInternal()); - } - - @Override - public void sendChat(String message) { - DedicatedServer.getServer().sendChatToPlayer(ChatMessageComponent.createFromText(message)); - } - - @Override - public int getHotbarSize() { - return 0; - } - - @Override - public IItemStack getHotbarStack(int i) { - return null; - } - - @Override - public int getInventorySize() { - return 0; - } - - @Override - public IItemStack getInventoryStack(int i) { - return null; - } - - @Override - public IItemStack getCurrentItem() { - return null; - } - - @Override - public boolean isCreative() { - return true; - } - - @Override - public boolean isAdventure() { - return false; - } - - @Override - public void openBrowser(String url) { - if (Desktop.isDesktopSupported()) { - try { - Desktop.getDesktop().browse(URI.create(url)); - } catch (IOException ex) { - Logger.getLogger(ServerPlayer.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - @Override - public void copyToClipboard(String value) { - if (Desktop.isDesktopSupported()) { - StringSelection stringSelection = new StringSelection(value); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(stringSelection, null); - } - } - - @Override - public void give(IItemStack stack) { - - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerHacks.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerHacks.java deleted file mode 100644 index 521a0ac..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerHacks.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.util; - -import com.google.common.collect.BiMap; -import cpw.mods.fml.common.registry.EntityRegistry; -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.SlotCrafting;import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.StatCollector; -import net.minecraft.util.StringTranslate; -import net.minecraft.util.WeightedRandomItem; -import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; - -/** - * Common class for all runtime hacks (stuff requiring reflection). It is not - * unexpected to have it break with new minecraft versions and may need regular - * adjustment - as such, those have been collected here. - * - * @author Stan Hebben - */ -public class MineTweakerHacks { - private static final Field NBTTAGCOMPOUND_TAGMAP; - private static final Field OREDICTIONARY_ORESTACKS; - private static final Field MINECRAFTSERVER_ANVILFILE; - private static final Field SHAPEDORERECIPE_WIDTH; - - private static final Field INVENTORYCRAFTING_EVENTHANDLER; - private static final Field SLOTCRAFTING_PLAYER; - - private static final Field ENTITYREGISTRY_CLASSREGISTRATIONS; - private static final Field SEEDENTRY_SEED; - private static final Constructor SEEDENTRY_CONSTRUCTOR; - - static { - NBTTAGCOMPOUND_TAGMAP = getField(NBTTagCompound.class, MineTweakerObfuscation.NBTTAGCOMPOUND_TAGMAP); - OREDICTIONARY_ORESTACKS = getField(OreDictionary.class, MineTweakerObfuscation.OREDICTIONARY_ORESTACKS); - MINECRAFTSERVER_ANVILFILE = getField(MinecraftServer.class, MineTweakerObfuscation.MINECRAFTSERVER_ANVILFILE); - SHAPEDORERECIPE_WIDTH = getField(ShapedOreRecipe.class, new String[] {"width"}); - - INVENTORYCRAFTING_EVENTHANDLER = getField(InventoryCrafting.class, MineTweakerObfuscation.INVENTORYCRAFTING_EVENTHANDLER); - SLOTCRAFTING_PLAYER = getField(SlotCrafting.class, MineTweakerObfuscation.SLOTCRAFTING_PLAYER); - - ENTITYREGISTRY_CLASSREGISTRATIONS = getField(EntityRegistry.class, new String[] {"entityClassRegistrations"}); - - Class forgeSeedEntry = null; - try { - forgeSeedEntry = (Class) Class.forName("net.minecraftforge.common.ForgeHooks$SeedEntry"); - } catch (ClassNotFoundException ex) {} - - SEEDENTRY_SEED = getField(forgeSeedEntry, "seed"); - - Constructor seedEntryConstructor = null; - - try { - seedEntryConstructor = forgeSeedEntry.getConstructor(ItemStack.class, int.class); - seedEntryConstructor.setAccessible(true); - } catch (NoSuchMethodException ex) { - Logger.getLogger(MineTweakerHacks.class.getName()).log(Level.SEVERE, null, ex); - } catch (SecurityException ex) { - Logger.getLogger(MineTweakerHacks.class.getName()).log(Level.SEVERE, null, ex); - } - - SEEDENTRY_CONSTRUCTOR = seedEntryConstructor; - } - - private MineTweakerHacks() {} - - public static BiMap, EntityRegistry.EntityRegistration> getEntityClassRegistrations() { - try { - return (BiMap, EntityRegistry.EntityRegistration>) ENTITYREGISTRY_CLASSREGISTRATIONS.get(EntityRegistry.instance()); - } catch (IllegalArgumentException ex) { - return null; - } catch (IllegalAccessException ex) { - return null; - } - } - - public static Map getNBTCompoundMap(NBTTagCompound tag) { - try { - return (Map) NBTTAGCOMPOUND_TAGMAP.get(tag); - } catch (IllegalArgumentException ex) { - return null; - } catch (IllegalAccessException ex) { - return null; - } - } - - - public static List getSeeds() { - return getPrivateStaticObject(ForgeHooks.class, "seedList"); - } - - public static Map getChestLoot() { - return getPrivateStaticObject(ChestGenHooks.class, "chestInfo"); - } - - public static Map getTranslations() { - return getPrivateObject( - getPrivateStaticObject(StatCollector.class, "localizedName", "field_74839_a"), - "languageList", - "field_74816_c"); - } - - public static Map> getOreStacks() { - try { - return (Map>) OREDICTIONARY_ORESTACKS.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("ERROR - could not load ore dictionary stacks!"); - return null; - } - } - - public static File getAnvilFile(MinecraftServer server) { - try { - return (File) MINECRAFTSERVER_ANVILFILE.get(server); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not load anvil file!"); - return null; - } - } - - public static File getWorldDirectory(MinecraftServer server) { - if (server.isDedicatedServer()) { - return server.getFile("world"); - } else { - File worldsDir = getAnvilFile(server); - if (worldsDir == null) return null; - - return new File(worldsDir, server.getFolderName()); - } - } - - public static int getShapedOreRecipeWidth(ShapedOreRecipe recipe) { - try { - return SHAPEDORERECIPE_WIDTH.getInt(recipe); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not load anvil file!"); - return 3; - } - } - - public static Container getCraftingContainer(InventoryCrafting inventory) { - try { - return (Container) INVENTORYCRAFTING_EVENTHANDLER.get(inventory); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get inventory eventhandler"); - return null; - } - } - - public static EntityPlayer getCraftingSlotPlayer(SlotCrafting slot) { - try { - return (EntityPlayer) SLOTCRAFTING_PLAYER.get(slot); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get inventory eventhandler"); - return null; - } - } - - public static StringTranslate getStringTranslateInstance() { - try { - Field field = getField(StringTranslate.class, MineTweakerObfuscation.STRINGTRANSLATE_INSTANCE); - return (StringTranslate) field.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get string translator"); - return null; - } - } - - public static Map getFluidContainerMap() { - try { - Field field = getField(FluidContainerRegistry.class, new String[] {"containerFluidMap"}); - return (Map) field.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get fluid container registry"); - return null; - } - } - - public static Map getFilledContainerMap() { - try { - Field field = getField(FluidContainerRegistry.class, new String[] {"filledContainerMap"}); - return (Map) field.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get filled container map"); - return null; - } - } - - public static Set getEmptyContainers() { - try { - Field field = getField(FluidContainerRegistry.class, new String[] {"emptyContainers"}); - return (Set) field.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get filled container map"); - return null; - } - } - - public static ItemStack getSeedEntrySeed(Object entry) { - try { - return (ItemStack) SEEDENTRY_SEED.get(entry); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get SeedEntry seed"); - return null; - } - } - - public static WeightedRandomItem constructSeedEntry(WeightedItemStack stack) { - try { - return SEEDENTRY_CONSTRUCTOR.newInstance(MineTweakerMC.getItemStack(stack.getStack()), (int) stack.getChance()); - } catch (InstantiationException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } catch (IllegalArgumentException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } catch (InvocationTargetException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } - - return null; - } - - public static T getPrivateStaticObject(Class cls, String... names) { - for (String name : names) { - try { - Field field = cls.getDeclaredField(name); - field.setAccessible(true); - return (T) field.get(null); - } catch (NoSuchFieldException ex) { - - } catch (SecurityException ex) { - - } catch (IllegalAccessException ex) { - - } - } - - return null; - } - - public static T getPrivateObject(Object object, String... names) { - Class cls = object.getClass(); - for (String name : names) { - try { - Field field = cls.getDeclaredField(name); - field.setAccessible(true); - return (T) field.get(object); - } catch (NoSuchFieldException ex) { - - } catch (SecurityException ex) { - - } catch (IllegalAccessException ex) { - - } - } - - return null; - } - - // ####################### - // ### Private Methods ### - // ####################### - - private static Field getField(Class cls, String... names) { - for (String name : names) { - try { - Field field = cls.getDeclaredField(name); - field.setAccessible(true); - return field; - } catch (NoSuchFieldException ex) { - } catch (SecurityException ex) { - } - } - - return null; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerObfuscation.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerObfuscation.java deleted file mode 100644 index ea2b767..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerObfuscation.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.util; - -/** - * - * @author Stanneke - */ -public class MineTweakerObfuscation { - private MineTweakerObfuscation() {} - - public static final String[] NBTTAGCOMPOUND_TAGMAP = {"tagMap", "field_74784_a"}; - public static final String[] OREDICTIONARY_ORESTACKS = {"oreStacks"}; - public static final String[] MINECRAFTSERVER_ANVILFILE = {"anvilFile", "field_71308_o"}; - public static final String[] INVENTORYCRAFTING_EVENTHANDLER = {"eventHandler", "field_70465_c"}; - public static final String[] SLOTCRAFTING_PLAYER = {"thePlayer", "field_75238_b"}; - public static final String[] STRINGTRANSLATE_INSTANCE = {"instance", "field_74817_a"}; -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerPlatformUtils.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerPlatformUtils.java deleted file mode 100644 index abc83a8..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/util/MineTweakerPlatformUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.util; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.EntityLivingBase; - -/** - * - * @author Stan - */ -public class MineTweakerPlatformUtils { - private MineTweakerPlatformUtils() {} - - public static Class getLivingEntityClass(String entityClassName) { - try { - Class entityClass = Class.forName(entityClassName); - if (!EntityLivingBase.class.isAssignableFrom(entityClass)) { - throw new RuntimeException("Not an entity class: " + entityClassName); - } - return (Class) entityClass; - } catch (ClassNotFoundException ex) { - throw new RuntimeException("entity class not found: " + entityClassName); - } - } - - public static String getLanguage() { - return FMLCommonHandler.instance().getSide() == Side.SERVER ? null : FMLClientHandler.instance().getCurrentLanguage(); - } - - public static boolean isLanguageActive(String lang) { - String current = getLanguage(); - return current != null && current.equals(lang); - } - - public static boolean isClient() { - return FMLCommonHandler.instance().getSide() == Side.CLIENT; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCLootRegistry.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCLootRegistry.java deleted file mode 100644 index 6c726a8..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCLootRegistry.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.vanilla; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.vanilla.ILootRegistry; -import minetweaker.api.vanilla.LootEntry; -import minetweaker.mc164.util.MineTweakerHacks; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraftforge.common.ChestGenHooks; - -/** - * - * @author Stan - */ -public class MCLootRegistry implements ILootRegistry { - private static final Map LOOT = MineTweakerHacks.getChestLoot(); - - @Override - public void addChestLoot(String type, WeightedItemStack item) { - WeightedRandomChestContent content = new WeightedRandomChestContent( - MineTweakerMC.getItemStack(item.getStack()), - 1, - 1, - (int) item.getChance()); - MineTweakerAPI.apply(new AddLootAction(type, content)); - } - - @Override - public void addChestLoot(String type, WeightedItemStack item, int min, int max) { - WeightedRandomChestContent content = new WeightedRandomChestContent( - MineTweakerMC.getItemStack(item.getStack()), - min, - max, - (int) item.getChance()); - MineTweakerAPI.apply(new AddLootAction(type, content)); - } - - @Override - public void removeChestLoot(String type, IIngredient pattern) { - MineTweakerAPI.apply(new RemoveLootAction(type, pattern)); - } - - @Override - public List getLoot(String type) { - ChestGenHooks recipe = LOOT.get(type); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - List results = new ArrayList(); - for (WeightedRandomChestContent content : contents) { - results.add(new LootEntry(new WeightedItemStack( - MineTweakerMC.getIItemStack(content.theItemId), - content.itemWeight), - content.theMinimumChanceToGenerateItem, - content.theMaximumChanceToGenerateItem)); - } - return results; - } - - @Override - public List getLootTypes() { - Set keys = LOOT.keySet(); - List keyList = new ArrayList(); - keyList.addAll(keys); - return keyList; - } - - // ###################### - // ### Action Classes ### - // ###################### - - /** - * Ported from ModTweaker. - * - * @author JoshieJack - */ - private static class AddLootAction implements IUndoableAction { - private final String chest; - private final WeightedRandomChestContent content; - - public AddLootAction(String chest, WeightedRandomChestContent content) { - this.chest = chest; - this.content = content; - } - - @Override - public void apply() { - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - contents.add(content); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - contents.remove(content); - } - - public String getRecipeInfo() { - return content.theItemId.getDisplayName(); - } - - @Override - public String describe() { - return "Adding chest loot " + content.theItemId.getDisplayName() + " to loot class " + chest; - } - - @Override - public String describeUndo() { - return "Removing chest loot " + content.theItemId.getDisplayName() + " from loot class " + chest; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - /** - * Ported from ModTweaker. - * - * @author JoshieJack - */ - private static class RemoveLootAction implements IUndoableAction { - private final String chest; - private final IIngredient pattern; - private final List removed; - - public RemoveLootAction(String chest, IIngredient pattern) { - this.chest = chest; - this.pattern = pattern; - removed = new ArrayList(); - } - - @Override - public void apply() { - removed.clear(); - - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - for (WeightedRandomChestContent r : contents) { - if (pattern.matches(MineTweakerMC.getIItemStack(r.theItemId))) { - removed.add(r); - } - } - - for (WeightedRandomChestContent r : removed) { - contents.remove(r); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - for (WeightedRandomChestContent entry : removed) { - contents.add(entry); - } - } - - @Override - public String describe() { - return "Removing chest loot " + pattern + " for loot type " + chest; - } - - @Override - public String describeUndo() { - return "Restoring chest loot " + pattern + " for loot type " + chest + " (" + removed.size() + " entries)"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCSeedRegistry.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCSeedRegistry.java deleted file mode 100644 index 3b7e513..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCSeedRegistry.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.vanilla; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.vanilla.ISeedRegistry; -import minetweaker.mc164.util.MineTweakerHacks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandom; -import net.minecraft.util.WeightedRandomItem; - -/** - * - * @author Stan - */ -public class MCSeedRegistry implements ISeedRegistry { - private static final List SEEDS = MineTweakerHacks.getSeeds(); - - @Override - public void addSeed(WeightedItemStack item) { - MineTweakerAPI.apply(new AddSeedAction(item)); - } - - @Override - public void removeSeed(IIngredient pattern) { - MineTweakerAPI.apply(new RemoveSeedAction(pattern)); - } - - @Override - public List getSeeds() { - List entries = (List) SEEDS; - - List results = new ArrayList(); - for (WeightedRandomItem entry : entries) { - results.add(new WeightedItemStack( - MineTweakerMC.getIItemStack(MineTweakerHacks.getSeedEntrySeed(entry)), - entry.itemWeight - )); - } - return results; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddSeedAction implements IUndoableAction { - private final IItemStack item; - private final WeightedRandomItem entry; - - public AddSeedAction(WeightedItemStack item) { - this.item = item.getStack(); - entry = MineTweakerHacks.constructSeedEntry(item); - } - - @Override - public void apply() { - SEEDS.add(entry); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - SEEDS.remove(entry); - } - - @Override - public String describe() { - return "Adding seed entry " + item; - } - - @Override - public String describeUndo() { - return "Removing seed entry " + item; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveSeedAction implements IUndoableAction { - private final IIngredient pattern; - private final List removed; - - public RemoveSeedAction(IIngredient ingredient) { - this.pattern = ingredient; - removed = new ArrayList(); - } - - @Override - public void apply() { - removed.clear(); - - for (Object entry : SEEDS) { - ItemStack itemStack = MineTweakerHacks.getSeedEntrySeed(entry); - if (pattern.matches(MineTweakerMC.getIItemStack(itemStack))) { - removed.add(entry); - } - } - - for (Object entry : removed) { - SEEDS.remove(entry); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (Object entry : removed) { - SEEDS.add(entry); - } - } - - @Override - public String describe() { - return "Removing seeds " + pattern; - } - - @Override - public String describeUndo() { - return "Restoring seeds " + pattern + " (" + removed.size() + " entries)"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCVanilla.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCVanilla.java deleted file mode 100644 index aff6d69..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/vanilla/MCVanilla.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.vanilla; - -import minetweaker.api.vanilla.ILootRegistry; -import minetweaker.api.vanilla.ISeedRegistry; -import minetweaker.api.vanilla.IVanilla; - -/** - * - * @author Stan - */ -public class MCVanilla implements IVanilla { - private final MCLootRegistry lootRegistry = new MCLootRegistry(); - private final MCSeedRegistry seedRegistry = new MCSeedRegistry(); - - @Override - public ILootRegistry getLoot() { - return lootRegistry; - } - - @Override - public ISeedRegistry getSeeds() { - return seedRegistry; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/world/MCBiome.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/world/MCBiome.java deleted file mode 100644 index 8a3c8d4..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/world/MCBiome.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.world; - -import minetweaker.api.world.IBiome; -import net.minecraft.world.biome.BiomeGenBase; - -/** - * - * @author Stan - */ -public class MCBiome implements IBiome { - private final BiomeGenBase biome; - - public MCBiome(BiomeGenBase biome) { - this.biome = biome; - } - - @Override - public String getName() { - return biome.biomeName; - } -} diff --git a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/world/MCDimension.java b/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/world/MCDimension.java deleted file mode 100644 index 2a2055b..0000000 --- a/MineTweaker3-MC164-Main/src/main/java/minetweaker/mc164/world/MCDimension.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc164.world; - -import minetweaker.api.block.IBlock; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.world.IDimension; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class MCDimension implements IDimension { - private final World world; - - public MCDimension(World world) { - this.world = world; - } - - @Override - public boolean isDay() { - return world.isDaytime(); - } - - @Override - public int getBrightness(int x, int y, int z) { - return world.getBlockLightValue(x, y, z); - } - - @Override - public IDimension getDimension() { - return this; - } - - @Override - public IBlock getBlock(int x, int y, int z) { - return MineTweakerMC.getBlock(world, x, y, z); - } -} diff --git a/MineTweaker3-MC164-Main/src/main/resources/assets/minetweaker/logo.png b/MineTweaker3-MC164-Main/src/main/resources/assets/minetweaker/logo.png deleted file mode 100644 index 674382e..0000000 Binary files a/MineTweaker3-MC164-Main/src/main/resources/assets/minetweaker/logo.png and /dev/null differ diff --git a/MineTweaker3-MC164-Main/src/main/resources/mcmod.info b/MineTweaker3-MC164-Main/src/main/resources/mcmod.info deleted file mode 100644 index b4de473..0000000 --- a/MineTweaker3-MC164-Main/src/main/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "MineTweaker3", - "name": "MineTweaker 3", - "version": "${version}", - "mcversion": "${mcversion}", - "description": "Customize your minecraft experience!", - "credits": "Created By Stan Hebben", - "logoFile": "assets/minetweaker/logo.png", - "url": "http://minetweaker3.powerofbytes.com", - "authorList": [ "Stan Hebben" ], - "parent": "", - "screenshots": [], - "dependencies": [] -} -] diff --git a/MineTweaker3-MC164-Mod-Buildcraft/build.gradle b/MineTweaker3-MC164-Mod-Buildcraft/build.gradle deleted file mode 100644 index 57baf32..0000000 --- a/MineTweaker3-MC164-Mod-Buildcraft/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion164 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC164-Main') - compile files('libs/buildcraft-A-1.6.4-4.2.1.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.buildcraft.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC164-Mod-Buildcraft/libs/buildcraft-A-1.6.4-4.2.1.jar b/MineTweaker3-MC164-Mod-Buildcraft/libs/buildcraft-A-1.6.4-4.2.1.jar deleted file mode 100644 index c31d77f..0000000 Binary files a/MineTweaker3-MC164-Mod-Buildcraft/libs/buildcraft-A-1.6.4-4.2.1.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/AssemblyTable.java b/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/AssemblyTable.java deleted file mode 100644 index 8ca3070..0000000 --- a/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/AssemblyTable.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.recipes.AssemblyRecipe; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.AssemblyTable") -@ModOnly("BuildCraft|Core") -public class AssemblyTable { - @ZenMethod - public static void addRecipe(IItemStack output, double energy, IIngredient[] ingredients) { - MineTweakerAPI.apply(new AddRecipeAction(output, energy, ingredients)); - } - - @ZenMethod - public static void remove(IIngredient output) { - removeRecipe(output, null, false); - } - - @ZenMethod - public static void removeRecipe(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard) { - List toRemove = new ArrayList(); - - outer: for (AssemblyRecipe recipe : AssemblyRecipe.assemblyRecipes) { - if (output.matches(MineTweakerMC.getIItemStack(recipe.output)) - && ingredientsMatch(recipe, ingredients, wildcard)) { - toRemove.add(recipe); - } - } - - for (AssemblyRecipe recipe : toRemove) { - MineTweakerAPI.apply(new RemoveRecipeAction(recipe)); - } - } - - /** - * Checks if ingredients from the recipe match with the given ingredients. - * - * @param recipe recipe to check - * @param ingredients required ingredients - * @param wildcard true if there can be more ingredients in the recipe than given, false otherwise - * @return matching result - */ - private static boolean ingredientsMatch(AssemblyRecipe recipe, IIngredient[] ingredients, boolean wildcard) { - if (ingredients == null) - return true; - - int matchedIngredients = 0; - boolean[] matched = new boolean[ingredients.length]; - checkIngredient: for (int i = 0; i < recipe.input.length; i++) { - Object ingredientObject = recipe.input[i]; - if (ingredientObject instanceof Number) - continue; - - IIngredient recipeIngredient = MineTweakerMC.getIIngredient(recipe.input[i]); - - for (int j = 0; j < ingredients.length; j++) { - if (!matched[j] && ingredients[j].contains(recipeIngredient)) { - matched[j] = true; - matchedIngredients++; - continue checkIngredient; - } - } - - if (!wildcard) - return false; - } - - return matchedIngredients == ingredients.length; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction implements IUndoableAction { - private final IItemStack output; - private final AssemblyRecipe recipe; - - public AddRecipeAction(IItemStack output, double energy, IIngredient[] ingredients) { - this.output = output; - - Object[] mcIngredients = new Object[ingredients.length]; - for (int i = 0; i < ingredients.length; i++) { - mcIngredients[i] = ingredients[i].getInternal(); - if (mcIngredients[i] == null) { - throw new IllegalArgumentException("Not a valid assembly table ingredient"); - } - } - - recipe = new AssemblyRecipe((int) energy, MineTweakerMC.getItemStack(output), mcIngredients); - } - - @Override - public void apply() { - AssemblyRecipe.assemblyRecipes.add(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - AssemblyRecipe.assemblyRecipes.remove(recipe); - } - - @Override - public String describe() { - return "Adding assembly table recipe for " + output; - } - - @Override - public String describeUndo() { - return "Removing assembly table recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveRecipeAction implements IUndoableAction { - private final AssemblyRecipe recipe; - - public RemoveRecipeAction(AssemblyRecipe recipe) { - this.recipe = recipe; - } - - @Override - public void apply() { - AssemblyRecipe.assemblyRecipes.remove(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - AssemblyRecipe.assemblyRecipes.add(recipe); - } - - @Override - public String describe() { - return "Removing assembly table recipe for " + MineTweakerMC.getIItemStack(recipe.output); - } - - @Override - public String describeUndo() { - return "Restoring assembly table recipe for " + MineTweakerMC.getIItemStack(recipe.output); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Fuels.java b/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Fuels.java deleted file mode 100644 index 994e14c..0000000 --- a/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Fuels.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.core.StackWrapper; -import buildcraft.api.fuels.IronEngineCoolant; -import buildcraft.api.fuels.IronEngineFuel; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.Fuels") -@ModOnly("BuildCraft|Core") -public class Fuels { - private static final Constructor CONSTRUCT_FUEL; - - static { - Constructor newFuel = null; - try { - newFuel = IronEngineFuel.Fuel.class.getDeclaredConstructor(Fluid.class, float.class, int.class); - newFuel.setAccessible(true); - } catch (NoSuchMethodException ex) { - MineTweakerAPI.logError("Could not load combustion engine fuel constructor", ex); - } catch (SecurityException ex) { - MineTweakerAPI.logError("Could not load combustion engine fuel constructor", ex); - } - - CONSTRUCT_FUEL = newFuel; - } - - @ZenMethod - public static void addCombustionEngineFuel(ILiquidStack fuel, double powerPerCycle, int totalBurningTime) { - MineTweakerAPI.apply(new AddFuelAction(fuel, powerPerCycle, totalBurningTime)); - } - - @ZenMethod - public static void removeCombustionEngineFuel(ILiquidStack fuel) { - Fluid fluid = MineTweakerMC.getLiquidStack(fuel).getFluid(); - if (IronEngineFuel.fuels.containsKey(fluid.getName())) { - MineTweakerAPI.apply(new RemoveFuelAction(fluid.getName(), IronEngineFuel.fuels.get(fluid.getName()))); - } else { - MineTweakerAPI.logWarning("No such iron engine fuel: " + fluid.getName()); - } - } - - @ZenMethod - public static void addCombustionEngineCoolant(ILiquidStack coolant, float coolingPerMB) { - MineTweakerAPI.apply(new AddLiquidCoolantAction(coolant.getName(), new MTCoolant(coolingPerMB))); - } - - @ZenMethod - public static void addCoolantItem(IItemStack coolantItem, ILiquidStack coolantLiquid) { - MineTweakerAPI.apply(new AddCoolantItemAction(new StackWrapper(MineTweakerMC.getItemStack(coolantItem)), MineTweakerMC.getLiquidStack(coolantLiquid))); - } - - @ZenMethod - public static void removeCombustionEngineCoolant(ILiquidStack coolant) { - FluidStack fluid = MineTweakerMC.getLiquidStack(coolant); - - if (IronEngineCoolant.isCoolant(fluid.getFluid())) { - MineTweakerAPI.apply(new RemoveLiquidCoolantAction(fluid.getFluid().getName(), IronEngineCoolant.getCoolant(fluid))); - } else { - MineTweakerAPI.logWarning("No such iron engine coolant: " + fluid.getFluid().getName()); - } - } - - @ZenMethod - public static void removeCoolantItem(IIngredient item) { - int numRemoved = 0; - for (IItemStack itemStack : item.getItems()) { - StackWrapper key = new StackWrapper(MineTweakerMC.getItemStack(itemStack)); - if (IronEngineCoolant.solidCoolants.containsKey(key)) { - MineTweakerAPI.apply(new RemoveCoolantItemAction(key, IronEngineCoolant.solidCoolants.get(key))); - numRemoved++; - } - } - - if (numRemoved == 0) { - MineTweakerAPI.logWarning("No such iron engine coolant: " + item); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddFuelAction implements IUndoableAction { - private final String fuelName; - private final IronEngineFuel.Fuel fuel; - - public AddFuelAction(ILiquidStack fuel, double powerPerCycle, int totalBurningTime) { - fuelName = fuel.getName(); - IronEngineFuel.Fuel ieFuel = null; - try { - if (CONSTRUCT_FUEL == null) - System.out.println("No constructor for fuel"); - - ieFuel = (IronEngineFuel.Fuel) CONSTRUCT_FUEL.newInstance(MineTweakerMC.getLiquidStack(fuel).getFluid(), (float) powerPerCycle, totalBurningTime); - } catch (InstantiationException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalArgumentException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } catch (InvocationTargetException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } - - this.fuel = ieFuel; - } - - @Override - public void apply() { - IronEngineFuel.fuels.put(fuelName, fuel); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineFuel.fuels.remove(fuelName); - } - - @Override - public String describe() { - return "Adding iron engine fuel " + fuelName; - } - - @Override - public String describeUndo() { - return "Removing iron engine fuel " + fuelName; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveFuelAction implements IUndoableAction { - private final String fuelName; - private final IronEngineFuel.Fuel fuel; - - public RemoveFuelAction(String fuelName, IronEngineFuel.Fuel fuel) { - this.fuelName = fuelName; - this.fuel = fuel; - } - - @Override - public void apply() { - IronEngineFuel.fuels.remove(fuelName); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineFuel.fuels.put(fuelName, fuel); - } - - @Override - public String describe() { - return "Removing iron engine fuel " + fuelName; - } - - @Override - public String describeUndo() { - return "Restoring iron engine fuel " + fuelName; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddLiquidCoolantAction implements IUndoableAction { - private final String liquid; - private final IronEngineCoolant.Coolant coolant; - - public AddLiquidCoolantAction(String liquid, IronEngineCoolant.Coolant coolant) { - this.liquid = liquid; - this.coolant = coolant; - } - - @Override - public void apply() { - IronEngineCoolant.liquidCoolants.put(liquid, coolant); - } - - @Override - public boolean canUndo() { - return false; - } - - @Override - public void undo() { - IronEngineCoolant.liquidCoolants.remove(liquid); - } - - @Override - public String describe() { - return "Adding iron engine coolant " + liquid; - } - - @Override - public String describeUndo() { - return "Removing iron engine coolant " + liquid; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddCoolantItemAction implements IUndoableAction { - private final StackWrapper item; - private final FluidStack liquid; - - public AddCoolantItemAction(StackWrapper item, FluidStack liquid) { - this.item = item; - this.liquid = liquid; - } - - @Override - public void apply() { - IronEngineCoolant.solidCoolants.put(item, liquid); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineCoolant.solidCoolants.remove(item); - } - - @Override - public String describe() { - return "Adding iron engine coolant item " + MineTweakerMC.getIItemStack(item.stack); - } - - @Override - public String describeUndo() { - return "Removing iron engine coolant item " + MineTweakerMC.getIItemStack(item.stack); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveLiquidCoolantAction implements IUndoableAction { - private final String liquid; - private final IronEngineCoolant.Coolant coolant; - - public RemoveLiquidCoolantAction(String liquid, IronEngineCoolant.Coolant coolant) { - this.liquid = liquid; - this.coolant = coolant; - } - - @Override - public void apply() { - IronEngineCoolant.liquidCoolants.remove(liquid); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineCoolant.liquidCoolants.put(liquid, coolant); - } - - @Override - public String describe() { - return "Removing iron engine coolant " + liquid; - } - - @Override - public String describeUndo() { - return "Restoring iron engine coolant " + liquid; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveCoolantItemAction implements IUndoableAction { - private final StackWrapper item; - private final FluidStack liquid; - - public RemoveCoolantItemAction(StackWrapper item, FluidStack liquid) { - this.item = item; - this.liquid = liquid; - } - - @Override - public void apply() { - IronEngineCoolant.solidCoolants.remove(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineCoolant.solidCoolants.put(item, liquid); - } - - @Override - public String describe() { - return "Removing iron engine coolant item " + item.stack.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring iron engine coolant item " + item.stack.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class MTCoolant implements IronEngineCoolant.Coolant { - private final float coolingPerMB; - - public MTCoolant(float coolingPerMB) { - this.coolingPerMB = coolingPerMB; - } - - @Override - public float getDegreesCoolingPerMB(float f) { - return coolingPerMB; - } - } -} diff --git a/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Refinery.java b/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Refinery.java deleted file mode 100644 index 3ed5ec6..0000000 --- a/MineTweaker3-MC164-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Refinery.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.recipes.RefineryRecipes; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import java.util.SortedSet; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.Refinery") -@ModOnly("BuildCraft|Core") -public class Refinery { - private static final Constructor CONSTRUCT_REFINERYRECIPE; - private static final Field REFINERYRECIPEMANAGER_RECIPES; - - static { - Constructor constructor = null; - try { - constructor = RefineryRecipes.Recipe.class.getDeclaredConstructor(FluidStack.class, FluidStack.class, FluidStack.class, int.class, int.class); - constructor.setAccessible(true); - } catch (NoSuchMethodException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (SecurityException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - Field recipes = null; - try { - recipes = RefineryRecipes.class.getDeclaredField("recipes"); - recipes.setAccessible(true); - } catch (NoSuchFieldException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (SecurityException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - CONSTRUCT_REFINERYRECIPE = constructor; - REFINERYRECIPEMANAGER_RECIPES = recipes; - } - - - @ZenMethod - public static void addRecipe(ILiquidStack output, int energyPerMB, int ticksPerMB, ILiquidStack input1, @Optional ILiquidStack input2) { - MineTweakerAPI.apply(new AddRecipeAction(output, energyPerMB, ticksPerMB, input1, input2)); - } - - @ZenMethod - public static void remove(ILiquidStack output) { - Fluid fluid = MineTweakerMC.getLiquidStack(output).getFluid(); - - List toRemove = new ArrayList(); - for (RefineryRecipes.Recipe recipe : RefineryRecipes.getRecipes()) { - if (recipe.result.getFluid() == fluid) { - toRemove.add(recipe); - } - } - - for (RefineryRecipes.Recipe recipe : toRemove) { - MineTweakerAPI.apply(new RemoveRecipeAction(recipe)); - } - } - - private static SortedSet getRecipes() { - try { - return (SortedSet) REFINERYRECIPEMANAGER_RECIPES.get(null); - } catch (IllegalArgumentException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - throw new RuntimeException("Refinery recipes unavailable"); - } - - // ###################### - // ### Action Classes ### - // ###################### - - private static class AddRecipeAction implements IUndoableAction { - private final ILiquidStack output; - private final RefineryRecipes.Recipe recipe; - - public AddRecipeAction(ILiquidStack output, int energyPerMB, int ticksPerMB, ILiquidStack input1, ILiquidStack input2) { - this.output = output; - - RefineryRecipes.Recipe rrecipe = null; - try { - rrecipe = (RefineryRecipes.Recipe) CONSTRUCT_REFINERYRECIPE.newInstance( - MineTweakerMC.getLiquidStack(input1), - MineTweakerMC.getLiquidStack(input2), - MineTweakerMC.getLiquidStack(output), - energyPerMB, - ticksPerMB); - } catch (InstantiationException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalArgumentException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (InvocationTargetException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - recipe = rrecipe; - } - - @Override - public void apply() { - getRecipes().add(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - getRecipes().add(recipe); - } - - @Override - public String describe() { - return "Adding refinery recipe for " + output; - } - - @Override - public String describeUndo() { - return "Removing refinery recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveRecipeAction implements IUndoableAction { - private final RefineryRecipes.Recipe recipe; - - public RemoveRecipeAction(RefineryRecipes.Recipe recipe) { - this.recipe = recipe; - } - - @Override - public void apply() { - getRecipes().remove(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - getRecipes().add(recipe); - } - - @Override - public String describe() { - return "Removing refinery recipe for " - + recipe.result.getFluid().getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Restoring refinery recipe for " - + recipe.result.getFluid().getLocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/build.gradle b/MineTweaker3-MC164-Mod-GregTech/build.gradle deleted file mode 100644 index efb063f..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion164 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC164-Main') - compile files('libs/gregtechmod408s.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.gregtech.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC164-Mod-GregTech/libs/gregtechapi408s.jar b/MineTweaker3-MC164-Mod-GregTech/libs/gregtechapi408s.jar deleted file mode 100644 index 4cdf4d0..0000000 Binary files a/MineTweaker3-MC164-Mod-GregTech/libs/gregtechapi408s.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-GregTech/libs/gregtechmod408s.jar b/MineTweaker3-MC164-Mod-GregTech/libs/gregtechmod408s.jar deleted file mode 100644 index 1955705..0000000 Binary files a/MineTweaker3-MC164-Mod-GregTech/libs/gregtechmod408s.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java deleted file mode 100644 index 592d4ae..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java +++ /dev/null @@ -1,111 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the Alloy Smelter recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.AlloySmelter") -@ModOnly("gregtech_addon") -public class AlloySmelter { - /** - * Adds an alloy smelter recipe. - * - * @param output alloy smelter output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks smelting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAlloySmelterRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding alloy smelter recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 53 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java deleted file mode 100644 index e6b4753..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java +++ /dev/null @@ -1,111 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the assembler recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Assembler") -@ModOnly("gregtech_addon") -public class Assembler { - /** - * Adds an assemble recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks assembling duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAssemblerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding assembler recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java deleted file mode 100644 index c36d794..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java +++ /dev/null @@ -1,145 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Blast Furnace recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.BlastFurnace") -@ModOnly("gregtech_addon") -public class BlastFurnace { - /** - * Adds a recipe with a single output. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - * @param heat required heat capacity - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, null, durationTicks, euPerTick, heat)); - } - - /** - * Adds a recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - * @param heat required heat capacity - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { - if (output.length == 0) { - MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output[0], output.length > 1 ? output[1] : null, durationTicks, euPerTick, heat)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack input1; - private final IItemStack input2; - private final IItemStack output1; - private final IItemStack output2; - private final int duration; - private final int euPerTick; - private final int heat; - - public AddRecipeAction(IItemStack input1, IItemStack input2, IItemStack output1, IItemStack output2, int duration, int euPerTick, int heat) { - this.input1 = input1; - this.input2 = input2; - this.output1 = output1; - this.output2 = output2; - this.duration = duration; - this.euPerTick = euPerTick; - this.heat = heat; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBlastRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick, - heat); - } - - @Override - public String describe() { - return "Adding blast furnace recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 89 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 89 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 89 * hash + this.duration; - hash = 89 * hash + this.euPerTick; - hash = 89 * hash + this.heat; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.heat != other.heat) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java deleted file mode 100644 index bdf32ef..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the CNC recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.CNC") -@ModOnly("gregtech_addon") -public class CNC { - /** - * Adds a CNC recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCNCRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding CNC recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java deleted file mode 100644 index add6029..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java +++ /dev/null @@ -1,136 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the Canner recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Canner") -@ModOnly("gregtech_addon") -public class Canner { - /** - * Adds a canner recipe with a single output. - * - * @param output crafting output - * @param input1 primary input - * @param input2 secondary input (optional - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, durationTicks, euPerTick)); - } - - /** - * Adds a canner recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - if (output.length == 0) { - MineTweakerAPI.logError("canner requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCannerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding canner recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 79 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java deleted file mode 100644 index 00bdd8c..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java +++ /dev/null @@ -1,126 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.gregtech.Centrifuge") -@ModOnly("gregtech_addon") -public class Centrifuge { - /** - * Adds a centrifuge recipe. - * - * @param outputs array with 1-4 outputs - * @param input recipe input - * @param cells number of cells required, can be 0 - * @param durationTicks centrifuging time, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks)); - } - } - - /** - * Adds a centrifuge recipe taking a fuel can as container. - * - * @param outputs array with 1-4 outputs - * @param input recipe input - * @param duration centrifuging time, in ticks - */ - @ZenMethod - public static void addRecipeFuelCan(IItemStack[] outputs, IItemStack input, int duration) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, -1, duration)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IItemStack input; - private final int cells; - private final int duration; - - public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCentrifugeRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - duration); - } - - @Override - public String describe() { - return "Adding centrifuge recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 59 * hash + Arrays.deepHashCode(this.output); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.cells; - hash = 59 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java deleted file mode 100644 index 584600a..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Chemical Reactor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ChemicalReactor") -@ModOnly("gregtech_addon") -public class ChemicalReactor { - /** - * Adds a Chemical Reactor recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks reaction time, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addChemicalRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding chemical reactor recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 11 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 11 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 11 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 11 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java deleted file mode 100644 index d831d8f..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ComputerCube.java +++ /dev/null @@ -1,86 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the computer cube descriptions. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ComputerCube") -@ModOnly("gregtech_addon") -public class ComputerCube { - /** - * Adds a description entry to the computer cube. - * - * @param items items to be displayed - * @param text text to be displayed - */ - @ZenMethod - public static void addDescriptionSet(IItemStack[] items, String[] text) { - MineTweakerAPI.apply(new AddDescriptionAction(items, text)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddDescriptionAction extends OneWayAction { - private final IItemStack[] items; - private final String[] text; - - public AddDescriptionAction(IItemStack[] items, String[] text) { - this.items = items; - this.text = text; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addComputercubeDescriptionSet(MineTweakerMC.getItemStacks(items), text); - } - - @Override - public String describe() { - return "Adding computer cube descriptions"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 11 * hash + Arrays.deepHashCode(this.items); - hash = 11 * hash + Arrays.deepHashCode(this.text); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddDescriptionAction other = (AddDescriptionAction) obj; - if (!Arrays.deepEquals(this.items, other.items)) { - return false; - } - if (!Arrays.deepEquals(this.text, other.text)) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java deleted file mode 100644 index 2c9f276..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java +++ /dev/null @@ -1,132 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the distillation tower recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.DistillationTower") -@ModOnly("gregtech_addon") -public class DistillationTower { - /** - * Adds a distillation tower recipe with a single output. - * - * @param output recipe output - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks distillation time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int cells, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input, cells, durationTicks, euPerTick)); - } - - /** - * Adds a distillation tower recipe with multiple outputs. - * - * @param outputs array with 1-4 outputs - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks distillation time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("Distillation tower recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] outputs; - private final IItemStack input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] outputs, IItemStack input, int cells, int duration, int euPerTick) { - this.outputs = outputs; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addDistillationRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null, - duration, euPerTick); - } - - @Override - public String describe() { - return "Adding Distillation tower recipe for " + outputs[0]; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 41 * hash + Arrays.deepHashCode(this.outputs); - hash = 41 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 41 * hash + this.cells; - hash = 41 * hash + this.duration; - hash = 41 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.outputs, other.outputs)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java deleted file mode 100644 index 06809ae..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java +++ /dev/null @@ -1,119 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Electrolyzer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Electrolyzer") -@ModOnly("gregtech_addon") -public class Electrolyzer { - /** - * Adds an electrolyzer recipe. - * - * @param outputs array with 1-4 outputs - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks electrolyzing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { - if (outputs.length < 1) { - MineTweakerAPI.logError("Electrolyzer recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IItemStack input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addElectrolyzerRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - duration, - cells); - } - - @Override - public String describe() { - return "Adding electrolyzer recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + Arrays.deepHashCode(this.output); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.cells; - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java deleted file mode 100644 index 9efd74a..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java +++ /dev/null @@ -1,111 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the extruder recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Extruder") -@ModOnly("gregtech_addon") -public class Extruder { - /** - * Adds an extruder recipe. - * - * @param output recipe output - * @param input recipe input - * @param shape shape (set stack size to 0 to prevent the shape from being consumed) - * @param durationTicks extruding time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final IItemStack shape; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, IItemStack shape, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.shape = shape; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addExtruderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(shape), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding extruder recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + (this.shape != null ? this.shape.hashCode() : 0); - hash = 67 * hash + this.duration; - hash = 67 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.shape != other.shape && (this.shape == null || !this.shape.equals(other.shape))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java deleted file mode 100644 index 059f2b4..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Forge Hammer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ForgeHammer") -@ModOnly("gregtech_addon") -public class ForgeHammer { - /** - * Add a Forge Hammer recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks forging duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addForgeHammerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding forge hammer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java deleted file mode 100644 index 129f403..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java +++ /dev/null @@ -1,177 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the fuels used by the various generators. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Fuels") -@ModOnly("gregtech_addon") -public class Fuels { - /** - * Adds a Diesel Engine fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addDieselFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 0)); - } - - /** - * Adds a Gas Turbine fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addGasTurbineFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 1)); - } - - /** - * Adds a Thermal Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addThermalGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 2)); - } - - /** - * Adds a Dense Fluid Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addDenseFluidFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 3)); - } - - /** - * Adds a Plasma Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addPlasmaGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 4)); - } - - /** - * Adds a Magic Generator fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addMagicGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 5)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private static final String[] GENERATORS = { - "diesel", - "gas turbine", - "thermal", - "dense fluid", - "plasma", - "magic" - }; - - private final IItemStack output; - private final IItemStack input; - private final int euPerMillibucket; - private final int type; - - public AddRecipeAction(IItemStack output, IItemStack input, int euPerMillibucket, int type) { - this.output = output; - this.input = input; - this.euPerMillibucket = euPerMillibucket; - this.type = type; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addFuel( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - euPerMillibucket, - type); - } - - @Override - public String describe() { - return "Adding " + GENERATORS[type] + " fuel " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.euPerMillibucket; - hash = 59 * hash + this.type; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.euPerMillibucket != other.euPerMillibucket) { - return false; - } - if (this.type != other.type) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java deleted file mode 100644 index e3c33b5..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java +++ /dev/null @@ -1,125 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the fusion reactor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.FusionReactor") -@ModOnly("gregtech_addon") -public class FusionReactor { - /** - * Adds a Fusion Reactor recipe. - * - * @param output reactor output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks fusion duration, in ticks - * @param energyPerTick eu consumption per tick - * @param startEnergy starting energy - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int energyPerTick, int startEnergy) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, energyPerTick, startEnergy)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int durationTicks; - private final int energyPerTick; - private final int startEnergy; - - public AddRecipeAction( - IItemStack output, - IItemStack input1, - IItemStack input2, - int durationTicks, - int energyPerTick, - int startEnergy) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.durationTicks = durationTicks; - this.energyPerTick = energyPerTick; - this.startEnergy = startEnergy; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addFusionReactorRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - durationTicks, - energyPerTick, - startEnergy); - } - - @Override - public String describe() { - return "Adding fusion reactor recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 97 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 97 * hash + this.durationTicks; - hash = 97 * hash + this.energyPerTick; - hash = 97 * hash + this.startEnergy; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.durationTicks != other.durationTicks) { - return false; - } - if (this.energyPerTick != other.energyPerTick) { - return false; - } - if (this.startEnergy != other.startEnergy) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java deleted file mode 100644 index 358f23f..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java +++ /dev/null @@ -1,115 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import gregtechmod.api.util.GT_ModHandler; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Grinder recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Grinder") -@ModOnly("gregtech_addon") -public class Grinder { - /** - * Adds a recipe with a single output. - * - * @param output grinder output - * @param input1 grinder primary input - * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input1, input2)); - } - - /** - * Adds a recipe with multiple outputs. - * - * @param outputs array with 1-4 outputs - * @param input1 grinder primary input - * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(outputs, input1, input2)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] outputs; - private final IItemStack input1; - private final IItemStack input2; - - private AddRecipeAction(IItemStack[] outputs, IItemStack input1, IItemStack input2) { - this.outputs = outputs; - this.input1 = input1; - this.input2 = input2; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addGrinderRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null); - } - - @Override - public String describe() { - return "Adding grinder recipe for " + outputs[0]; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 89 * hash + Arrays.deepHashCode(this.outputs); - hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.outputs, other.outputs)) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java deleted file mode 100644 index 0cfc199..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java +++ /dev/null @@ -1,118 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Implosion Compressor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ImplosionCompressor") -@ModOnly("gregtech_addon") -public class ImplosionCompressor { - /** - * Adds an implosion compressor recipe with a single output. - * - * @param output recipe output - * @param input primary input - * @param tnt amount of TNT needed - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int tnt) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt)); - } - - /** - * Adds an implosion compressor recipe with one or two outputs. - * - * @param output array with 1-2 outputs - * @param input primary input - * @param tnt amount of TNT needed - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input, int tnt) { - if (output.length == 0) { - MineTweakerAPI.logError("Implosion compressor recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input, tnt)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input1; - private final int tnt; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, int tnt) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.tnt = tnt; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addImplosionRecipe( - MineTweakerMC.getItemStack(input1), - tnt, - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2)); - } - - @Override - public String describe() { - return "Adding Implosion compressor recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 97 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 97 * hash + this.tnt; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.tnt != other.tnt) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java deleted file mode 100644 index 78e4dc0..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/JackHammer.java +++ /dev/null @@ -1,116 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point to jack hammer whitelist. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.JackHammer") -@ModOnly("gregtech_addon") -public class JackHammer { - /** - * Adds a block to be minable. The given item must be a block. - * - * @param item block - */ - @ZenMethod - public static void addMinableBlock(IItemStack item) { - Block block = getBlock(item); - if (block == null) { - MineTweakerAPI.logError("Not a block: " + item); - } else { - MineTweakerAPI.apply(new AddBlockAction(block, false)); - } - } - - /** - * Adds a block to be minable, but only with the diamond tools. The given - * item must be a block. - * - * @param item block - */ - @ZenMethod - public static void addDiamondMinableBlock(IItemStack item) { - Block block = getBlock(item); - if (block == null) { - MineTweakerAPI.logError("Not a block: " + item); - } else { - MineTweakerAPI.apply(new AddBlockAction(block, true)); - } - } - - // ####################### - // ### Private Methods ### - // ####################### - - private static Block getBlock(IItemStack item) { - ItemStack itemStack = MineTweakerMC.getItemStack(item); - return itemStack.itemID > Block.blocksList.length ? null : Block.blocksList[itemStack.itemID]; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddBlockAction extends OneWayAction { - private final Block block; - private final boolean diamondOnly; - - public AddBlockAction(Block block, boolean diamondOnly) { - this.block = block; - this.diamondOnly = diamondOnly; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addJackHammerMinableBlock(block, diamondOnly); - } - - @Override - public String describe() { - return "Adding jackhammer mineable block " + block; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 83 * hash + (this.block != null ? this.block.hashCode() : 0); - hash = 83 * hash + (this.diamondOnly ? 1 : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBlockAction other = (AddBlockAction) obj; - if (this.block != other.block) { - return false; - } - if (this.diamondOnly != other.diamondOnly) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java deleted file mode 100644 index 81d1257..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java +++ /dev/null @@ -1,132 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point for Lathe recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Lathe") -@ModOnly("gregtech_addon") -public class Lathe { - /** - * Adds a lathe recipe with a single output. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, durationTicks, euPerTick)); - } - - /** - * Adds a lathe recipe with 1 or 2 outputs. - * - * @param outputs array with 1-2 outputs - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - input, - durationTicks, - euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addLatheRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding lathe recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 53 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java deleted file mode 100644 index 883684d..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point to Plate Bender recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.PlateBender") -@ModOnly("gregtech_addon") -public class PlateBender { - /** - * Adds a plate bender recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks bending time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBenderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate bender recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java deleted file mode 100644 index 6a87eff..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Plate Cutter recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.PlateCutter") -@ModOnly("gregtech_addon") -public class PlateCutter { - /** - * Adds a plate cutter recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks cutting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCutterRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate cutter recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 17 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 17 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 17 * hash + this.duration; - hash = 17 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java deleted file mode 100644 index 29cd620..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java +++ /dev/null @@ -1,130 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import gregtechmod.api.util.GT_ModHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Sawmill recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Sawmill") -@ModOnly("gregtech_addon") -public class Sawmill { - /** - * Adds a new sawmill recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, if set to null will use a water cell) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(output, null, null, input1, input2)); - } - - /** - * Adds a new sawmill recipe with 1-3 outputs. - * - * @param outputs array with 1-3 outputs - * @param input1 primary input - * @param input2 secondary input (optional, if set to null will use a water cell) - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - outputs.length > 2 ? outputs[2] : null, - input1, - input2)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack output3; - private final IItemStack input1; - private final IItemStack input2; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack input1, IItemStack input2) { - this.output1 = output1; - this.output2 = output2; - this.output3 = output3; - this.input1 = input1; - this.input2 = input2; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addSawmillRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - MineTweakerMC.getItemStack(output3)); - } - - @Override - public String describe() { - return "Adding Sawmill recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 23 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 23 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 23 * hash + (this.output3 != null ? this.output3.hashCode() : 0); - hash = 23 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 23 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.output3 != other.output3 && (this.output3 == null || !this.output3.equals(other.output3))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java deleted file mode 100644 index 17d9d5b..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java +++ /dev/null @@ -1,87 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the sonictron. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Sonictron") -@ModOnly("gregtech_addon") -public class Sonictron { - /** - * Adds a sonictron sound. - * - * @param itemStack item you want to display for this sound - * @param soundName name of the Sound in the resources/newsound-folder like Vanillasounds - */ - @ZenMethod - public static void addSound(IItemStack itemStack, String soundName) { - MineTweakerAPI.apply(new AddSoundAction(itemStack, soundName)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddSoundAction extends OneWayAction { - private final IItemStack itemStack; - private final String soundName; - - public AddSoundAction(IItemStack itemStack, String soundName) { - this.itemStack = itemStack; - this.soundName = soundName; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addSonictronSound( - MineTweakerMC.getItemStack(itemStack), - soundName); - } - - @Override - public String describe() { - return "Adding sonictron sound " + soundName; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.itemStack != null ? this.itemStack.hashCode() : 0); - hash = 79 * hash + (this.soundName != null ? this.soundName.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddSoundAction other = (AddSoundAction) obj; - if (this.itemStack != other.itemStack && (this.itemStack == null || !this.itemStack.equals(other.itemStack))) { - return false; - } - if ((this.soundName == null) ? (other.soundName != null) : !this.soundName.equals(other.soundName)) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java deleted file mode 100644 index ab61a7e..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java +++ /dev/null @@ -1,95 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Vacuum Freezer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.VacuumFreezer") -@ModOnly("gregtech_addon") -public class VacuumFreezer { - /** - * Adds a vacuum freezer recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks freezing duration, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration) { - this.output = output; - this.input = input; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addVacuumFreezerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding vacuum freezer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java b/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java deleted file mode 100644 index b5e6834..0000000 --- a/MineTweaker3-MC164-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtechmod.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Wiremill recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Wiremill") -@ModOnly("gregtech_addon") -public class Wiremill { - /** - * Adds a Wiremill recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks processing time - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addWiremillRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding wiremill recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 37 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 37 * hash + this.duration; - hash = 37 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/build.gradle b/MineTweaker3-MC164-Mod-IC2/build.gradle deleted file mode 100644 index b632165..0000000 --- a/MineTweaker3-MC164-Mod-IC2/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft{ - version = forgeVersion164 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC164-Main') - compile files('libs/industrialcraft-2_2.0.383-experimental.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.ic2.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC164-Mod-IC2/libs/industrialcraft-2_2.0.383-experimental.jar b/MineTweaker3-MC164-Mod-IC2/libs/industrialcraft-2_2.0.383-experimental.jar deleted file mode 100644 index ed20267..0000000 Binary files a/MineTweaker3-MC164-Mod-IC2/libs/industrialcraft-2_2.0.383-experimental.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2BracketHandler.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2BracketHandler.java deleted file mode 100644 index 70d63a7..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2BracketHandler.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.ic2; - -import ic2.api.item.Items; -import java.util.List; -import minetweaker.IBracketHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.BracketHandler; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.ZenTokener; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionInt; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.ZenType; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * Makes a ic2-item specific item syntax available in the form <item-ic2:name[:meta]>. - * - * @author Stan Hebben - */ -@BracketHandler -@ModOnly("IC2") -public class IC2BracketHandler implements IBracketHandler { - public static IItemStack getItem(String name, int meta) { - ItemStack stack = Items.getItem(name); - stack.setItemDamage(meta); - return getIItemStack(stack); - } - - private final IJavaMethod method; - - public IC2BracketHandler() { - method = MineTweakerAPI.getJavaMethod(IC2BracketHandler.class, "getItem", String.class, int.class); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - if (tokens.size() >= 5) { - if (tokens.get(0).getValue().equals("ic2") - && tokens.get(1).getValue().equals("-") - && tokens.get(2).getValue().equals("item") - && tokens.get(3).getValue().equals(":")) { - String name = tokens.get(4).getValue(); - int meta = 0; - if (tokens.size() > 6 && tokens.get(5).getValue().equals(":")) { - if (tokens.get(6).getType() == ZenTokener.T_INTVALUE) { - meta = Integer.parseInt(tokens.get(6).getValue()); - } else if (tokens.get(6).getValue().equals("*")) { - meta = OreDictionary.WILDCARD_VALUE; - } else { - MineTweakerAPI.logError("Not a valid meta value: " + tokens.get(6).getValue()); - } - } - ItemStack item = Items.getItem(name); - if (item == null) { - MineTweakerAPI.logError("Not a valid IC2 item: " + name); - return null; - } else { - return new ItemReferenceSymbol(environment, name, meta); - } - } else { - return null; - } - } else { - return null; - } - } - - // ############################# - // ### Private inner classes ### - // ############################# - - private class ItemReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - private final int meta; - - public ItemReferenceSymbol(IEnvironmentGlobal environment, String name, int meta) { - this.environment = environment; - this.name = name; - this.meta = meta; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name), - new ExpressionInt(position, meta, ZenType.INT)); - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2ExplosionWhitelist.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2ExplosionWhitelist.java deleted file mode 100644 index 8083b9f..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2ExplosionWhitelist.java +++ /dev/null @@ -1,167 +0,0 @@ -package minetweaker.mods.ic2; - -import ic2.api.tile.ExplosionWhitelist; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Manages the explosion whitelist in IC2. Blocks on this whitelist will not resist - * an explosion but won't be destroyed. - * - * The explosion code by default ignores blocks which absorb more than 1000 explosion power to - * prevent abusing personal safes, Trade-O-Mats and other blocks to serve as a cheap and - * invulnerable reactor chambers. Said blocks will not shield the explosion and won't get - * destroyed. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.ExplosionWhitelist") -@ModOnly("IC2") -public class IC2ExplosionWhitelist { - /** - * Adds a block to the explosion whitelist. - * - * @param item item to add - */ - @ZenMethod - public static void add(IItemStack item) { - ItemStack iStack = getItemStack(item); - Block block = getBlock(iStack.getItem()); - if (block == null) { - MineTweakerAPI.logError("This item is not a block"); - } else { - MineTweakerAPI.apply(new AddAction(block)); - } - } - - /** - * Removes a block from the explosion whitelist. - * - * @param item item to remove - */ - @ZenMethod - public static void remove(IItemStack item) { - ItemStack iStack = getItemStack(item); - Block block = getBlock(iStack.getItem()); - if (block == null) { - MineTweakerAPI.logError("This item is not a block"); - } else { - if (ExplosionWhitelist.isBlockWhitelisted(block)) { - MineTweakerAPI.logWarning("This block is not in the whitelist"); - } else { - MineTweakerAPI.apply(new RemoveAction(block)); - } - } - } - - /** - * Checks if the given item is already whitelisted. - * - * @param item item to check - * @return true if whitelisted - */ - @ZenMethod - public static boolean isWhitelisted(IItemStack item) { - ItemStack iStack = getItemStack(item); - Block block = getBlock(iStack.getItem()); - if (block == null) { - MineTweakerAPI.logWarning("This item is not a block"); - return false; - } else { - return ExplosionWhitelist.isBlockWhitelisted(block); - } - } - - private static Block getBlock(Item item) { - if (item.itemID >= Block.blocksList.length) return null; - return Block.blocksList[item.itemID]; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddAction implements IUndoableAction { - private final Block block; - - public AddAction(Block block) { - this.block = block; - } - - @Override - public void apply() { - ExplosionWhitelist.addWhitelistedBlock(block); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ExplosionWhitelist.removeWhitelistedBlock(block); - } - - @Override - public String describe() { - return "Adding block to IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Removing block from IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveAction implements IUndoableAction { - private final Block block; - - public RemoveAction(Block block) { - this.block = block; - } - - @Override - public void apply() { - ExplosionWhitelist.removeWhitelistedBlock(block); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ExplosionWhitelist.addWhitelistedBlock(block); - } - - @Override - public String describe() { - return "Removing block from IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Adding block to IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2RecipeInput.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2RecipeInput.java deleted file mode 100644 index 315d0d6..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2RecipeInput.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2; - -import ic2.api.recipe.IRecipeInput; -import java.util.ArrayList; -import java.util.List; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import net.minecraft.item.ItemStack; - -/** - * Wrapper class for ITweakerItemStackPatterns to IC2 recipe inputs. - * - * @author Stan Hebben - */ -public class IC2RecipeInput implements IRecipeInput { - private final IIngredient ingredient; - - public IC2RecipeInput(IIngredient ingredient) { - this.ingredient = ingredient; - } - - @Override - public boolean matches(ItemStack subject) { - return ingredient.matches(getIItemStack(subject)); - } - - @Override - public int getAmount() { - return ingredient.getAmount(); - } - - @Override - public List getInputs() { - List items = new ArrayList(); - for (IItemStack item : ingredient.getItems()) { - items.add(getItemStack(item)); - } - return items; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.ingredient != null ? this.ingredient.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final IC2RecipeInput other = (IC2RecipeInput) obj; - if (this.ingredient != other.ingredient && (this.ingredient == null || !this.ingredient.equals(other.ingredient))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/MachineAddRecipeAction.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/MachineAddRecipeAction.java deleted file mode 100644 index 4866974..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/MachineAddRecipeAction.java +++ /dev/null @@ -1,100 +0,0 @@ -package minetweaker.mods.ic2; - -import ic2.api.recipe.IMachineRecipeManager; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * - * @author Stan Hebben - */ -public class MachineAddRecipeAction extends OneWayAction { - private final String name; - private final IMachineRecipeManager machine; - private final ItemStack[] output; - private final IC2RecipeInput input; - private final NBTTagCompound tag; - - public MachineAddRecipeAction(String name, IMachineRecipeManager machine, ItemStack[] output, NBTTagCompound tag, IC2RecipeInput input) { - this.name = name; - this.machine = machine; - this.output = output; - this.input = input; - this.tag = tag; - } - - @Override - public void apply() { - try { - machine.addRecipe(input, tag, output); - } catch (RuntimeException ex) { - MineTweakerAPI.logError(ex.getMessage()); - } - } - - @Override - public String describe() { - if (output.length == 1) { - return "Adding " + name + " recipe for " + output[0].getDisplayName(); - } else { - StringBuilder result = new StringBuilder(); - result.append("Adding ").append(name).append(" recipe for "); - result.append("["); - for (int i = 0; i < output.length; i++) { - if (i == 0) { - result.append(", "); - } else { - result.append(output[i].getDisplayName()); - } - } - result.append("]"); - return result.toString(); - } - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0); - hash = 47 * hash + (this.machine != null ? this.machine.hashCode() : 0); - hash = 47 * hash + Arrays.deepHashCode(this.output); - hash = 47 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 47 * hash + (this.tag != null ? this.tag.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MachineAddRecipeAction other = (MachineAddRecipeAction) obj; - if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { - return false; - } - if (this.machine != other.machine && (this.machine == null || !this.machine.equals(other.machine))) { - return false; - } - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.tag != other.tag && (this.tag == null || !this.tag.equals(other.tag))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/IngredientExpansion.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/IngredientExpansion.java deleted file mode 100644 index 864766a..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/IngredientExpansion.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.expand; - -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.player.IPlayer; -import stanhebben.zenscript.annotations.ZenExpansion; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenExpansion("minetweaker.item.IIngredient") -@ModOnly("IC2") -public class IngredientExpansion { - @ZenMethod - public static IIngredient onlyIC2ChargeAtLeast(IIngredient ingredient, final int charge) { - return ingredient.only(new IItemCondition() { - @Override - public boolean matches(IItemStack stack) { - return ItemExpansion.getIC2Charge(stack) >= charge; - } - }); - } - - @ZenMethod - public static IIngredient onlyIC2ChargeAtMost(IIngredient ingredient, final int charge) { - return ingredient.only(new IItemCondition() { - @Override - public boolean matches(IItemStack stack) { - return ItemExpansion.getIC2Charge(stack) <= charge; - } - }); - } - - @ZenMethod - public static IIngredient transformIC2Discharge(IIngredient ingredient, final int amount) { - return ingredient.transform(new IItemTransformer() { - @Override - public IItemStack transform(IItemStack item, IPlayer byPlayer) { - return ItemExpansion.ic2Discharge(item, amount, 0).withAmount(item.getAmount() + 1); - } - }); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/ItemExpansion.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/ItemExpansion.java deleted file mode 100644 index aff2140..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/ItemExpansion.java +++ /dev/null @@ -1,142 +0,0 @@ -package minetweaker.mods.ic2.expand; - -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import minetweaker.api.item.IItemStack; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenExpansion; -import stanhebben.zenscript.annotations.ZenGetter; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenExpansion("minecraft.item.IItemStack") -@ModOnly("IC2") -public class ItemExpansion { - /** - * Gets the charge level of this item. - * - * @param stack target - * @return charge level - */ - @ZenGetter("ic2getCharge") - public static int getIC2Charge(IItemStack stack) { - return ElectricItem.manager.getCharge(getItemStack(stack)); - } - - /** - * Gets the tier level of this item. - * - * @param stack target - * @return tier level - */ - @ZenGetter("ic2tier") - public static int getIC2Tier(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - return ((IElectricItem) iStack.getItem()).getTier(iStack); - } else { - return 0; - } - } - - /** - * Gets the transfer limit of the specified stack. - * - * @param stack target - * @return - */ - @ZenGetter("ic2transferLimit") - public static int getIC2TransferLimit(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - return ((IElectricItem) iStack.getItem()).getTransferLimit(iStack); - } else { - return 0; - } - } - - /** - * Gets the fully charged IC2 item. - * - * @param stack target - * @return charged item - */ - @ZenGetter("ic2charged") - public static IItemStack getIC2Charged(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - IElectricItem eItem = (IElectricItem) iStack.getItem(); - Item item = Item.itemsList[eItem.getChargedItemId(iStack)]; - ItemStack stack2 = new ItemStack(item, 1, 0); - ElectricItem.manager.charge(stack2, eItem.getMaxCharge(stack2), eItem.getTier(stack2), true, false); - return getIItemStack(stack2); - } else { - return null; - } - } - - /** - * Gets the fully discharged IC2 item. - * - * @param stack target - * @return discharged item - */ - @ZenGetter("ic2discharged") - public static IItemStack getIC2Discharged(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - IElectricItem eItem = (IElectricItem) iStack.getItem(); - Item item = Item.itemsList[eItem.getEmptyItemId(iStack)]; - return getItemStack(item, 1, 0); - } else { - return null; - } - } - - /** - * Charges the item with the specified amount and returns the charged item. - * - * @param stack target - * @param amount charge amount - * @param tier charge tier - * @return charged item - */ - @ZenMethod("ic2charge") - public static IItemStack ic2Charge(IItemStack stack, int amount, @Optional int tier) { - if (tier == 0) { - tier = getIC2Tier(stack); - } - - ItemStack iStack = getItemStack(stack).copy(); - ElectricItem.manager.charge(iStack, amount, tier, true, false); - return getIItemStack(iStack); - } - - /** - * Discharges the item with the specified amount and returns the discharged item. - * - * @param stack target - * @param amount discharge amount - * @param tier charge tier - * @return discharged item - */ - @ZenMethod("ic2discharge") - public static IItemStack ic2Discharge(IItemStack stack, int amount, @Optional int tier) { - if (tier == 0) { - tier = getIC2Tier(stack); - } - - ItemStack iStack = getItemStack(stack).copy(); - ElectricItem.manager.discharge(iStack, amount, tier, true, false); - return getIItemStack(iStack); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Canner.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Canner.java deleted file mode 100644 index e1a5c5f..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Canner.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.mods.ic2.IC2RecipeInput; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.Canner") -@ModOnly("IC2") -public class Canner { - @ZenMethod - public static void addBottleRecipe(IItemStack output, IIngredient container, IIngredient fill) { - MineTweakerAPI.apply(new AddBottleIngredientAction(container, fill, output)); - } - - @ZenMethod - public static void addBottleRecipe(IItemStack output, IIngredient container, ILiquidStack liquid) { - MineTweakerAPI.logWarning("Cannot use liquid inputs in 1.6.4"); - } - - @ZenMethod - public static void addEnrichRecipe(ILiquidStack output, ILiquidStack input, IIngredient additive) { - MineTweakerAPI.apply(new AddEnrichIngredientAction(input, additive, output)); - } - - @ZenMethod - public static void addEnrichRecipe(ILiquidStack output, ILiquidStack input, ILiquidStack additive) { - MineTweakerAPI.logWarning("Cannot use liquid inputs in 1.6.4"); - } - - private static class AddBottleIngredientAction extends OneWayAction { - private final IIngredient container; - private final IIngredient fill; - private final IItemStack output; - - public AddBottleIngredientAction(IIngredient container, IIngredient fill, IItemStack output) { - this.container = container; - this.fill = fill; - this.output = output; - } - - @Override - public void apply() { - Recipes.cannerBottle.addRecipe( - new IC2RecipeInput(container), - new IC2RecipeInput(fill), - getItemStack(output)); - } - - @Override - public String describe() { - return "Adding canner bottle recipe " + container + " + " + fill + " => " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 67 * hash + (this.container != null ? this.container.hashCode() : 0); - hash = 67 * hash + (this.fill != null ? this.fill.hashCode() : 0); - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBottleIngredientAction other = (AddBottleIngredientAction) obj; - if (this.container != other.container && (this.container == null || !this.container.equals(other.container))) { - return false; - } - if (this.fill != other.fill && (this.fill == null || !this.fill.equals(other.fill))) { - return false; - } - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - return true; - } - } - - private static class AddEnrichIngredientAction extends OneWayAction { - private final ILiquidStack input; - private final IIngredient additive; - private final ILiquidStack output; - - public AddEnrichIngredientAction(ILiquidStack input, IIngredient additive, ILiquidStack output) { - this.input = input; - this.additive = additive; - this.output = output; - } - - @Override - public void apply() { - Recipes.cannerEnrich.addRecipe((FluidStack) input.getInternal(), new IC2RecipeInput(additive), (FluidStack) output.getInternal()); - } - - @Override - public String describe() { - return "Adding canner enrich recipe " + input + " + " + additive + " => " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 47 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 47 * hash + (this.additive != null ? this.additive.hashCode() : 0); - hash = 47 * hash + (this.output != null ? this.output.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddEnrichIngredientAction other = (AddEnrichIngredientAction) obj; - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.additive != other.additive && (this.additive == null || !this.additive.equals(other.additive))) { - return false; - } - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java deleted file mode 100644 index 24bd1a6..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java +++ /dev/null @@ -1,69 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 compressor recipes. Recipes can be added but not - * removed, due to IC2 API restrictions. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.Compressor") -@ModOnly("IC2") -public class Compressor { - /** - * Adds a new recipe to the compressor. - * - * The recipe input can be any pattern, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - */ - @ZenMethod - public static void addRecipe( - @NotNull IItemStack output, - @NotNull IIngredient ingredient) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "compressor", - Recipes.compressor, - getItemStacks(output), - null, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack getOutput( - @NotNull IItemStack input) { - RecipeOutput output = Recipes.compressor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) { - System.out.println("No output"); - return null; - } - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java deleted file mode 100644 index f83590a..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 Extractor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.Extractor") -@ModOnly("IC2") -public class Extractor { - /** - * Adds a new recipe to the extractor. - * - * The recipe input can be any pattern, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - */ - @ZenMethod - public static void addRecipe( - @NotNull IItemStack output, - @NotNull IIngredient ingredient) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "extractor", - Recipes.extractor, - getItemStacks(output), - null, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack getOutput( - @NotNull IItemStack input) { - RecipeOutput output = Recipes.extractor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java deleted file mode 100644 index d985d16..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 macerator recipes. Recipes can be added but not - * removed, due to IC2 API restrictions. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.Macerator") -@ModOnly("IC2") -public class Macerator { - /** - * Adds a new recipe to the macerator. - * - * The recipe input can be any pattern, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - */ - @ZenMethod - public static void addRecipe( - @NotNull IItemStack output, - @NotNull IIngredient ingredient) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "macerator", - Recipes.macerator, - getItemStacks(output), - null, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack getOutput( - @NotNull IItemStack input) { - RecipeOutput output = Recipes.macerator.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MatterAmplifier.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MatterAmplifier.java deleted file mode 100644 index 1a63967..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MatterAmplifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.MatterAmplifier") -@ModOnly("IC2") -public class MatterAmplifier { - private MatterAmplifier() {} - - @ZenMethod - public static void setAmplifier(IIngredient item, int amplifier) { - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("amplification", amplifier); - MineTweakerAPI.apply(new MachineAddRecipeAction("matter amplifier", Recipes.matterAmplifier, new ItemStack[0], data, new IC2RecipeInput(item))); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java deleted file mode 100644 index 774f081..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.MetalFormer") -@ModOnly("IC2") -public class MetalFormer { - /** - * Adds an extruding recipe to the metal former. - * - * @param output output item - * @param input input item - */ - @ZenMethod - public static void addExtrudingRecipe(IItemStack output, IIngredient input) { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "metal former - extruding", - Recipes.metalformerExtruding, - getItemStacks(output), - null, - new IC2RecipeInput(input))); - } - - /** - * Gets the extruding output for the given input. - * - * @param input input item - * @return output item, or null - */ - @ZenMethod - public static IItemStack getExtrudingOutput(IItemStack input) { - RecipeOutput output = Recipes.metalformerExtruding.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } - - /** - * Adds a rolling recipe to the metal former. - * - * @param output output item - * @param input input item - */ - @ZenMethod - public static void addRollingRecipe(IItemStack output, IIngredient input) { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "metal former - rolling", - Recipes.metalformerRolling, - getItemStacks(output), - null, - new IC2RecipeInput(input))); - } - - /** - * Gets the extruding output for the given input. - * - * @param input input item - * @return output item, or null - */ - @ZenMethod - public static IItemStack getRollingOutput(IItemStack input) { - RecipeOutput output = Recipes.metalformerRolling.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } - /** - * Adds a extruding recipe to the metal former. - * - * @param output output item - * @param input input item - */ - @ZenMethod - public static void addCuttingRecipe(IItemStack output, IIngredient input) { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "metal former - cutting", - Recipes.metalformerCutting, - getItemStacks(output), - null, - new IC2RecipeInput(input))); - } - - /** - * Gets the cutting output for the given input. - * - * @param input input item - * @return output item, or null - */ - @ZenMethod - public static IItemStack getCuttingOutput(IItemStack input) { - RecipeOutput output = Recipes.metalformerCutting.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/OreWasher.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/OreWasher.java deleted file mode 100644 index a0af2f9..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/OreWasher.java +++ /dev/null @@ -1,43 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStacks; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import net.minecraft.nbt.NBTTagCompound; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.OreWasher") -@ModOnly("IC2") -public class OreWasher { - @ZenMethod - public static void addRecipe(IItemStack[] output, IIngredient input, int millibuckets) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("amount", millibuckets); - MineTweakerAPI.apply(new MachineAddRecipeAction( - "ore washer", - Recipes.oreWashing, - getItemStacks(output), - nbt, - new IC2RecipeInput(input))); - } - - @ZenMethod - public static IItemStack[] getOutput(IItemStack input) { - RecipeOutput output = Recipes.oreWashing.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStacks(output.items); - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Recycler.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Recycler.java deleted file mode 100644 index 3fff0c3..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Recycler.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.Recycler") -@ModOnly("IC2") -public class Recycler { - @ZenMethod - public static void addBlacklist(IIngredient ingredient) { - MineTweakerAPI.apply(new AddBlacklistAction(ingredient)); - } - - @ZenMethod - public static boolean isBlacklisted(IItemStack item) { - return Recipes.recyclerBlacklist.contains(getItemStack(item)); - } - - private static class AddBlacklistAction extends OneWayAction { - private IIngredient ingredient; - - public AddBlacklistAction(IIngredient ingredient) { - this.ingredient = ingredient; - } - - @Override - public void apply() { - for (IItemStack itemStack : ingredient.getItems()) { - Recipes.recyclerBlacklist.add(MineTweakerMC.getItemStack(itemStack)); - } - } - - @Override - public String describe() { - return "Adding " + ingredient + " to the recycler blacklist"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 29 * hash + (this.ingredient != null ? this.ingredient.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBlacklistAction other = (AddBlacklistAction) obj; - if (this.ingredient != other.ingredient && (this.ingredient == null || !this.ingredient.equals(other.ingredient))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ScrapBox.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ScrapBox.java deleted file mode 100644 index 943ff5c..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ScrapBox.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.WeightedItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.ScrapBox") -@ModOnly("IC2") -public class ScrapBox { - /** - * Adds an item drop. - * - * Reference scrap box chance values: - * - * 0.1: Diamond - * 0.5: Cake, Gold Helmet, Iron Ore, Gold Ore - * 1.0: Wooden tools, Soul Sand, Sign, Leather, Feather, Bone - * 1.5: Apple, Bread - * 2.0: Netherrack, Rotten Flesh - * 3.0: Grass, Gravel - * 4.0: Stick - * 5.0: Dirt, Wooden Hoe - * - * @param stack weighted item stack to add - */ - @ZenMethod - public static void addDrop(WeightedItemStack stack) { - MineTweakerAPI.apply(new AddDropAction(stack)); - } - - private static class AddDropAction extends OneWayAction { - private final WeightedItemStack stack; - - public AddDropAction(WeightedItemStack stack) { - this.stack = stack; - } - - @Override - public void apply() { - Recipes.scrapboxDrops.addDrop(getItemStack(stack.getStack()), stack.getChance()); - } - - @Override - public String describe() { - return "Adding scrapbox drop " + stack.getStack(); - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 71 * hash + (this.stack != null ? this.stack.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddDropAction other = (AddDropAction) obj; - if (this.stack != other.stack && (this.stack == null || !this.stack.equals(other.stack))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java deleted file mode 100644 index c1bfe9f..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.liquid.ILiquidStack; -import net.minecraftforge.fluids.FluidRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.SemiFluidGenerator") -@ModOnly("IC2") -public class SemiFluidGenerator { - @ZenMethod - public static void addFluid(ILiquidStack liquidPerTick, int energyPerTick) { - MineTweakerAPI.apply(new AddFluidAction(liquidPerTick.getName(), liquidPerTick.getAmount(), energyPerTick)); - } - - @ZenMethod - public static boolean accepts(ILiquidStack liquid) { - return Recipes.semiFluidGenerator.acceptsFluid(FluidRegistry.getFluid(liquid.getName())); - } - - private static class AddFluidAction extends OneWayAction { - private final String name; - private final int liquidPerTick; - private final int energyPerTick; - - public AddFluidAction(String name, int liquidPerTick, int energyPerTick) { - this.name = name; - this.liquidPerTick = liquidPerTick; - this.energyPerTick = energyPerTick; - } - - @Override - public void apply() { - Recipes.semiFluidGenerator.addFluid(name, liquidPerTick, energyPerTick); - } - - @Override - public String describe() { - return "Adding liquid " + name + " as semifluid fuel"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0); - hash = 47 * hash + this.liquidPerTick; - hash = 47 * hash + this.energyPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidAction other = (AddFluidAction) obj; - if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { - return false; - } - if (this.liquidPerTick != other.liquidPerTick) { - return false; - } - if (this.energyPerTick != other.energyPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ThermalCentrifuge.java b/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ThermalCentrifuge.java deleted file mode 100644 index 9d7accf..0000000 --- a/MineTweaker3-MC164-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ThermalCentrifuge.java +++ /dev/null @@ -1,81 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStacks; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import net.minecraft.nbt.NBTTagCompound; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 compressor recipes. Recipes can be added but not - * removed, due to IC2 API restrictions. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.ThermalCentrifuge") -@ModOnly("IC2") -public class ThermalCentrifuge { - /** - * Adds a new recipe to the centrifuge. - * - * The recipe input can be any ingredient, as long as the stack size is determined. - * The output is an array of item stacks. - * - * @param output recipe outputs - * @param ingredient recipe input - * @param minHeat minimum centrifuge heat level - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IIngredient ingredient, int minHeat) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("minHeat", minHeat); - MineTweakerAPI.apply(new MachineAddRecipeAction( - "thermal centrifuge", - Recipes.centrifuge, - getItemStacks(output), - tag, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Adds a new recipe to the centrifuge. - * - * The recipe input can be any ingredient, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - * @param minHeat minimum centrifuge heat level - */ - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient ingredient, int minHeat) { - addRecipe(new IItemStack[] { output }, ingredient, minHeat); - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack[] getOutput(IItemStack input) { - RecipeOutput output = Recipes.centrifuge.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStacks(output.items); - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/build.gradle b/MineTweaker3-MC164-Mod-MFR/build.gradle deleted file mode 100644 index 1077fcb..0000000 --- a/MineTweaker3-MC164-Mod-MFR/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft{ - version = forgeVersion164 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC164-Main') - compile files('libs/MineFactoryReloaded-2.7.9-final.jar', 'libs/PowerCrystalsCore-1.1.8-9.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.mfr.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC164-Mod-MFR/libs/MineFactoryReloaded-2.7.9-final.jar b/MineTweaker3-MC164-Mod-MFR/libs/MineFactoryReloaded-2.7.9-final.jar deleted file mode 100644 index 0b27a34..0000000 Binary files a/MineTweaker3-MC164-Mod-MFR/libs/MineFactoryReloaded-2.7.9-final.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-MFR/libs/PowerCrystalsCore-1.1.8-9.jar b/MineTweaker3-MC164-Mod-MFR/libs/PowerCrystalsCore-1.1.8-9.jar deleted file mode 100644 index 163d320..0000000 Binary files a/MineTweaker3-MC164-Mod-MFR/libs/PowerCrystalsCore-1.1.8-9.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/FertilizableType.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/FertilizableType.java deleted file mode 100644 index 0968b36..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/FertilizableType.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package stanhebben.minetweaker.mods.mfr; - -/** - * - * @author Stanneke - */ -public enum FertilizableType { - REPLACE, - BONEMEAL -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/MFRCommands.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/MFRCommands.java deleted file mode 100644 index 4d455ac..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/MFRCommands.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr; - -import java.util.Map; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.MineTweakerImplementationAPI.ReloadEvent; -import minetweaker.annotations.OnRegister; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.ICommandFunction; -import minetweaker.util.IEventHandler; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomItem; -import powercrystals.core.random.WeightedRandomItemStack; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.IFactoryFertilizer; -import powercrystals.minefactoryreloaded.api.IFactoryFruit; - -/** - * - * @author Stan - */ -public class MFRCommands { - private static final String[] DESCRIPTION = { - " MineFactory commands:", - " /minetweaker mfr fertilizers", - " Lists all fertilizers", - " /minetweaker mfr fruits", - " Lists all known fruit blocks", - " /minetweaker mfr laserores", - " Lists all ores known to the mining laser", - " /minetweaker mfr rubbertreebiomes", - " Lists all biomes for the rubber tree", - " /minetweaker mfr sludgedrops", - " Lists all sludge boiler drops" - }; - - @OnRegister - public static void onRegister() { - MineTweakerImplementationAPI.onReloadEvent(new IEventHandler() { - @Override - public void handle(ReloadEvent event) { - MineTweakerImplementationAPI.addMineTweakerCommand("mfr", DESCRIPTION, new ICommandFunction() { - @Override - public void execute(String[] arguments, IPlayer player) { - if (arguments.length < 1) { - player.sendChat("Please specify a mfr command"); - } else { - if (arguments[0].equals("fertilizers")) { - MineTweakerAPI.logCommand("Fertilizers:"); - - for (Map.Entry fertilizer : MFRRegistry.getFertilizers().entrySet()) { - IItemStack item = MineTweakerMC.getItemStack(Item.itemsList[fertilizer.getKey()], 1, 0); - String message = "- " + item + " (" + item.getDisplayName() + ")"; - MineTweakerAPI.logCommand(message); - } - - player.sendChat("Fertilizer list generated; see minetweaker.log"); - } else if (arguments[0].equals("fruits")) { - MineTweakerAPI.logCommand("Fruit Blocks:"); - - for (Map.Entry fruitBlock : MFRRegistry.getFruits().entrySet()) { - Block block = Block.blocksList[fruitBlock.getKey()]; - String message = "- " + block.getUnlocalizedName() + " (" + block.getLocalizedName() + ")"; - MineTweakerAPI.logCommand(message); - } - - player.sendChat("Fluit blocks list generated; see minetweaker.log"); - } else if (arguments[0].equals("laserores")) { - MineTweakerAPI.logCommand("Laser ores:"); - - for (WeightedRandomItem randomItem : MFRRegistry.getLaserOres()) { - if (randomItem instanceof WeightedRandomItemStack) { - WeightedRandomItemStack randomItemStack = (WeightedRandomItemStack) randomItem; - IItemStack item = MineTweakerMC.getIItemStack(randomItemStack.getStack()); - MineTweakerAPI.logCommand(" (" + randomItemStack.itemWeight + "): " + item + " (" + item.getDisplayName() + ")"); - } - } - - player.sendChat("Laser ore list generated; see minetweaker.log"); - - for (int i = 0; i < MineTweakerAPI.COLOR_NAMES.length; i++) { - if (MFRRegistry.getLaserPreferredOres(i) != null && !MFRRegistry.getLaserPreferredOres(i).isEmpty()) { - MineTweakerAPI.logCommand("Laser affinity " + i + " (" + MineTweakerAPI.COLOR_NAMES[i] + "):"); - - for (ItemStack item : MFRRegistry.getLaserPreferredOres(i)) { - IItemStack iitem = MineTweakerMC.getIItemStack(item); - MineTweakerAPI.logCommand(" " + iitem + " (" + iitem.getDisplayName() + ")"); - } - } - } - - player.sendChat("Laser preferred ore list generated; see minetweaker.log"); - } else if (arguments[0].equals("rubbertreebiomes")) { - MineTweakerAPI.logCommand("Rubber tree biomes:"); - for (String biome : MFRRegistry.getRubberTreeBiomes()) { - MineTweakerAPI.logCommand(" " + biome); - } - - player.sendChat("Rubber tree biome list generated; see minetweaker.log"); - } else if (arguments[0].equals("sludgedrops")) { - MineTweakerAPI.logCommand("Sludge drops:"); - - for (WeightedRandomItem randItem : MFRRegistry.getSludgeDrops()) { - if (randItem instanceof WeightedRandomItemStack) { - WeightedRandomItemStack randomItem = (WeightedRandomItemStack) randItem; - IItemStack item = MineTweakerMC.getIItemStack(randomItem.getStack()); - MineTweakerAPI.logCommand(" (" + randomItem.itemWeight + "): " + item + " (" + item.getDisplayName() + ")"); - } - } - - player.sendChat("Sludge drop list generated; see minetweaker.log"); - } else { - player.sendChat("Unknown mfr command: " + arguments[1]); - } - } - } - }); - } - }); - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/PrePlantAction.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/PrePlantAction.java deleted file mode 100644 index 0b0ee1e..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/PrePlantAction.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package stanhebben.minetweaker.mods.mfr; - -/** - * - * @author Stanneke - */ -public enum PrePlantAction { - NONE, - TILL -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/AutoSpawner.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/AutoSpawner.java deleted file mode 100644 index 39f7176..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/AutoSpawner.java +++ /dev/null @@ -1,115 +0,0 @@ -package minetweaker.mods.mfr.machines; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import static minetweaker.mc164.util.MineTweakerPlatformUtils.getLivingEntityClass; -import powercrystals.minefactoryreloaded.MFRRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.AutoSpawner") -@ModOnly("MineFactoryReloaded") -public class AutoSpawner { - @ZenMethod - public static void addBlacklist(String entityClassName) { - MineTweakerAPI.apply(new AutoSpawnerAddBlacklistAction(getLivingEntityClass(entityClassName))); - } - - @ZenMethod - public static void removeBlacklist(String entityClassName) { - MineTweakerAPI.apply(new AutoSpawnerRemoveBlacklistAction(getLivingEntityClass(entityClassName))); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AutoSpawnerAddBlacklistAction implements IUndoableAction { - private final Class entityClass; - private final boolean existed; - - public AutoSpawnerAddBlacklistAction(Class entityClass) { - this.entityClass = entityClass; - existed = MFRRegistry.getAutoSpawnerClassBlacklist().contains(entityClass); - } - - @Override - public void apply() { - if (!existed) - MFRRegistry.registerAutoSpawnerBlacklistClass(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - if (!existed) - MFRRegistry.getAutoSpawnerClassBlacklist().remove(entityClass); - } - - @Override - public String describe() { - return "Adding auto-spawner blacklist " + entityClass.getCanonicalName(); - } - - @Override - public String describeUndo() { - return "Removing auto-spawner blacklist " + entityClass.getCanonicalName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AutoSpawnerRemoveBlacklistAction implements IUndoableAction { - private final Class entityClass; - private final boolean existed; - - public AutoSpawnerRemoveBlacklistAction(Class entityClass) { - this.entityClass = entityClass; - existed = MFRRegistry.getAutoSpawnerClassBlacklist().contains(entityClass); - } - - @Override - public void apply() { - if (existed) - MFRRegistry.getAutoSpawnerClassBlacklist().remove(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - if (existed) - MFRRegistry.getAutoSpawnerClassBlacklist().add(entityClass); - } - - @Override - public String describe() { - return "Removing auto-spawner blacklist " + entityClass.getCanonicalName(); - } - - @Override - public String describeUndo() { - return "Restoring auto-spawner blacklist " + entityClass.getCanonicalName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Breeder.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Breeder.java deleted file mode 100644 index a94ceee..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Breeder.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.mc164.util.MineTweakerPlatformUtils.getLivingEntityClass; -import net.minecraft.item.ItemStack; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.Breeder") -@ModOnly("MineFactoryReloaded") -public class Breeder { - @ZenMethod - public static void addFood(String entityClassName, IItemStack item) { - Class entityClass = getLivingEntityClass(entityClassName); - MineTweakerAPI.apply(new BreederAddFoodAction(entityClass, item)); - } - - @ZenMethod - public static void removeFood(String entityClassName, IIngredient item) { - Class entityClass = getLivingEntityClass(entityClassName); - - List toRemove = new ArrayList(); - List foods = MFRRegistry.getBreederFoods().get(entityClass); - - for (int i = foods.size() - 1; i >= 0; i--) { - if (item.matches(MineTweakerMC.getIItemStack(foods.get(i)))) { - toRemove.add(i); - } - } - for (int i : toRemove) { - MineTweakerAPI.apply(new BreederRemoveFoodAction(entityClass, i)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class BreederAddFoodAction implements IUndoableAction { - private final Class entityClass; - private final IItemStack item; - - public BreederAddFoodAction(Class entityClass, IItemStack item) { - this.entityClass = entityClass; - this.item = item; - } - - @Override - public void apply() { - FactoryRegistry.registerBreederFood(entityClass, MineTweakerMC.getItemStack(item)); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - List list = MFRRegistry.getBreederFoods().get(entityClass); - list.remove(list.size() - 1); - } - - @Override - public String describe() { - return "Adding breeder food " + item.getDisplayName() + " for " + entityClass.getCanonicalName(); - } - - @Override - public String describeUndo() { - return "Removing breeder food " + item.getDisplayName() + " for " + entityClass.getCanonicalName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class BreederRemoveFoodAction implements IUndoableAction { - private final Class entityClass; - private final int index; - private final ItemStack item; - - public BreederRemoveFoodAction(Class entityClass, int index) { - this.entityClass = entityClass; - this.index = index; - item = MFRRegistry.getBreederFoods().get(entityClass).get(index); - } - - @Override - public void apply() { - MFRRegistry.getBreederFoods().get(entityClass).remove(index); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getBreederFoods().get(entityClass).add(index, item); - } - - @Override - public String describe() { - return "Removing breeder food " + item.getDisplayName() + " for " + entityClass.getCanonicalName(); - } - - @Override - public String describeUndo() { - return "Restoring breeder food " + item.getDisplayName() + " for " + entityClass.getCanonicalName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java deleted file mode 100644 index 3042126..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.Random; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.item.Item; -import net.minecraft.item.ItemDye; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.FertilizerType; -import powercrystals.minefactoryreloaded.api.IFactoryFertilizable; -import powercrystals.minefactoryreloaded.api.IFactoryFertilizer; -import stanhebben.minetweaker.mods.mfr.FertilizableType; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.Fertilizer") -@ModOnly("MineFactoryReloaded") -public class Fertilizer { - @ZenMethod - public void addFertilizable(IItemStack block, String fertilizeType, @Optional String method, @Optional IItemStack replacement) { - FertilizerType fertilizer; - if (fertilizeType.equals("any")) { - fertilizer = null; - } else if (fertilizeType.equals("normal")) { - fertilizer = FertilizerType.GrowPlant; - } else if (fertilizeType.equals("grass")) { - fertilizer = FertilizerType.Grass; - } else if (fertilizeType.equals("magic")) { - fertilizer = FertilizerType.GrowMagicalCrop; - } else { - throw new IllegalArgumentException("Unknown fertilizer type: " + fertilizeType); - } - - FertilizableType type = FertilizableType.BONEMEAL; - - if (method == null || method.equals("bonemeal")) { - type = FertilizableType.BONEMEAL; - } else if (method.equals("replace")) { - type = FertilizableType.REPLACE; - if (replacement == null) - throw new IllegalArgumentException("replace method requires a replacement block"); - } else { - throw new IllegalArgumentException("Unknown fertilization method: " + method); - } - - MineTweakerAPI.apply(new FertilizerAddFertilizableAction(block, replacement, fertilizer, type)); - } - - @ZenMethod - public void removeFertilizable(IItemStack item) { - MineTweakerAPI.apply(new FertilizerRemoveFertilizableAction(item)); - } - - @ZenMethod - public void addFertilizer(IItemStack item, String type) { - FertilizerType fertilizerType; - if (type.equals("grass")) { - fertilizerType = FertilizerType.Grass; - } else if (type.equals("normal")) { - fertilizerType = FertilizerType.GrowPlant; - } else if (type.equals("magic")) { - fertilizerType = FertilizerType.GrowMagicalCrop; - } else { - throw new IllegalArgumentException("Unknown fertilizer type: " + type); - } - - MineTweakerAPI.apply(new FertilizerAddFertilizerAction(item, fertilizerType)); - } - - @ZenMethod - public void remmoveFertilizer(IItemStack item) { - MineTweakerAPI.apply(new FertilizerRemoveFertilizerAction(item)); - } - - // ###################### - // ### Action Classes ### - // ###################### - - public class FertilizerAddFertilizableAction implements IUndoableAction { - private final IItemStack block; - private final IItemStack plant; - private final FertilizerType type; - private final FertilizableType method; - - private final IFactoryFertilizable old; - - public FertilizerAddFertilizableAction(IItemStack block, IItemStack plant, FertilizerType type, FertilizableType method) { - this.block = block; - this.plant = plant; - this.type = type; - this.method = method; - - old = MFRRegistry.getFertilizables().get(MineTweakerMC.getItemStack(block).itemID); - } - - @Override - public void apply() { - FactoryRegistry.registerFertilizable(new SimpleFertilizable(block, plant, type)); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - if (old == null) { - MFRRegistry.getFertilizables().remove(MineTweakerMC.getItemStack(block).itemID); - } else { - FactoryRegistry.registerFertilizable(old); - } - } - - @Override - public String describe() { - return "Making " + block.getDisplayName() + " fertilizable"; - } - - @Override - public String describeUndo() { - if (old == null) { - return "Removing fertilizable " + block.getDisplayName(); - } else { - return "Restoring fertilizable " + block.getDisplayName(); - } - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class FertilizerAddFertilizerAction implements IUndoableAction { - private final IItemStack item; - private final FertilizerType type; - - private final IFactoryFertilizer old; - - public FertilizerAddFertilizerAction(IItemStack item, FertilizerType type) { - this.item = item; - this.type = type; - - old = MFRRegistry.getFertilizers().get(MineTweakerMC.getItemStack(item).itemID); - } - - @Override - public void apply() { - FactoryRegistry.registerFertilizer(new SimpleFertilizer(MineTweakerMC.getItemStack(item), type)); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - if (old == null) { - MFRRegistry.getFertilizers().remove(MineTweakerMC.getItemStack(item).itemID); - } else { - FactoryRegistry.registerFertilizer(old); - } - } - - @Override - public String describe() { - return "Adding fertilizer " + item.getDisplayName(); - } - - @Override - public String describeUndo() { - if (old == null) { - return "Removing fertilizer " + item.getDisplayName(); - } else { - return "Restoring fertilizer " + item.getDisplayName(); - } - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - public class FertilizerRemoveFertilizableAction implements IUndoableAction { - private final IItemStack item; - private final IFactoryFertilizable old; - - public FertilizerRemoveFertilizableAction(IItemStack item) { - this.item = item; - old = MFRRegistry.getFertilizables().get(MineTweakerMC.getItemStack(item).itemID); - } - - @Override - public void apply() { - MFRRegistry.getFertilizables().remove(MineTweakerMC.getItemStack(item).itemID); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FactoryRegistry.registerFertilizable(old); - } - - @Override - public String describe() { - return "Removing fertilizable " + item.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring fertilizable " + item.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - public class FertilizerRemoveFertilizerAction implements IUndoableAction { - private final IItemStack item; - private final IFactoryFertilizer old; - - public FertilizerRemoveFertilizerAction(IItemStack item) { - this.item = item; - this.old = MFRRegistry.getFertilizers().get(MineTweakerMC.getItemStack(item).itemID); - } - - @Override - public void apply() { - MFRRegistry.getFertilizers().remove(MineTweakerMC.getItemStack(item).itemID); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FactoryRegistry.registerFertilizer(old); - } - - @Override - public String describe() { - return "Removing fertilizer " + item.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring fertilizer " + item.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class SimpleFertilizable implements IFactoryFertilizable { - private final IItemStack block; - private final IItemStack plant; - private final FertilizerType type; - - public SimpleFertilizable(IItemStack block, IItemStack plant, FertilizerType type) { - this.block = block; - this.plant = plant; - this.type = type; - } - - @Override - public int getFertilizableBlockId() { - return MineTweakerMC.getItemStack(block).itemID; - } - - @Override - public boolean canFertilizeBlock(World world, int x, int y, int z, FertilizerType fertilizerType) { - if (this.type != null && type != fertilizerType) - return false; - - IItemStack blockAt = MineTweakerMC.getIItemStack(new ItemStack(world.getBlockId(x, y, z), 1, world.getBlockMetadata(x, y, z))); - return block.matches(blockAt); - } - - @Override - public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType) { - if (plant == null) { - return ItemDye.applyBonemeal(new ItemStack(Item.dyePowder.itemID, 1, 15), world, x, y, z, null); - } else { - ItemStack istack = MineTweakerMC.getItemStack(plant); - world.setBlock(x, y, z, istack.itemID, plant.getDamage(), 0); - return true; - } - } - } - - private static class SimpleFertilizer implements IFactoryFertilizer { - private final ItemStack item; - private final FertilizerType type; - - public SimpleFertilizer(ItemStack item, FertilizerType type) { - this.item = item; - this.type = type; - } - - @Override - public int getFertilizerId() { - return item.itemID; - } - - @Override - public int getFertilizerMeta() { - return item.getItemDamage(); - } - - @Override - public FertilizerType getFertilizerType() { - return type; - } - - @Override - public void consume(ItemStack fertilizer) { - fertilizer.stackSize--; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/FruitPicker.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/FruitPicker.java deleted file mode 100644 index 418aac8..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/FruitPicker.java +++ /dev/null @@ -1,357 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.IFactoryFruit; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.FruitPicker") -@ModOnly("MineFactoryReloaded") -public class FruitPicker { - @ZenMethod - public static void addFruit(IBlockPattern block, IBlock replacement, WeightedItemStack drop) { - addFruit(block, replacement, new WeightedItemStack[] { drop }); - } - - @ZenMethod - public static void addFruit(IBlockPattern block, IBlock replacement, WeightedItemStack[] drops) { - TweakerFruit fruit = new TweakerFruit(block, replacement, drops); - MineTweakerAPI.apply(new AddFruitAction(fruit)); - } - - @ZenMethod - public static void removeFruit(IBlockPattern block) { - MineTweakerAPI.apply(new RemoveFruitAction(block)); - } - - @ZenMethod - public static void addLog(IBlockPattern block) { - MineTweakerAPI.apply(new AddLogAction(block)); - } - - @ZenMethod - public static void removeLog(IBlockPattern block) { - if (MFRRegistry.getFruitLogBlockIds() == null) { - MineTweakerAPI.logWarning("Cannot remove MFR Fruit Picker Logs"); - } else { - MineTweakerAPI.apply(new RemoveLogAction(block)); - } - } - - // ##################### - // ### Inner classes ### - // ##################### - - private static class TweakerFruit { - private final IBlockPattern block; - private final IBlock replacement; - private final WeightedItemStack[] possibleDrops; - - public TweakerFruit(IBlockPattern block, IBlock replacement, WeightedItemStack[] possibleDrops) { - this.block = block; - this.replacement = replacement; - this.possibleDrops = possibleDrops; - } - } - - private static class TweakerFruitPartial implements IFactoryFruit { - private final int blockId; - private final List fruits; - - public TweakerFruitPartial(int blockId) { - this.blockId = blockId; - fruits = new ArrayList(); - } - - @Override - public int getSourceBlockId() { - return blockId; - } - - @Override - public boolean canBePicked(World world, int x, int y, int z) { - for (TweakerFruit fruit : fruits) { - if (fruit.block.matches(MineTweakerMC.getBlock(world, x, y, z))) - return true; - } - - return false; - } - - @Override - public ItemStack getReplacementBlock(World world, int x, int y, int z) { - IBlock block = MineTweakerMC.getBlock(world, x, y, z); - for (TweakerFruit fruit : fruits) { - if (fruit.block.matches(block)) - return MineTweakerMC.toItemStack(fruit.replacement); - } - return null; - } - - @Override - public void prePick(World world, int x, int y, int z) {} - - @Override - public List getDrops(World world, Random rand, int x, int y, int z) { - IBlock block = MineTweakerMC.getBlock(world, x, y, z); - for (TweakerFruit fruit : fruits) { - if (fruit.block.matches(block)) - return Arrays.asList(MineTweakerMC.getItemStacks(WeightedItemStack.pickRandomDrops(rand, fruit.possibleDrops))); - } - - return Collections.EMPTY_LIST; - } - - @Override - public void postPick(World world, int x, int y, int z) {} - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddFruitAction implements IUndoableAction { - private final TweakerFruit fruit; - - public AddFruitAction(TweakerFruit fruit) { - this.fruit = fruit; - } - - @Override - public void apply() { - Map fruits = MFRRegistry.getFruits(); - for (IBlock partial : fruit.block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - if (fruits != null && fruits.containsKey(blockId)) { - IFactoryFruit existingFruit = fruits.get(blockId); - if (existingFruit instanceof TweakerFruitPartial) { - TweakerFruitPartial existingFruitPartial = (TweakerFruitPartial) existingFruit; - if (!existingFruitPartial.fruits.contains(fruit)) { - existingFruitPartial.fruits.add(fruit); - } - } else { - MineTweakerAPI.logError("A non-MineTweaker fruit already exists for this ID"); - } - } else { - TweakerFruitPartial factoryFruit = new TweakerFruitPartial(blockId); - FactoryRegistry.registerFruit(factoryFruit); - } - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - Map fruits = MFRRegistry.getFruits(); - for (IBlock partial : fruit.block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - IFactoryFruit factoryFruit = fruits.get(blockId); - if (factoryFruit != null && factoryFruit instanceof TweakerFruitPartial) { - ((TweakerFruitPartial) factoryFruit).fruits.remove(fruit); - } - } - } - - @Override - public String describe() { - return "Adding Fruit Picker fruit block " + fruit.block.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing Fruit Picker fruit block " + fruit.block.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveFruitAction implements IUndoableAction { - private final IBlockPattern block; - private final Map removed; - - public RemoveFruitAction(IBlockPattern block) { - this.block = block; - - Map fruits = MFRRegistry.getFruits(); - removed = new HashMap(); - for (IBlock partial : block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - if (fruits.containsKey(blockId)) { - removed.put(blockId, fruits.get(blockId)); - } - } - } - - @Override - public void apply() { - Map fruits = MFRRegistry.getFruits(); - for (Integer key : removed.keySet()) { - fruits.remove(key); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - Map fruits = MFRRegistry.getFruits(); - for (Map.Entry restore : removed.entrySet()) { - fruits.put(restore.getKey(), restore.getValue()); - } - } - - @Override - public String describe() { - return "Removing fruit picker fruit block " + block.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring fruit picker fruit block " + block.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddLogAction implements IUndoableAction { - private final IBlockPattern block; - private final List addedLogs = new ArrayList(); - - public AddLogAction(IBlockPattern block) { - this.block = block; - - for (IBlock partial : block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - if (!MFRRegistry.getFruitLogBlockIds().contains(blockId)) { - if (!addedLogs.contains(blockId)) - addedLogs.add(blockId); - } - } - } - - @Override - public void apply() { - for (int log : addedLogs) { - FactoryRegistry.registerFruitLogBlockId(log); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (int log : addedLogs) { - MFRRegistry.getFruitLogBlockIds().remove(log); - } - } - - @Override - public String describe() { - return "Adding MFR Fruit Picker log block " + block.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing MFR Fruit Picker log block " + block.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveLogAction implements IUndoableAction { - private final IBlockPattern block; - private final List removedLogs = new ArrayList(); - - public RemoveLogAction(IBlockPattern block) { - this.block = block; - - for (IBlock partial : block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - if (MFRRegistry.getFruitLogBlockIds().contains(blockId)) { - if (!removedLogs.contains(blockId)) - removedLogs.add(blockId); - } - } - } - - @Override - public void apply() { - for (int log : removedLogs) { - MFRRegistry.getFruitLogBlockIds().remove(log); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (int log : removedLogs) { - FactoryRegistry.registerFruitLogBlockId(log); - } - } - - @Override - public String describe() { - return "Removing MFR Fruit Picker log block " + block.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring MFR Fruit Picker log block " + block.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Grinder.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Grinder.java deleted file mode 100644 index 35271f9..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Grinder.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.mc164.util.MineTweakerPlatformUtils.getLivingEntityClass; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.IFactoryGrindable; -import powercrystals.minefactoryreloaded.api.MobDrop; -import stanhebben.zenscript.annotations.ZenClass; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.Grinder") -@ModOnly("MineFactoryReloaded") -public class Grinder { - public static void addBlacklist(String entityClassName) { - Class entityClass = getLivingEntityClass(entityClassName); - MineTweakerAPI.apply(new AddBlacklistAction(entityClass)); - } - - public static void removeBlacklist(String entityClassName) { - Class entityClass = getLivingEntityClass(entityClassName); - if (!MFRRegistry.getGrinderBlacklist().contains(entityClass)) { - MineTweakerAPI.logWarning(entityClassName + " is not blacklisted in the MFR Grinder"); - } else { - MineTweakerAPI.apply(new RemoveBlacklistAction(entityClass)); - } - } - - public static void addGrindable(String entityClassName) { - addGrindable(entityClassName, new WeightedItemStack[0]); - } - - public static void addGrindable(String entityClassName, WeightedItemStack possibleDrop) { - addGrindable(entityClassName, new WeightedItemStack[] { possibleDrop }); - } - - public static void addGrindable(String entityClassName, WeightedItemStack[] possibleDrops) { - Class entityClass = getLivingEntityClass(entityClassName); - MineTweakerAPI.apply(new AddGrindableAction(entityClass, possibleDrops)); - } - - public static void removeGrindable(String entityClassName) { - Class entityClass = getLivingEntityClass(entityClassName); - if (!MFRRegistry.getGrindables().containsKey(entityClass)) { - MineTweakerAPI.logError("No such grindable entity: " + entityClassName); - } else { - MineTweakerAPI.apply(new RemoveGrindableAction(entityClass)); - } - } - - // ####################### - // ### Private classes ### - // ####################### - - private static class SimpleGrindable implements IFactoryGrindable { - private final Class entityClass; - private final WeightedItemStack[] drops; - - public SimpleGrindable(Class entityClass, WeightedItemStack[] drops) { - this.entityClass = entityClass; - this.drops = drops; - } - - @Override - public Class getGrindableEntity() { - return entityClass; - } - - @Override - public List grind(World world, EntityLivingBase entity, Random random) { - List dropList = new ArrayList(); - for (IItemStack itemStack : WeightedItemStack.pickRandomDrops(random, drops)) { - dropList.add(new MobDrop(1, MineTweakerMC.getItemStack(itemStack))); - } - return dropList; - } - - @Override - public boolean processEntity(EntityLivingBase entity) { - entity.attackEntityFrom(DamageSource.generic, entity.getMaxHealth() * 20); - return entity.isDead; - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddBlacklistAction implements IUndoableAction { - private final Class entityClass; - - public AddBlacklistAction(Class entityClass) { - this.entityClass = entityClass; - } - - @Override - public void apply() { - FactoryRegistry.registerGrinderBlacklist(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getGrinderBlacklist().remove(entityClass); - } - - @Override - public String describe() { - return "Adding " + entityClass.getName() + " to the MFR Grinder blacklist"; - } - - @Override - public String describeUndo() { - return "Removing " + entityClass.getName() + " from the MFR Grinder blacklist"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveBlacklistAction implements IUndoableAction { - private final Class entityClass; - - public RemoveBlacklistAction(Class entityClass) { - this.entityClass = entityClass; - } - - @Override - public void apply() { - MFRRegistry.getGrinderBlacklist().remove(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FactoryRegistry.registerGrinderBlacklist(entityClass); - } - - @Override - public String describe() { - return "Removing " + entityClass + " from the MFR Grinder blacklist"; - } - - @Override - public String describeUndo() { - return "Restoring " + entityClass + " to the MFR Grinder blacklist"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddGrindableAction implements IUndoableAction { - private final SimpleGrindable grindable; - - public AddGrindableAction(Class entityClass, WeightedItemStack[] possibleDrops) { - grindable = new SimpleGrindable(entityClass, possibleDrops); - } - - @Override - public void apply() { - FactoryRegistry.registerGrindable(grindable); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getGrindables().remove(grindable.entityClass); - } - - @Override - public String describe() { - return "Adding MFR Grindable " + grindable.entityClass.getName(); - } - - @Override - public String describeUndo() { - return "Removing MFR Grindable " + grindable.entityClass.getName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveGrindableAction implements IUndoableAction { - private final Class entityClass; - private final IFactoryGrindable grindable; - - public RemoveGrindableAction(Class entityClass) { - this.entityClass = entityClass; - grindable = MFRRegistry.getGrindables().get(entityClass); - } - - @Override - public void apply() { - MFRRegistry.getGrindables().remove(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FactoryRegistry.registerGrindable(grindable); - } - - @Override - public String describe() { - return "Removing grindable " + entityClass.getName(); - } - - @Override - public String describeUndo() { - return "Restoring grindable " + entityClass.getName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Harvester.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Harvester.java deleted file mode 100644 index 4dc1e8b..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Harvester.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.mc164.block.MCBlockDefinition; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.HarvestType; -import powercrystals.minefactoryreloaded.api.IFactoryHarvestable; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.Harvester") -@ModOnly("MineFactoryReloaded") -public class Harvester { - @ZenMethod - public static void addHarvestable(IItemStack item) { - addHarvestable(item.asBlock(), (WeightedItemStack[]) null, null); - } - - @ZenMethod - public static void addHarvestable(IItemStack item, String type) { - addHarvestable(item.asBlock(), (WeightedItemStack[]) null, type); - } - - @ZenMethod - public static void addHarvestable(IBlockPattern block, WeightedItemStack drop, @Optional String type) { - addHarvestable(block, new WeightedItemStack[] { drop }, type); - } - - @ZenMethod - public static void addHarvestable(IBlockPattern block, WeightedItemStack[] drops, @Optional String type) { - TweakerHarvestable harvestable = new TweakerHarvestable(block, drops, type); - MineTweakerAPI.apply(new AddHarvestableAction(harvestable)); - } - - @ZenMethod - public static void removeHarvestable(IBlockPattern block) { - MineTweakerAPI.apply(new RemoveHarvestableAction(block)); - } - - // ##################### - // ### Inner classes ### - // ##################### - - private static class TweakerHarvestable { - private final IBlockPattern block; - private final WeightedItemStack[] possibleDrops; - private final HarvestType type; - - public TweakerHarvestable(IBlockPattern block, WeightedItemStack[] possibleDrops, String stringType) { - this.block = block; - this.possibleDrops = possibleDrops; - - HarvestType type = HarvestType.Normal; - if (stringType == null || stringType.equals("normal")) { - type = HarvestType.Normal; - } else if (stringType.equals("column")) { - type = HarvestType.Column; - } else if (stringType.equals("leaveBottom")) { - type = HarvestType.LeaveBottom; - } else if (stringType.equals("tree")) { - type = HarvestType.Tree; - } else if (stringType.equals("treeFlipped")) { - type = HarvestType.TreeFlipped; - } else if (stringType.equals("treeLeaf")) { - type = HarvestType.TreeLeaf; - } else { - throw new IllegalArgumentException("Unknown harvestable type: " + stringType); - } - - this.type = type; - } - } - - private static class TweakerHarvestablePartial implements IFactoryHarvestable { - private final int blockId; - private final List harvestables; - - public TweakerHarvestablePartial(int blockId) { - this.blockId = blockId; - harvestables = new ArrayList(); - } - - @Override - public int getPlantId() { - return blockId; - } - - @Override - public HarvestType getHarvestType() { - // WARNING: first type will be used - // Also, take into account the possibility of having no harvestable yet - return harvestables.isEmpty() ? HarvestType.Normal : harvestables.get(0).type; - } - - @Override - public boolean breakBlock() { - return true; - } - - @Override - public boolean canBeHarvested(World world, Map map, int x, int y, int z) { - for (TweakerHarvestable harvestable : harvestables) { - if (harvestable.block.matches(MineTweakerMC.getBlock(world, x, y, z))) - return true; - } - - return false; - } - - @Override - public List getDrops(World world, Random random, Map map, int x, int y, int z) { - IBlock block = MineTweakerMC.getBlock(world, x, y, z); - for (TweakerHarvestable harvestable : harvestables) { - if (harvestable.block.matches(block)) { - if (harvestable.possibleDrops == null) { - Block mcBlock = ((MCBlockDefinition) block.getDefinition()).getInternalBlock(); - List result = mcBlock.getBlockDropped(world, x, y, z, block.getMeta(), 0); - return result; - } else { - List result = Arrays.asList(MineTweakerMC.getItemStacks(WeightedItemStack.pickRandomDrops(random, harvestable.possibleDrops))); - return result; - } - } - } - - return Collections.EMPTY_LIST; - } - - @Override - public void preHarvest(World world, int x, int y, int z) { - - } - - @Override - public void postHarvest(World world, int x, int y, int z) { - - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddHarvestableAction implements IUndoableAction { - private final TweakerHarvestable harvestable; - - public AddHarvestableAction(TweakerHarvestable harvestable) { - this.harvestable = harvestable; - } - - @Override - public void apply() { - Map harvestables = MFRRegistry.getHarvestables(); - for (IBlock partial : harvestable.block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - if (harvestable != null && harvestables.containsKey(blockId)) { - IFactoryHarvestable existingHarvestable = harvestables.get(blockId); - if (existingHarvestable instanceof TweakerHarvestablePartial) { - TweakerHarvestablePartial existingHarvestablePartial = (TweakerHarvestablePartial) existingHarvestable; - if (!existingHarvestablePartial.harvestables.contains(harvestable)) { - existingHarvestablePartial.harvestables.add(harvestable); - } - } else { - MineTweakerAPI.logError("A non-MineTweaker fruit already exists for this ID"); - } - } else { - TweakerHarvestablePartial factoryFruit = new TweakerHarvestablePartial(blockId); - factoryFruit.harvestables.add(harvestable); - FactoryRegistry.registerHarvestable(factoryFruit); - } - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - Map harvestables = MFRRegistry.getHarvestables(); - for (IBlock partial : harvestable.block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - IFactoryHarvestable factoryHarvestable = harvestables.get(blockId); - if (factoryHarvestable != null && factoryHarvestable instanceof TweakerHarvestablePartial) { - ((TweakerHarvestablePartial) factoryHarvestable).harvestables.remove(harvestable); - } - } - } - - @Override - public String describe() { - return "Adding Harvester harvestable block " + harvestable.block.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing Harvester harvestable block " + harvestable.block.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveHarvestableAction implements IUndoableAction { - private final IBlockPattern block; - private final Map removed; - - public RemoveHarvestableAction(IBlockPattern block) { - this.block = block; - - Map harvestables = MFRRegistry.getHarvestables(); - removed = new HashMap(); - for (IBlock partial : block.getBlocks()) { - int blockId = MineTweakerMC.getBlockId(partial.getDefinition()); - if (harvestables.containsKey(blockId)) { - removed.put(blockId, harvestables.get(blockId)); - } - } - } - - @Override - public void apply() { - Map harvestables = MFRRegistry.getHarvestables(); - for (Integer key : removed.keySet()) { - harvestables.remove(key); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - Map harvestables = MFRRegistry.getHarvestables(); - for (Map.Entry restore : removed.entrySet()) { - harvestables.put(restore.getKey(), restore.getValue()); - } - } - - @Override - public String describe() { - return "Removing Harvester harvestable block " + block.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring Harvester harvestable block " + block.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/IRedNetFunction.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/IRedNetFunction.java deleted file mode 100644 index 90524d2..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/IRedNetFunction.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -/** - * - * @author Stan - */ -public interface IRedNetFunction { - public int[] calculate(long time, int[] inputs); -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/MiningLaser.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/MiningLaser.java deleted file mode 100644 index a23e755..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/MiningLaser.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomItem; -import powercrystals.core.random.WeightedRandomItemStack; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.MiningLaser") -@ModOnly("MineFactoryReloaded") -public class MiningLaser { - @ZenMethod - public static void addOre(WeightedItemStack ore) { - MineTweakerAPI.apply(new AddOreAction(ore)); - } - - @ZenMethod - public static void removeOre(IIngredient ore) { - MineTweakerAPI.apply(new RemoveOreAction(ore)); - } - - @ZenMethod - public static void addPreferredOre(int color, IIngredient ore) { - MineTweakerAPI.apply(new AddPreferredOreAction(color, ore)); - } - - @ZenMethod - public static void removePreferredOre(int color, IIngredient ore) { - MineTweakerAPI.apply(new RemovePreferredOreAction(color, ore)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddOreAction implements IUndoableAction { - private final WeightedRandomItemStack item; - - public AddOreAction(WeightedItemStack item) { - this.item = new WeightedRandomItemStack((int) item.getChance(), MineTweakerMC.getItemStack(item.getStack())); - } - - @Override - public void apply() { - MFRRegistry.getLaserOres().add(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getLaserOres().remove(item); - } - - @Override - public String describe() { - return "Adding laser ore " + item.getStack().getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing laser ore " + item.getStack().getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveOreAction implements IUndoableAction { - private final IIngredient ingredient; - private final List removed; - - public RemoveOreAction(IIngredient ingredient) { - this.ingredient = ingredient; - removed = new ArrayList(); - - for (WeightedRandomItem iStack : MFRRegistry.getLaserOres()) { - if (iStack instanceof WeightedRandomItemStack) { - WeightedRandomItemStack stack = (WeightedRandomItemStack) iStack; - if (ingredient.matches(MineTweakerMC.getIItemStack(stack.getStack()))) { - removed.add(stack); - } - } - } - } - - @Override - public void apply() { - MFRRegistry.getLaserOres().removeAll(removed); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getLaserOres().addAll(removed); - } - - @Override - public String describe() { - return "Removing laser ore " + ingredient.toString(); - } - - @Override - public String describeUndo() { - return "Restoring laser ore " + ingredient.toString(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddPreferredOreAction implements IUndoableAction { - private final int color; - private final IIngredient ore; - - public AddPreferredOreAction(int color, IIngredient ore) { - this.color = color; - this.ore = ore; - } - - @Override - public void apply() { - for (IItemStack item : ore.getItems()) { - FactoryRegistry.addLaserPreferredOre(color, MineTweakerMC.getItemStack(item)); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (IItemStack item : ore.getItems()) { - ItemStack stack = MineTweakerMC.getItemStack(item); - MFRRegistry.getLaserPreferredOres(color).remove(stack); - } - } - - @Override - public String describe() { - return "Adding laser preferred ore " + ore + " to color " + color; - } - - @Override - public String describeUndo() { - return "Removing laser preferred ore " + ore + " from color " + color; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemovePreferredOreAction implements IUndoableAction { - private final int color; - private final IIngredient ore; - private final List toRemove; - - public RemovePreferredOreAction(int color, IIngredient ore) { - this.color = color; - this.ore = ore; - - toRemove = new ArrayList(); - for (ItemStack item : MFRRegistry.getLaserPreferredOres(color)) { - if (ore.matches(MineTweakerMC.getIItemStack(item))) { - toRemove.add(item); - } - } - } - - @Override - public void apply() { - MFRRegistry.getLaserPreferredOres(color).removeAll(toRemove); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getLaserPreferredOres(color).addAll(toRemove); - } - - @Override - public String describe() { - return "Removing preferred ore " + ore + " for color " + color; - } - - @Override - public String describeUndo() { - return "Adding preferred ore " + ore + " for color " + color; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Planter.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Planter.java deleted file mode 100644 index d474a16..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Planter.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.IFactoryPlantable; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.Planter") -@ModOnly("MineFactoryReloaded") -public class Planter { - private static final IBlockPattern GRASS_OR_DIRT; - - static { - IBlock blockDirt = MineTweakerMC.getBlockAnyMeta(Block.dirt); - IBlock blockGrass = MineTweakerMC.getBlockAnyMeta(Block.grass); - GRASS_OR_DIRT = blockDirt.or(blockGrass); - } - - @ZenMethod - public static void addPlantable(IItemStack seed, @Optional IBlockPattern canPlantOn) { - IBlock block = seed.asBlock(); - if (block == null) { - MineTweakerAPI.logError("The given seed has no block equivalant"); - } - addPlantable(seed, block, canPlantOn); - } - - @ZenMethod - public static void addPlantable(IIngredient seed, IBlock block, @Optional IBlockPattern canPlantOn) { - if (canPlantOn == null) { - canPlantOn = GRASS_OR_DIRT; - } - - if (seed.getItems() == null) { - MineTweakerAPI.logError("Seed must be a defined ingredient and cannot be <*>"); - } else { - MineTweakerAPI.apply(new AddPlantableAction(new TweakerPlantable(seed, block, canPlantOn))); - } - } - - @ZenMethod - public static void removePlantable(IIngredient seed) { - MineTweakerAPI.apply(new RemovePlantableAction(seed)); - } - - // ##################### - // ### Inner classes ### - // ##################### - - private static class TweakerPlantable { - private final IIngredient seed; - private final IBlock block; - private final IBlockPattern canPlantOn; - - public TweakerPlantable(IIngredient seed, IBlock block, IBlockPattern canPlantOn) { - this.seed = seed; - this.block = block; - this.canPlantOn = canPlantOn; - } - } - - private static class TweakerPlantablePartial implements IFactoryPlantable { - private final int seedId; - private final List plantables; - - public TweakerPlantablePartial(int seedId) { - this.seedId = seedId; - plantables = new ArrayList(); - } - - public TweakerPlantablePartial(int seedId, TweakerPlantable plantable) { - this(seedId); - - plantables.add(plantable); - } - - @Override - public int getSeedId() { - return seedId; - } - - @Override - public int getPlantedBlockId(World world, int i, int i1, int i2, ItemStack seed) { - IItemStack iSeed = MineTweakerMC.getIItemStack(seed); - for (TweakerPlantable plantable : plantables) { - if (plantable.seed.matches(iSeed)) - return MineTweakerMC.getBlockId(plantable.block.getDefinition()); - } - - return 1; - } - - @Override - public int getPlantedBlockMetadata(World world, int i, int i1, int i2, ItemStack seed) { - IItemStack iSeed = MineTweakerMC.getIItemStack(seed); - for (TweakerPlantable plantable : plantables) { - if (plantable.seed.matches(iSeed)) - return plantable.block.getMeta(); - } - - return 0; - } - - @Override - public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack seed) { - if (!world.isAirBlock(x, y, z)) - return false; - - for (TweakerPlantable plantable : plantables) { - if (!plantable.seed.matches(MineTweakerMC.getIItemStack(seed))) - continue; - - if (!plantable.canPlantOn.matches(MineTweakerMC.getBlock(world, x, y - 1, z))) - continue; - - return true; - } - - return false; - } - - @Override - public void prePlant(World world, int i, int i1, int i2, ItemStack is) { - - } - - @Override - public void postPlant(World world, int i, int i1, int i2, ItemStack is) { - - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddPlantableAction implements IUndoableAction { - private final TweakerPlantable plantable; - - private AddPlantableAction(TweakerPlantable plantable) { - this.plantable = plantable; - } - - @Override - public void apply() { - for (IItemStack item : plantable.seed.getItems()) { - int itemId = MineTweakerMC.getItemStack(item).itemID; - if (MFRRegistry.getPlantables().containsKey(itemId)) { - IFactoryPlantable existing = MFRRegistry.getPlantables().get(itemId); - if (existing instanceof TweakerPlantablePartial) { - ((TweakerPlantablePartial) existing).plantables.add(plantable); - } else { - MineTweakerAPI.logError("Existing non-MineTweaker plantable already exists for seed ID " + itemId); - } - } else { - FactoryRegistry.registerPlantable(new TweakerPlantablePartial(itemId, plantable)); - } - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (IItemStack item : plantable.seed.getItems()) { - int itemId = MineTweakerMC.getItemStack(item).itemID; - IFactoryPlantable existing = MFRRegistry.getPlantables().get(itemId); - if (existing instanceof TweakerPlantablePartial) { - ((TweakerPlantablePartial) existing).plantables.remove(plantable); - } - } - } - - @Override - public String describe() { - return "Adding MFR Plantable for seed " + plantable.seed; - } - - @Override - public String describeUndo() { - return "Removing MFR Plantable for seed " + plantable.seed; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemovePlantableAction implements IUndoableAction { - private final IIngredient seed; - private final Map removed; - - private RemovePlantableAction(IIngredient seed) { - this.seed = seed; - - removed = new HashMap(); - for (IItemStack item : seed.getItems()) { - int itemId = MineTweakerMC.getItemStack(item).itemID; - if (!removed.containsKey(itemId)) { - if (MFRRegistry.getPlantables().containsKey(itemId)) { - removed.put(itemId, MFRRegistry.getPlantables().get(itemId)); - } - } - } - } - - @Override - public void apply() { - for (Integer seedId : removed.keySet()) { - MFRRegistry.getPlantables().remove(seedId); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (Map.Entry removedEntry : removed.entrySet()) { - MFRRegistry.getPlantables().put(removedEntry.getKey(), removedEntry.getValue()); - } - } - - @Override - public String describe() { - return "Removing MFR Planter seed " + seed; - } - - @Override - public String describeUndo() { - return "Restoring MFR Planter seed " + seed; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Rancher.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Rancher.java deleted file mode 100644 index 168b224..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Rancher.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.liquid.WeightedLiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.mc164.util.MineTweakerPlatformUtils.getLivingEntityClass; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidContainerRegistry; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.IFactoryRanchable; -import powercrystals.minefactoryreloaded.api.RanchedItem; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.AutoSpawner") -@ModOnly("MineFactoryReloaded") -public class Rancher { - private static final Random random = new Random(); - - @ZenMethod - public static void addRanchable(String entityClassName, WeightedItemStack[] possibleDrops, @Optional WeightedLiquidStack[] possibleLiquids) { - if (possibleLiquids == null) - possibleLiquids = new WeightedLiquidStack[0]; - - Class entityClass = getLivingEntityClass(entityClassName); - MineTweakerAPI.apply(new AddRanchableAction(new TweakerRanchable(entityClass, possibleDrops, possibleLiquids))); - } - - @ZenMethod - public static void removeRanchable(String entityClassName) { - Class entityClass = getLivingEntityClass(entityClassName); - if (!MFRRegistry.getRanchables().containsKey(entityClass)) { - MineTweakerAPI.logWarning("No such ranchable: " + entityClassName); - } else { - MineTweakerAPI.apply(new RemoveRanchableAction(MFRRegistry.getRanchables().get(entityClass))); - } - } - - // ####################### - // ### Private classes ### - // ####################### - - private static class TweakerRanchable implements IFactoryRanchable { - private final Class entityClass; - private final WeightedItemStack[] possibleDrops; - private final WeightedLiquidStack[] possibleLiquids; - - public TweakerRanchable(Class entityClass, WeightedItemStack[] possibleDrops, WeightedLiquidStack[] possibleLiquids) { - this.entityClass = entityClass; - this.possibleDrops = possibleDrops; - this.possibleLiquids = possibleLiquids; - } - - @Override - public Class getRanchableEntity() { - return entityClass; - } - - @Override - public List ranch(World world, EntityLivingBase entity, IInventory inventory) { - List result = new ArrayList(); - if (entityClass.isAssignableFrom(entity.getClass())) { - for (IItemStack droppedItem : WeightedItemStack.pickRandomDrops(random, possibleDrops)) { - result.add(new RanchedItem(MineTweakerMC.getItemStack(droppedItem))); - } - - for (ILiquidStack droppedLiquid : WeightedLiquidStack.pickRandomDrops(random, possibleLiquids)) { - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack stack = inventory.getStackInSlot(i); - if (stack != null) { - ItemStack filled = FluidContainerRegistry.fillFluidContainer(MineTweakerMC.getLiquidStack(droppedLiquid), stack); - if (filled != null) { - inventory.setInventorySlotContents(i, filled); - break; - } - } - } - } - } - - return result; - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRanchableAction implements IUndoableAction { - private final TweakerRanchable ranchable; - - public AddRanchableAction(TweakerRanchable ranchable) { - this.ranchable = ranchable; - } - - @Override - public void apply() { - FactoryRegistry.registerRanchable(ranchable); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getRanchables().remove(ranchable.entityClass); - } - - @Override - public String describe() { - return "Adding ranchable entity " + ranchable.entityClass.getName(); - } - - @Override - public String describeUndo() { - return "Removing ranchable entity " + ranchable.entityClass.getName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveRanchableAction implements IUndoableAction { - private final IFactoryRanchable ranchable; - - public RemoveRanchableAction(IFactoryRanchable ranchable) { - this.ranchable = ranchable; - } - - @Override - public void apply() { - MFRRegistry.getRanchables().remove(ranchable.getRanchableEntity()); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getRanchables().put(ranchable.getRanchableEntity(), ranchable); - } - - @Override - public String describe() { - return "Removing ranchable entity " + ranchable.getRanchableEntity().getName(); - } - - @Override - public String describeUndo() { - return "Restoring ranchable entity " + ranchable.getRanchableEntity().getName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/RedNet.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/RedNet.java deleted file mode 100644 index 3c61ccc..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/RedNet.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import net.minecraft.nbt.NBTTagCompound; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import powercrystals.minefactoryreloaded.api.rednet.IRedNetLogicCircuit; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.RedNet") -@ModOnly("MineFactoryReloaded") -public class RedNet { - @ZenMethod - public static void addCircuit(String name, String[] inputs, String[] outputs, IRedNetFunction function) { - MineTweakerAPI.apply(new AddCircuitAction(new TweakerRedNetLogicCircuit(name, inputs, outputs, function))); - } - - @ZenMethod - public static void removeCircuit(String name) { - List toRemove = new ArrayList(); - for (IRedNetLogicCircuit circuit : MFRRegistry.getRedNetLogicCircuits()) { - if (circuit.getUnlocalizedName().equals(name)) { - toRemove.add(circuit); - } - } - - if (toRemove.isEmpty()) { - MineTweakerAPI.logWarning("No such rednet circuit: " + name); - } else { - for (IRedNetLogicCircuit toRemoveEntry : toRemove) { - MineTweakerAPI.apply(new RemoveCircuitAction(toRemoveEntry)); - } - } - } - - // ############################# - // ### Private inner classes ### - // ############################# - - private static class TweakerRedNetLogicCircuit implements IRedNetLogicCircuit { - private final String name; - private final String[] inputs; - private final String[] outputs; - private final IRedNetFunction function; - - public TweakerRedNetLogicCircuit(String name, String[] inputs, String[] outputs, IRedNetFunction function) { - this.name = name; - this.inputs = inputs; - this.outputs = outputs; - this.function = function; - } - - @Override - public int getInputCount() { - return inputs.length; - } - - @Override - public int getOutputCount() { - return outputs.length; - } - - @Override - public int[] recalculateOutputValues(long l, int[] ints) { - return function.calculate(l, ints); - } - - @Override - public String getUnlocalizedName() { - return name; - } - - @Override - public String getInputPinLabel(int i) { - return inputs[i]; - } - - @Override - public String getOutputPinLabel(int i) { - return outputs[i]; - } - - @Override - public void readFromNBT(NBTTagCompound nbttc) { - } - - @Override - public void writeToNBT(NBTTagCompound nbttc) { - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddCircuitAction implements IUndoableAction { - private final TweakerRedNetLogicCircuit circuit; - - public AddCircuitAction(TweakerRedNetLogicCircuit circuit) { - this.circuit = circuit; - } - - @Override - public void apply() { - FactoryRegistry.registerRedNetLogicCircuit(circuit); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getRedNetLogicCircuits().remove(circuit); - } - - @Override - public String describe() { - return "Adding rednet circuit " + circuit.name; - } - - @Override - public String describeUndo() { - return "Removing rednet circuit " + circuit.name; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveCircuitAction implements IUndoableAction { - private final IRedNetLogicCircuit circuit; - - public RemoveCircuitAction(IRedNetLogicCircuit circuit) { - this.circuit = circuit; - } - - @Override - public void apply() { - MFRRegistry.getRedNetLogicCircuits().remove(circuit); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getRedNetLogicCircuits().add(circuit); - } - - @Override - public String describe() { - return "Removing RedNet circuit " + circuit.getUnlocalizedName(); - } - - @Override - public String describeUndo() { - return "Restoring RedNet circuit " + circuit.getUnlocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/RubberTree.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/RubberTree.java deleted file mode 100644 index ce42cac..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/RubberTree.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.RubberTree") -@ModOnly("MineFactoryReloaded") -public class RubberTree { - @ZenMethod - public static void addBiome(String biome) { - MineTweakerAPI.apply(new AddBiomeAction(biome)); - } - - @ZenMethod - public static void removeBiome(String biome) { - MineTweakerAPI.apply(new RemoveBiomeAction(biome)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddBiomeAction implements IUndoableAction { - private final String biome; - - public AddBiomeAction(String biome) { - this.biome = biome; - } - - @Override - public void apply() { - FactoryRegistry.registerRubberTreeBiome(biome); - } - - @Override - public boolean canUndo() { - return MFRRegistry.getRubberTreeBiomes() != null; - } - - @Override - public void undo() { - MFRRegistry.getRubberTreeBiomes().remove(biome); - } - - @Override - public String describe() { - return "Adding rubber tree biome " + biome; - } - - @Override - public String describeUndo() { - return "Removing rubber tree biome " + biome; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveBiomeAction implements IUndoableAction { - private final String biome; - - private RemoveBiomeAction(String biome) { - this.biome = biome; - } - - @Override - public void apply() { - MFRRegistry.getRubberTreeBiomes().remove(biome); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getRubberTreeBiomes().add(biome); - } - - @Override - public String describe() { - return "Removing rubber tree biome " + biome; - } - - @Override - public String describeUndo() { - return "Adding rubber tree biome " + biome; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/SafariNet.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/SafariNet.java deleted file mode 100644 index 8413270..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/SafariNet.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import static minetweaker.mc164.util.MineTweakerPlatformUtils.getLivingEntityClass; -import powercrystals.minefactoryreloaded.MFRRegistry; -import powercrystals.minefactoryreloaded.api.FactoryRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.AutoSpawner") -@ModOnly("MineFactoryReloaded") -public class SafariNet { - @ZenMethod - public static void addBlacklist(String entityClassName) { - Class entityClass = getLivingEntityClass(entityClassName); - MineTweakerAPI.apply(new AddBlacklistAction(entityClass)); - } - - @ZenMethod - public static void removeBlacklist(String entityClassName) { - Class entityClass = getLivingEntityClass(entityClassName); - if (!MFRRegistry.getSafariNetBlacklist().contains(entityClass)) { - MineTweakerAPI.logWarning(entityClassName + " is not in the safari net blacklist"); - } else { - MineTweakerAPI.apply(new RemoveBlacklistAction(entityClass)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddBlacklistAction implements IUndoableAction { - private final Class entityClass; - - public AddBlacklistAction(Class entityClass) { - this.entityClass = entityClass; - } - - @Override - public void apply() { - FactoryRegistry.registerSafariNetBlacklist(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getSafariNetBlacklist().remove(entityClass); - } - - @Override - public String describe() { - return "Blacklisting " + entityClass.getName() + " in the safari net"; - } - - @Override - public String describeUndo() { - return "Removing " + entityClass.getName() + " from the safari net blacklist"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveBlacklistAction implements IUndoableAction { - private final Class entityClass; - - public RemoveBlacklistAction(Class entityClass) { - this.entityClass = entityClass; - } - - @Override - public void apply() { - MFRRegistry.getSafariNetBlacklist().remove(entityClass); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getSafariNetBlacklist().add(entityClass); - } - - @Override - public String describe() { - return "Removing " + entityClass.getName() + " from the safari net blacklist"; - } - - @Override - public String describeUndo() { - return "Restoring " + entityClass.getName() + " to the safari net blacklist"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/SludgeBoiler.java b/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/SludgeBoiler.java deleted file mode 100644 index e70db19..0000000 --- a/MineTweaker3-MC164-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/SludgeBoiler.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.mfr.machines; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.util.WeightedRandomItem; -import powercrystals.core.random.WeightedRandomItemStack; -import powercrystals.minefactoryreloaded.MFRRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.mfr.SludgeBoiler") -@ModOnly("MineFactoryReloaded") -public class SludgeBoiler { - @ZenMethod - public static void addDrop(WeightedItemStack item) { - MineTweakerAPI.apply(new AddDropAction(item)); - } - - @ZenMethod - public static void removeDrop(IIngredient item) { - if (MFRRegistry.getSludgeDrops() == null) { - MineTweakerAPI.logWarning("Cannot remove drops from the sludge boiler"); - } else { - MineTweakerAPI.apply(new RemoveDropAction(item)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddDropAction implements IUndoableAction { - private final WeightedRandomItemStack item; - - public AddDropAction(WeightedItemStack item) { - this.item = new WeightedRandomItemStack((int) item.getChance(), MineTweakerMC.getItemStack(item.getStack())); - } - - @Override - public void apply() { - MFRRegistry.getSludgeDrops().add(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - MFRRegistry.getSludgeDrops().remove(item); - } - - @Override - public String describe() { - return "Adding sludge boiler drop " + item.getStack().getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing sludge boiler drop " + item.getStack().getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveDropAction implements IUndoableAction { - private final IIngredient item; - private final List toRemove; - - private RemoveDropAction(IIngredient item) { - this.item = item; - - toRemove = new ArrayList(); - for (WeightedRandomItem iStack : MFRRegistry.getSludgeDrops()) { - if (iStack instanceof WeightedRandomItemStack) { - WeightedRandomItemStack itemStack = (WeightedRandomItemStack) iStack; - if (item.matches(MineTweakerMC.getIItemStack(itemStack.getStack()))) { - toRemove.add(itemStack); - } - } - } - } - - @Override - public void apply() { - for (WeightedRandomItemStack itemStack : toRemove) { - MFRRegistry.getSludgeDrops().remove(itemStack); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (WeightedRandomItemStack item : toRemove) { - MFRRegistry.getSludgeDrops().add(item); - } - } - - @Override - public String describe() { - return "Removing " + toRemove.size() + " sludge boiler drops for " + item; - } - - @Override - public String describeUndo() { - return "Restoring " + toRemove.size() + " sludge boiler drops for " + item; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC164-Mod-NEI/build.gradle b/MineTweaker3-MC164-Mod-NEI/build.gradle deleted file mode 100644 index 4140312..0000000 --- a/MineTweaker3-MC164-Mod-NEI/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion164 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC164-Main') - compile files('libs/NotEnoughItems-dev 1.6.1.9.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.nei.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC164-Mod-NEI/libs/NotEnoughItems-dev 1.6.1.9.jar b/MineTweaker3-MC164-Mod-NEI/libs/NotEnoughItems-dev 1.6.1.9.jar deleted file mode 100644 index d43ad18..0000000 Binary files a/MineTweaker3-MC164-Mod-NEI/libs/NotEnoughItems-dev 1.6.1.9.jar and /dev/null differ diff --git a/MineTweaker3-MC164-Mod-NEI/src/main/java/minetweaker/mods/nei/NEI.java b/MineTweaker3-MC164-Mod-NEI/src/main/java/minetweaker/mods/nei/NEI.java deleted file mode 100644 index 2b8c521..0000000 --- a/MineTweaker3-MC164-Mod-NEI/src/main/java/minetweaker/mods/nei/NEI.java +++ /dev/null @@ -1,165 +0,0 @@ -package minetweaker.mods.nei; - -import codechicken.nei.api.API; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; - -/** - * MineTweaker NEI support. - * - * Enables hiding NEI items as well as adding new item stacks. These item stacks - * can then show a custom message or contain NBT data. Can be used to show - * a custom message or lore with certain items, or to provide spawnable items - * with specific NBT tags. - * - * @author Stan Hebben - */ -@ZenClass("mods.nei.NEI") -@ModOnly("NotEnoughItems") -public class NEI { - /** - * Hides a specific item in NEI. Will take into account metadata values, if - * any. - * - * @param item item to be hidden - */ - @ZenMethod - public static void hide(@NotNull IItemStack item) { - MineTweakerAPI.apply(new NEIHideItemAction(getItemStack(item))); - } - - /** - * Adds a NEI entry. The item stack can contain damage values and NBT tags. - * - * @param stack item stack to be added - */ - @ZenMethod - public static void addEntry(@NotNull IItemStack stack) { - MineTweakerAPI.apply(new NEIAddEntryAction(getItemStack(stack))); - } - - /** - * Overrides a name in NEI. Note that this will not change the original - * display name, but it will change the way it is displayed in NEI. - * - * @param item item - * @param name item name - */ - @ZenMethod - public static void overrideName(@NotNull IItemStack item, @NotNull String name) { - MineTweakerAPI.apply(new NEIOverrideNameAction(getItemStack(item), name)); - } - - // ############################# - // ### Private inner classes ### - // ############################# - - private static class NEIAddEntryAction implements IUndoableAction { - private final ItemStack item; - - public NEIAddEntryAction(ItemStack item) { - this.item = item; - } - - @Override - public void apply() { - API.addNBTItem(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - API.hideItem(item.itemID); - } - - @Override - public String describe() { - return "Adding " + item.getDisplayName() + " as NEI entry"; - } - - @Override - public String describeUndo() { - return "Removing " + item.getDisplayName() + " as NEI entry"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class NEIHideItemAction implements IUndoableAction { - private final ItemStack stack; - - public NEIHideItemAction(ItemStack stack) { - this.stack = stack; - } - - @Override - public void apply() { - API.hideItem(stack.itemID); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - API.addNBTItem(stack); - } - - @Override - public String describe() { - return "Hiding " + stack.getUnlocalizedName() + " in NEI"; - } - - @Override - public String describeUndo() { - return "Displaying " + stack.getUnlocalizedName() + " in NEI"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class NEIOverrideNameAction extends OneWayAction { - private final ItemStack item; - private final String name; - - public NEIOverrideNameAction(ItemStack item, String name) { - this.item = item; - this.name = name; - } - - @Override - public void apply() { - API.setOverrideName(item.itemID, item.getItemDamage(), name); - } - - @Override - public String describe() { - return "Overriding NEI item name of " + item.getUnlocalizedName() + " to " + name; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC1710-Main/build.gradle b/MineTweaker3-MC1710-Main/build.gradle index 4d8ec37..6d690e3 100644 --- a/MineTweaker3-MC1710-Main/build.gradle +++ b/MineTweaker3-MC1710-Main/build.gradle @@ -19,13 +19,13 @@ buildscript { apply plugin: 'forge' +version = "1.7.10-" + ext.mineTweakerVersion +archivesBaseName = project.projectDir.name + minecraft { version = forgeVersion1710 } -version = "1.7.10-" + ext.mineTweakerVersion -archivesBaseName = project.projectDir.name - dependencies { dependencies { compile project(':ZenScript') diff --git a/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/MineTweakerMod.java b/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/MineTweakerMod.java index a90f92c..cf7f958 100644 --- a/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/MineTweakerMod.java +++ b/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/MineTweakerMod.java @@ -155,9 +155,8 @@ public class MineTweakerMod { public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { // starts before loading worlds // perfect place to start MineTweaker! - for (String itemName : (Set) Item.itemRegistry.getKeys()) { - ItemBracketHandler.itemNames.put(itemName.replace(" ", ""), (Item) Item.itemRegistry.getObject(itemName)); - } + ItemBracketHandler.rebuildItemRegistry(); + if (MineTweakerPlatformUtils.isClient()) { MineTweakerAPI.client = new MCClient(); } diff --git a/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/brackets/ItemBracketHandler.java b/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/brackets/ItemBracketHandler.java index c32eb5f..9143ab3 100644 --- a/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/brackets/ItemBracketHandler.java +++ b/MineTweaker3-MC1710-Main/src/main/java/minetweaker/mc1710/brackets/ItemBracketHandler.java @@ -36,8 +36,18 @@ import stanhebben.zenscript.util.ZenPosition; */ @BracketHandler(priority = 100) public class ItemBracketHandler implements IBracketHandler { - public static final Map itemNames = new HashMap(); + private static final Map itemNames = new HashMap(); + @SuppressWarnings("unchecked") + public static void rebuildItemRegistry() + { + itemNames.clear(); + + for (String itemName : (Set) Item.itemRegistry.getKeys()) { + itemNames.put(itemName.replace(" ", ""), (Item) Item.itemRegistry.getObject(itemName)); + } + } + public static IItemStack getItem(String name, int meta) { // Item item = (Item) Item.itemRegistry.getObject(name); Item item = itemNames.get(name); diff --git a/MineTweaker3-MC1710-Mod-GregTech/build.gradle b/MineTweaker3-MC1710-Mod-GregTech/build.gradle deleted file mode 100644 index 3ec4d53..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion1710 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC1710-Main') - compile files('libs/gregtech_1.7.10-5.08.25-dev.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.gregtech.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech-1.7.10-api.jar b/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech-1.7.10-api.jar deleted file mode 100644 index 574dacc..0000000 Binary files a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech-1.7.10-api.jar and /dev/null differ diff --git a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech-1.7.10-dev.jar b/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech-1.7.10-dev.jar deleted file mode 100644 index e91e926..0000000 Binary files a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech-1.7.10-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech_1.7.10-5.05.11-dev.jar b/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech_1.7.10-5.05.11-dev.jar deleted file mode 100644 index 69a048b..0000000 Binary files a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech_1.7.10-5.05.11-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech_1.7.10-5.08.25-dev.jar b/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech_1.7.10-5.08.25-dev.jar deleted file mode 100644 index e9650c2..0000000 Binary files a/MineTweaker3-MC1710-Mod-GregTech/libs/gregtech_1.7.10-5.08.25-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java deleted file mode 100644 index 981c3b7..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java +++ /dev/null @@ -1,112 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the Alloy Smelter recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.AlloySmelter") -@ModOnly("gregtech") -public class AlloySmelter { - /** - * Adds an alloy smelter recipe. - * - * @param output alloy smelter output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks smelting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GT_Values.RA.addAlloySmelterRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding alloy smelter recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 53 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java deleted file mode 100644 index 9bd9f21..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java +++ /dev/null @@ -1,95 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the amplifabricator. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Amplifabricator") -@ModOnly("gregtech") -public class Amplifabricator { - /** - * Adds an amplifier. - * - * @param item amplifier item - * @param durationTicks duration in ticks - * @param amount amplification amount - */ - @ZenMethod - public static void addAmplifier(IItemStack item, int durationTicks, int amount) { - MineTweakerAPI.apply(new AddAmplifierAction(item, durationTicks, amount)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddAmplifierAction extends OneWayAction { - private final IItemStack item; - private final int duration; - private final int amount; - - public AddAmplifierAction(IItemStack item, int duration, int amount) { - this.item = item; - this.duration = duration; - this.amount = amount; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAmplifier( - MineTweakerMC.getItemStack(item), - duration, - amount); - } - - @Override - public String describe() { - return "Adding amplifier " + item; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.item != null ? this.item.hashCode() : 0); - hash = 59 * hash + this.duration; - hash = 59 * hash + this.amount; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddAmplifierAction other = (AddAmplifierAction) obj; - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.amount != other.amount) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ArcFurnace.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ArcFurnace.java deleted file mode 100644 index e9a2126..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ArcFurnace.java +++ /dev/null @@ -1,64 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.ArcFurnace") -public class ArcFurnace { - private static final class AddRecipeAction extends OneWayAction { - private IItemStack[] outputs; - private IItemStack input; - private ILiquidStack lInput; - private int[] chances; - private int dur; - private int euT; - private boolean reqPlasma; - - public AddRecipeAction(IItemStack[] outputs, IItemStack input, ILiquidStack lInput, int[] chances, int dur, int euT, boolean reqPlasma) { - this.outputs = outputs; - this.input = input; - this.lInput = lInput; - this.chances = chances; - this.dur = dur; - this.euT = euT; - this.reqPlasma = reqPlasma; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding " + input.getDisplayName() + " to Arc Furnace"; - } - - @Override - public void apply() { - if(reqPlasma) { - RA.addSimpleArcFurnaceRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getItemStacks(outputs) - , chances, dur, euT); - } else { - RA.addPlasmaArcFurnaceRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getItemStacks(outputs) - , chances, dur, euT); - } - } - } - - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, ILiquidStack lInput, int[] chances, int dur, int euT, boolean reqPlasma) { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, lInput, chances, dur, euT, reqPlasma)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java deleted file mode 100644 index 19ca6f9..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java +++ /dev/null @@ -1,155 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the assembler recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Assembler") -@ModOnly("gregtech") -public class Assembler { - /** - * Adds an assemble recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks assembling duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, ILiquidStack lInput, int dur, int euT) { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, input1, input2, lInput, dur, euT)); - } - private static final class AddFluidRecipeAction extends OneWayAction { - private IItemStack output; - private IItemStack input1; - private IItemStack input2; - private ILiquidStack lInput; - private int dur; - private int euT; - - public AddFluidRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, ILiquidStack lInput, - int dur, int euT) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.lInput = lInput; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding circuit assembler recipe w/ fluids"; - } - - @Override - public void apply() { - RA.addAssemblerRecipe(MineTweakerMC.getItemStack(input1) - , MineTweakerMC.getItemStack(input2) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAssemblerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding assembler recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Autoclave.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Autoclave.java deleted file mode 100644 index 4275528..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Autoclave.java +++ /dev/null @@ -1,56 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Autoclave") -public class Autoclave { - private static final class AddAutoclavingAction extends OneWayAction { - private IItemStack output; - private IItemStack input; - private ILiquidStack lInput; - private int chance; - private int dur; - private int euT; - - public AddAutoclavingAction(IItemStack output, IItemStack input, ILiquidStack lInput, int chance, int dur, - int euT) { - this.output = output; - this.input = input; - this.lInput = lInput; - this.chance = chance; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding autoclaving for " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addAutoclaveRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getItemStack(output) - , chance, dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, ILiquidStack lInput, int chance, int dur, int euT) { - MineTweakerAPI.apply(new AddAutoclavingAction(output, input, lInput, chance, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java deleted file mode 100644 index acf4125..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java +++ /dev/null @@ -1,198 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Blast Furnace recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.BlastFurnace") -@ModOnly("gregtech") -public class BlastFurnace { - /** - * Adds a recipe with a single output. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - * @param heat required heat capacity - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, null, durationTicks, euPerTick, heat)); - } - - /** - * Adds a recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - * @param heat required heat capacity - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { - if (output.length == 0) { - MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output[0], output.length > 1 ? output[1] : null, durationTicks, euPerTick, heat)); - } - } - - public static void addRecipe(IItemStack output1, IItemStack output2, ILiquidStack lOutput, ILiquidStack lInput, IItemStack input1, IItemStack input2, int dur, int euT, int level) { - MineTweakerAPI.apply(new AddFluidRecipeAction(output1, output2, lOutput, lInput, input1, input2, dur, euT, level)); - } - - private static final class AddFluidRecipeAction extends OneWayAction { - private IItemStack output1; - private IItemStack output2; - private ILiquidStack lOutput; - private IItemStack input1; - private IItemStack input2; - private int dur; - private int euT; - private int level; - private ILiquidStack lInput; - - public AddFluidRecipeAction(IItemStack output1, IItemStack output2, ILiquidStack lOutput, ILiquidStack lInput, - IItemStack input1, IItemStack input2, int dur, int euT, int level) { - this.output1 = output1; - this.output2 = output2; - this.lOutput = lOutput; - this.lInput = lInput; - this.input1 = input1; - this.input2 = input2; - this.dur = dur; - this.euT = euT; - this.level = level; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Added blast furnace recipe w/ liquids"; - } - - @Override - public void apply() { - RA.addBlastRecipe(MineTweakerMC.getItemStack(input1) - , MineTweakerMC.getItemStack(input2) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getLiquidStack(lOutput) - , MineTweakerMC.getItemStack(output1) - , MineTweakerMC.getItemStack(output2) - , dur, euT, level); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack input1; - private final IItemStack input2; - private final IItemStack output1; - private final IItemStack output2; - private final int duration; - private final int euPerTick; - private final int heat; - - public AddRecipeAction(IItemStack input1, IItemStack input2, IItemStack output1, IItemStack output2, int duration, int euPerTick, int heat) { - this.input1 = input1; - this.input2 = input2; - this.output1 = output1; - this.output2 = output2; - this.duration = duration; - this.euPerTick = euPerTick; - this.heat = heat; - } - - @Override - public void apply() { - RA.addBlastRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick, - heat); - } - - @Override - public String describe() { - return "Adding blast furnace recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 89 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 89 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 89 * hash + this.duration; - hash = 89 * hash + this.euPerTick; - hash = 89 * hash + this.heat; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.heat != other.heat) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java deleted file mode 100644 index c5d0d25..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java +++ /dev/null @@ -1,199 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the boxing and unboxing recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Boxing") -@ModOnly("gregtech") -public class Boxing { - /** - * Adds a boxing recipe. - * - * @param fullBox the full box - * @param item the item to be packed - * @param emptyBox empty box - * @param durationTicks boxing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addBoxingRecipe(IItemStack fullBox, IItemStack item, IItemStack emptyBox, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddBoxingAction(fullBox, item, emptyBox, durationTicks, euPerTick)); - } - - /** - * Adds an unboxing recipe. - * - * @param item the item after unpacking - * @param emptyBox the empty box after unpacking - * @param fullBox full box - * @param durationTicks unboxing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addUnboxingRecipe(IItemStack item, IItemStack emptyBox, IItemStack fullBox, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddUnboxingAction(item, emptyBox, fullBox, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddBoxingAction extends OneWayAction { - private final IItemStack fullBox; - private final IItemStack item; - private final IItemStack emptyBox; - private final int duration; - private final int euPerTick; - - public AddBoxingAction(IItemStack fullBox, IItemStack item, IItemStack emptyBox, int duration, int euPerTick) { - this.fullBox = fullBox; - this.item = item; - this.emptyBox = emptyBox; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBoxingRecipe( - MineTweakerMC.getItemStack(item), - MineTweakerMC.getItemStack(emptyBox), - MineTweakerMC.getItemStack(fullBox), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding boxing recipe to pack " + item + " in " + emptyBox; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.fullBox != null ? this.fullBox.hashCode() : 0); - hash = 89 * hash + (this.item != null ? this.item.hashCode() : 0); - hash = 89 * hash + (this.emptyBox != null ? this.emptyBox.hashCode() : 0); - hash = 89 * hash + this.duration; - hash = 89 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBoxingAction other = (AddBoxingAction) obj; - if (this.fullBox != other.fullBox && (this.fullBox == null || !this.fullBox.equals(other.fullBox))) { - return false; - } - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - if (this.emptyBox != other.emptyBox && (this.emptyBox == null || !this.emptyBox.equals(other.emptyBox))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } - - private static class AddUnboxingAction extends OneWayAction { - private final IItemStack item; - private final IItemStack emptyBox; - private final IItemStack fullBox; - private final int duration; - private final int euPerTick; - - public AddUnboxingAction(IItemStack item, IItemStack emptyBox, IItemStack fullBox, int duration, int euPerTick) { - this.item = item; - this.emptyBox = emptyBox; - this.fullBox = fullBox; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addUnboxingRecipe( - MineTweakerMC.getItemStack(fullBox), - MineTweakerMC.getItemStack(item), - MineTweakerMC.getItemStack(emptyBox), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding unboxing recipe to unbox " + fullBox; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 83 * hash + (this.item != null ? this.item.hashCode() : 0); - hash = 83 * hash + (this.emptyBox != null ? this.emptyBox.hashCode() : 0); - hash = 83 * hash + (this.fullBox != null ? this.fullBox.hashCode() : 0); - hash = 83 * hash + this.duration; - hash = 83 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddUnboxingAction other = (AddUnboxingAction) obj; - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - if (this.emptyBox != other.emptyBox && (this.emptyBox == null || !this.emptyBox.equals(other.emptyBox))) { - return false; - } - if (this.fullBox != other.fullBox && (this.fullBox == null || !this.fullBox.equals(other.fullBox))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BrewingMachine.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BrewingMachine.java deleted file mode 100644 index 22093fb..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BrewingMachine.java +++ /dev/null @@ -1,51 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.BrewingMachine") -public class BrewingMachine { - private static final class AddBrewingRecipeAction extends OneWayAction { - private boolean hidden; - private IItemStack catalyst; - private ILiquidStack input; - private ILiquidStack output; - - public AddBrewingRecipeAction(ILiquidStack output, ILiquidStack input, IItemStack catalyst, boolean hidden) { - this.output = output; - this.input = input; - this.catalyst = catalyst; - this.hidden = hidden; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding recipe for brewing " + output.getDisplayName(); - } - - @Override - public void apply() { - RA.addBrewingRecipe(MineTweakerMC.getItemStack(catalyst) - , MineTweakerMC.getLiquidStack(input).getFluid() - , MineTweakerMC.getLiquidStack(output).getFluid() - , hidden); - } - } - - @ZenMethod - public static void addBrewingRecipe(ILiquidStack output, ILiquidStack input, IItemStack catalyst, boolean hidden) { - MineTweakerAPI.apply(new AddBrewingRecipeAction(output, input, catalyst, hidden)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java deleted file mode 100644 index e40021d..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the CNC recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.CNC") -@ModOnly("gregtech") -public class CNC { - /** - * Adds a CNC recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCNCRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding CNC recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java deleted file mode 100644 index 8e276a1..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java +++ /dev/null @@ -1,136 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the Canner recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Canner") -@ModOnly("gregtech") -public class Canner { - /** - * Adds a canner recipe with a single output. - * - * @param output crafting output - * @param input1 primary input - * @param input2 secondary input (optional - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, durationTicks, euPerTick)); - } - - /** - * Adds a canner recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - if (output.length == 0) { - MineTweakerAPI.logError("canner requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCannerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding canner recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 79 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java deleted file mode 100644 index 9444586..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java +++ /dev/null @@ -1,194 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; - -import static gregtech.api.enums.GT_Values.RA; - -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.gregtech.Centrifuge") -@ModOnly("gregtech") -public class Centrifuge { - /** - * Adds a centrifuge recipe. - * - * @param outputs array with 1-6 outputs - * @param input recipe input - * @param cells number of cells required, can be 0 - * @param durationTicks centrifuging time, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks)); - } - } - - /** - * Adds a centrifuge recipe taking a fuel can as container. - * - * @param outputs array with 1-6 outputs - * @param input recipe input - * @param duration centrifuging time, in ticks - */ - @ZenMethod - public static void addRecipeFuelCan(IItemStack[] outputs, IItemStack input, int numCans, int duration) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, -numCans, duration)); - } - } - - @ZenMethod - public static void addRecipe(IItemStack[] outputs, ILiquidStack lOutput, IItemStack input1, IItemStack input2, ILiquidStack lInput, int[] chances, int durationTicks, int euPt) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddFluidRecipeAction(outputs, lOutput, input1, input2, lInput, chances, durationTicks, euPt)); - } - } - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IItemStack input; - private final int cells; - private final int duration; - - public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - } - - @Override - public void apply() { - RA.addCentrifugeRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - duration); - } - - @Override - public String describe() { - return "Adding centrifuge recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 59 * hash + Arrays.deepHashCode(this.output); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.cells; - hash = 59 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } - - private static class AddFluidRecipeAction extends OneWayAction { - - private IItemStack[] output; - private ILiquidStack lOutput; - private IItemStack input; - private ILiquidStack lInput; - private int durationTicks; - private int euPt; - private IItemStack input2; - private int[] chances; - - public AddFluidRecipeAction(IItemStack[] outputs, ILiquidStack lOutput, IItemStack input1, IItemStack input2, - ILiquidStack lInput, int[] chances, int durationTicks, int euPt) { - this.output = outputs; - this.lOutput = lOutput; - this.input = input1; - this.input2 = input2; - - this.lInput = lInput; - this.chances = chances; - this.durationTicks = durationTicks; - this.euPt = euPt; - } - - @Override - public void apply() { - RA.addCentrifugeRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getLiquidStack(lInput), - MineTweakerMC.getLiquidStack(lOutput), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - chances, - durationTicks, - euPt); - } - - @Override - public String describe() { - return "Adding centrifuge recipe w/ fluids"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalBath.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalBath.java deleted file mode 100644 index 01b3b10..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalBath.java +++ /dev/null @@ -1,63 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.ChemicalBath") -public class ChemicalBath { - private static final class AddFluidBathingAction extends OneWayAction { - private IItemStack output1; - private IItemStack output2; - private IItemStack output3; - private IItemStack input; - private ILiquidStack bathingFluid; - private int[] chances; - private int dur; - private int euT; - - public AddFluidBathingAction(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack input, - ILiquidStack bathingFluid, int[] chances, int dur, int euT) { - this.output1 = output1; - this.output2 = output2; - this.output3 = output3; - this.input = input; - this.bathingFluid = bathingFluid; - this.chances = chances; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding bathing of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addChemicalBathRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getLiquidStack(bathingFluid) - , MineTweakerMC.getItemStack(output1) - , MineTweakerMC.getItemStack(output2) - , MineTweakerMC.getItemStack(output3) - , chances, dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack input, - ILiquidStack bathingFluid, int[] chances, int dur, int euT) { - MineTweakerAPI.apply(new AddFluidBathingAction(output1, output2, output3, input, bathingFluid, chances, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java deleted file mode 100644 index 4a40d81..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java +++ /dev/null @@ -1,151 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Chemical Reactor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ChemicalReactor") -@ModOnly("gregtech") -public class ChemicalReactor { - /** - * Adds a Chemical Reactor recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks reaction time, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks)); - } - - @ZenMethod - public static void addRecipe(IItemStack output, ILiquidStack lOutput, IItemStack input1, IItemStack input2, ILiquidStack lInput, int dur) { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, lOutput, input1, input2, lInput, dur)); - } - - private static final class AddFluidRecipeAction extends OneWayAction { - private IItemStack output; - private ILiquidStack lOutput; - private IItemStack input1; - private IItemStack input2; - private ILiquidStack lInput; - private int dur; - - public AddFluidRecipeAction(IItemStack output, ILiquidStack lOutput, IItemStack input1, IItemStack input2, - ILiquidStack lInput, int dur) { - this.output = output; - // TODO Auto-generated constructor stub - this.lOutput = lOutput; - this.input1 = input1; - this.input2 = input2; - this.lInput = lInput; - this.dur = dur; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding chemical reaction w/ fluids"; - } - - @Override - public void apply() { - RA.addChemicalRecipe(MineTweakerMC.getItemStack(input1) - ,MineTweakerMC.getItemStack(input2) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getLiquidStack(lOutput) - , MineTweakerMC.getItemStack(output) - , dur); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - } - - @Override - public void apply() { - RA.addChemicalRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding chemical reactor recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 11 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 11 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 11 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 11 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Cutter.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Cutter.java deleted file mode 100644 index 2a1c691..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Cutter.java +++ /dev/null @@ -1,65 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Cutter") -public class Cutter { - private static final class AddCutterRecipeAction extends OneWayAction { - private IItemStack output1; - private IItemStack output2; - private ILiquidStack lubricant; - private IItemStack input; - private int dur; - private int euT; - - public AddCutterRecipeAction(IItemStack output1, IItemStack output2, ILiquidStack lubricant, IItemStack input, - int dur, int euT) { - this.output1 = output1; - this.output2 = output2; - this.lubricant = lubricant; - this.input = input; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding cutting action for " + input.getDisplayName(); - } - - @Override - public void apply() { - if(lubricant == null) { - RA.addCutterRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(output1) - , MineTweakerMC.getItemStack(output2) - , dur, euT); - } else { - RA.addCutterRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getLiquidStack(lubricant) - , MineTweakerMC.getItemStack(output1) - , MineTweakerMC.getItemStack(output2) - , dur, euT); - } - } - } - - @ZenMethod - public static void addRecipe(IItemStack output1, IItemStack output2, ILiquidStack lubricant, - IItemStack input, int dur,int euT) { - MineTweakerAPI.apply(new AddCutterRecipeAction(output1, output2, lubricant, input, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java deleted file mode 100644 index ed67ff2..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java +++ /dev/null @@ -1,177 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; - -import static gregtech.api.enums.GT_Values.RA; - -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the distillation tower recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.DistillationTower") -@ModOnly("gregtech") -public class DistillationTower { - /** - * Adds a distillation tower recipe with a single output. - * - * @param output recipe output - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks distillation time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int cells, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input, cells, durationTicks, euPerTick)); - } - - /** - * Adds a distillation tower recipe with multiple outputs. - * - * @param outputs array with 1-4 outputs - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks distillation time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("Distillation tower recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); - } - } - - @ZenMethod - public static void addRecipe(ILiquidStack input, ILiquidStack[] outputs, IItemStack iOutput, int dur, int euT) { - MineTweakerAPI.apply(new AddFluidDistillationAction(input, outputs, iOutput, dur, euT)); - } - - private static final class AddFluidDistillationAction extends OneWayAction { - private ILiquidStack input; - private ILiquidStack[] outputs; - private IItemStack iOutput; - private int dur; - private int euT; - - public AddFluidDistillationAction(ILiquidStack input, ILiquidStack[] outputs, IItemStack iOutput, int dur, - int euT) { - this.input = input; - // TODO Auto-generated constructor stub - this.outputs = outputs; - this.iOutput = iOutput; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding fluid distillation of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addDistillationTowerRecipe(MineTweakerMC.getLiquidStack(input) - , MineTweakerMC.getLiquidStacks(outputs) - , MineTweakerMC.getItemStack(iOutput) - , dur, euT); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] outputs; - private final IItemStack input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] outputs, IItemStack input, int cells, int duration, int euPerTick) { - this.outputs = outputs; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addDistillationRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null, - duration, euPerTick); - } - - @Override - public String describe() { - return "Adding Distillation tower recipe for " + outputs[0]; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 41 * hash + Arrays.deepHashCode(this.outputs); - hash = 41 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 41 * hash + this.cells; - hash = 41 * hash + this.duration; - hash = 41 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.outputs, other.outputs)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Distillery.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Distillery.java deleted file mode 100644 index 76c6b0c..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Distillery.java +++ /dev/null @@ -1,56 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Distillery") -public class Distillery { - private static final class AddDistillationAction extends OneWayAction { - private ILiquidStack output; - private ILiquidStack input; - private IItemStack circuit; - private int dur; - private int euT; - private boolean hidden; - - public AddDistillationAction(ILiquidStack output, ILiquidStack input, IItemStack circuit, - int dur, int euT, boolean hidden) { - this.output = output; - this.input = input; - this.circuit = circuit; - this.dur = dur; - this.euT = euT; - this.hidden = hidden; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding distillation of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addDistilleryRecipe(MineTweakerMC.getItemStack(circuit) - , MineTweakerMC.getLiquidStack(input) - , MineTweakerMC.getLiquidStack(output) - , dur, euT, hidden); - } - } - - @ZenMethod - public static void addRecipe(ILiquidStack output, ILiquidStack input, IItemStack circuit, int dur, int euT, boolean hidden) { - MineTweakerAPI.apply(new AddDistillationAction(output, input, circuit, dur, euT, hidden)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ElectroMagneticSeperator.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ElectroMagneticSeperator.java deleted file mode 100644 index e06f120..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ElectroMagneticSeperator.java +++ /dev/null @@ -1,59 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.ElectroMagneticSeperator") -public class ElectroMagneticSeperator { - private static final class AddElectromagneticSeperationAction extends OneWayAction { - private IItemStack output1; - private IItemStack output2; - private IItemStack output3; - private IItemStack input; - private int[] chances; - private int dur; - private int euT; - - public AddElectromagneticSeperationAction(IItemStack output1, IItemStack output2, IItemStack output3, - IItemStack input, int[] chances, int dur, int euT) { - this.output1 = output1; - this.output2 = output2; - this.output3 = output3; - this.input = input; - this.chances = chances; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding electro-magnetic seperation of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addElectromagneticSeparatorRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(output1) - , MineTweakerMC.getItemStack(output2) - , MineTweakerMC.getItemStack(output3) - , chances, dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack input, int[] chances, - int dur, int euT) { - MineTweakerAPI.apply(new AddElectromagneticSeperationAction(output1, output2, output3, input, chances, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java deleted file mode 100644 index 8ee3f8a..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java +++ /dev/null @@ -1,188 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; - -import static gregtech.api.enums.GT_Values.RA; - -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Electrolyzer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Electrolyzer") -@ModOnly("gregtech") -public class Electrolyzer { - /** - * Adds an electrolyzer recipe. - * - * @param outputs array with 1-6 outputs - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks electrolyzing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { - if (outputs.length < 1) { - MineTweakerAPI.logError("Electrolyzer recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); - } - } - - @ZenMethod - public static void addRecipe(IItemStack[] outputs, ILiquidStack lOutput, IItemStack input1, IItemStack input2, ILiquidStack lInput, int[] chances, int durationTicks, int euPt) { - if (outputs.length < 1) { - MineTweakerAPI.logError("Electrolyzer must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddFluidRecipeAction(outputs, lOutput, input1, input2, lInput, chances, durationTicks, euPt)); - } - } - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IItemStack input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addElectrolyzerRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - duration, - cells); - } - - @Override - public String describe() { - return "Adding electrolyzer recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + Arrays.deepHashCode(this.output); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.cells; - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } - - private static class AddFluidRecipeAction extends OneWayAction { - - private IItemStack[] output; - private ILiquidStack lOutput; - private IItemStack input; - private ILiquidStack lInput; - private int durationTicks; - private int euPt; - private IItemStack input2; - private int[] chances; - - public AddFluidRecipeAction(IItemStack[] outputs, ILiquidStack lOutput, IItemStack input1, IItemStack input2, - ILiquidStack lInput, int[] chances, int durationTicks, int euPt) { - this.output = outputs; - this.lOutput = lOutput; - this.input = input1; - this.input2 = input2; - - this.lInput = lInput; - this.chances = chances; - this.durationTicks = durationTicks; - this.euPt = euPt; - } - - @Override - public void apply() { - RA.addElectrolyzerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getLiquidStack(lInput), - MineTweakerMC.getLiquidStack(lOutput), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - chances, - durationTicks, - euPt); - } - - @Override - public String describe() { - return "Adding electrolyzer recipe w/ fluids"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - } - -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java deleted file mode 100644 index 827a1fd..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java +++ /dev/null @@ -1,111 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the extruder recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Extruder") -@ModOnly("gregtech") -public class Extruder { - /** - * Adds an extruder recipe. - * - * @param output recipe output - * @param input recipe input - * @param shape shape (set stack size to 0 to prevent the shape from being consumed) - * @param durationTicks extruding time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final IItemStack shape; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, IItemStack shape, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.shape = shape; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addExtruderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(shape), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding extruder recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + (this.shape != null ? this.shape.hashCode() : 0); - hash = 67 * hash + this.duration; - hash = 67 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.shape != other.shape && (this.shape == null || !this.shape.equals(other.shape))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fermenter.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fermenter.java deleted file mode 100644 index 33e2dc6..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fermenter.java +++ /dev/null @@ -1,49 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Fermenter") -public class Fermenter { - private static final class AddFermentationAction extends OneWayAction { - private ILiquidStack input; - private ILiquidStack output; - private int dur; - private boolean hidden; - - public AddFermentationAction(ILiquidStack input, ILiquidStack output, int dur, boolean hidden) { - this.input = input; - this.output = output; - this.dur = dur; - this.hidden = hidden; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding fermentation of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addFermentingRecipe(MineTweakerMC.getLiquidStack(input) - , MineTweakerMC.getLiquidStack(output) - , dur, hidden); - } - } - - @ZenMethod - public static void addRecipe(ILiquidStack input, ILiquidStack output, int dur, boolean hidden) { - MineTweakerAPI.apply(new AddFermentationAction(input, output, dur, hidden)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidCanner.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidCanner.java deleted file mode 100644 index fb81fe6..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidCanner.java +++ /dev/null @@ -1,51 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.FluidCanner") -public class FluidCanner { - private static final class AddFluidCanningAction extends OneWayAction { - private IItemStack output; - private ILiquidStack lOutput; - private ILiquidStack lInput; - private IItemStack input; - - public AddFluidCanningAction(IItemStack output, ILiquidStack lOutput, ILiquidStack lInput, IItemStack input) { - this.output = output; - this.lOutput = lOutput; - this.lInput = lInput; - this.input = input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding canning of " + lInput.getDisplayName(); - } - - @Override - public void apply() { - RA.addFluidCannerRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(output) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getLiquidStack(lOutput)); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, ILiquidStack lOutput, IItemStack input, ILiquidStack lInput) { - MineTweakerAPI.apply(new AddFluidCanningAction(output, lOutput, lInput, input)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidHeater.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidHeater.java deleted file mode 100644 index 91b1113..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidHeater.java +++ /dev/null @@ -1,54 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.FluidHeater") -public class FluidHeater { - private static final class AddFluidHeatingAction extends OneWayAction { - private ILiquidStack output; - private ILiquidStack input; - private IItemStack circuit; - private int dur; - private int euT; - - public AddFluidHeatingAction(ILiquidStack output, ILiquidStack input, IItemStack circuit, int dur, int euT) { - this.output = output; - this.input = input; - this.circuit = circuit; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding heating of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addFluidHeaterRecipe(MineTweakerMC.getItemStack(circuit) - , MineTweakerMC.getLiquidStack(input) - , MineTweakerMC.getLiquidStack(output) - , dur, euT); - - } - } - - @ZenMethod - public static void addRecipe(ILiquidStack output, ILiquidStack input, IItemStack circuit, int dur, int euT) { - MineTweakerAPI.apply(new AddFluidHeatingAction(output, input, circuit, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidSmelter.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidSmelter.java deleted file mode 100644 index 1779441..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidSmelter.java +++ /dev/null @@ -1,56 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.FluidSmelter") -public class FluidSmelter { - private static final class AddFluidSmeltingAction extends OneWayAction { - private ILiquidStack output; - private IItemStack input; - private IItemStack remains; - private int chance; - private int dur; - private int euT; - - public AddFluidSmeltingAction(ILiquidStack output, IItemStack input, IItemStack remains, int chance, int dur, - int euT) { - this.output = output; - this.input = input; - this.remains = remains; - this.chance = chance; - this.dur = dur; - this.euT = euT; - } - - @Override - public void apply() { - RA.addFluidSmelterRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(remains) - , MineTweakerMC.getLiquidStack(output) - , chance, dur, euT); - } - - @Override - public String describe() { - return "Adding fluid smelting for " + input.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - @ZenMethod - public static void addRecipe(ILiquidStack output, IItemStack input, IItemStack remains, int chance, int dur, int euT) { - MineTweakerAPI.apply(new AddFluidSmeltingAction(output, input, remains, chance, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidSolidifier.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidSolidifier.java deleted file mode 100644 index 752e506..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FluidSolidifier.java +++ /dev/null @@ -1,53 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.FluidSolidifier") -public class FluidSolidifier { - private static final class AddFluidSolidificationAction extends OneWayAction { - private IItemStack output; - private ILiquidStack input; - private IItemStack mold; - private int dur; - private int euT; - - public AddFluidSolidificationAction(IItemStack output, ILiquidStack input, IItemStack mold, int dur, int euT) { - this.output = output; - this.input = input; - this.mold = mold; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding solidification of fluid " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addFluidSolidifierRecipe(MineTweakerMC.getItemStack(mold) - , MineTweakerMC.getLiquidStack(input) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, ILiquidStack input, IItemStack mold, int dur, int euT) { - MineTweakerAPI.apply(new AddFluidSolidificationAction(output, input, mold, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java deleted file mode 100644 index d226d0c..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Forge Hammer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ForgeHammer") -@ModOnly("gregtech") -public class ForgeHammer { - /** - * Add a Forge Hammer recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks forging duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addForgeHammerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding forge hammer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FormingPress.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FormingPress.java deleted file mode 100644 index 09a51e0..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FormingPress.java +++ /dev/null @@ -1,52 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.FormingPress") -public class FormingPress { - private static final class AddPressFormingAction extends OneWayAction { - private IItemStack output; - private IItemStack input; - private IItemStack form; - private int dur; - private int euT; - - public AddPressFormingAction(IItemStack output, IItemStack input, IItemStack form, int dur, int euT) { - this.output = output; - this.input = input; - this.form = form; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Added press forming of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addFormingPressRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(form) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack form, int dur, int euT) { - MineTweakerAPI.apply(new AddPressFormingAction(output, input, form, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java deleted file mode 100644 index 0d78f59..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java +++ /dev/null @@ -1,177 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the fuels used by the various generators. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Fuels") -@ModOnly("gregtech") -public class Fuels { - /** - * Adds a Diesel Engine fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addDieselFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 0)); - } - - /** - * Adds a Gas Turbine fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addGasTurbineFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 1)); - } - - /** - * Adds a Thermal Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addThermalGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 2)); - } - - /** - * Adds a Dense Fluid Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addDenseFluidFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 3)); - } - - /** - * Adds a Plasma Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addPlasmaGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 4)); - } - - /** - * Adds a Magic Generator fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addMagicGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 5)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private static final String[] GENERATORS = { - "diesel", - "gas turbine", - "thermal", - "dense fluid", - "plasma", - "magic" - }; - - private final IItemStack output; - private final IItemStack input; - private final int euPerMillibucket; - private final int type; - - public AddRecipeAction(IItemStack output, IItemStack input, int euPerMillibucket, int type) { - this.output = output; - this.input = input; - this.euPerMillibucket = euPerMillibucket; - this.type = type; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addFuel( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - euPerMillibucket, - type); - } - - @Override - public String describe() { - return "Adding " + GENERATORS[type] + " fuel " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.euPerMillibucket; - hash = 59 * hash + this.type; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.euPerMillibucket != other.euPerMillibucket) { - return false; - } - if (this.type != other.type) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java deleted file mode 100644 index 7804ac5..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java +++ /dev/null @@ -1,78 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the fusion reactor recipes. - * - * @author Stan Hebben (rewritten by Ben) - */ -@ZenClass("mods.gregtech.FusionReactor") -@ModOnly("gregtech") -public class FusionReactor { - /** - * Action to add a recipe to the fusion reactor - * @author ben - * - */ - private static final class AddFusionReactionAction extends OneWayAction { - private ILiquidStack output; - private ILiquidStack input1; - private ILiquidStack input2; - private int durationTicks; - private int energyPerTick; - private int startEnergy; - - public AddFusionReactionAction(ILiquidStack output, ILiquidStack input1, ILiquidStack input2, int durationTicks, - int energyPerTick, int startEnergy) { - this.output = output; - // TODO Auto-generated constructor stub - this.input1 = input1; - this.input2 = input2; - this.durationTicks = durationTicks; - this.energyPerTick = energyPerTick; - this.startEnergy = startEnergy; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding fusion recipe for " + output.getName(); - } - - @Override - public void apply() { - RA.addFusionReactorRecipe(MineTweakerMC.getLiquidStack(input1), MineTweakerMC.getLiquidStack(input2), MineTweakerMC.getLiquidStack(output) - , durationTicks, energyPerTick, startEnergy); - } - } - - /** - * Adds a Fusion Reactor recipe. - * - * @param input1 = first Input (not null, and respects StackSize) - * @param input2= second Input (not null, and respects StackSize) - * @param output = Output of the Fusion (can be null, and respects StackSize) - * @param durationInTicks = How many ticks the Fusion lasts (must be > 0) - * @param energyPerTick = The EU generated per Tick (can even be negative!) - * @param startEnergy = EU needed for heating the Reactor up (must be >= 0) - */ - @ZenMethod - public static void addRecipe(ILiquidStack output, ILiquidStack input1, ILiquidStack input2, int durationTicks, int energyPerTick, int startEnergy) { - MineTweakerAPI.apply(new AddFusionReactionAction(output, input1, input2, durationTicks, energyPerTick, startEnergy)); - } - - -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java deleted file mode 100644 index c8f167c..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java +++ /dev/null @@ -1,115 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_ModHandler; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Grinder recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Grinder") -@ModOnly("gregtech") -public class Grinder { - /** - * Adds a recipe with a single output. - * - * @param output grinder output - * @param input1 grinder primary input - * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input1, input2)); - } - - /** - * Adds a recipe with multiple outputs. - * - * @param outputs array with 1-4 outputs - * @param input1 grinder primary input - * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(outputs, input1, input2)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] outputs; - private final IItemStack input1; - private final IItemStack input2; - - private AddRecipeAction(IItemStack[] outputs, IItemStack input1, IItemStack input2) { - this.outputs = outputs; - this.input1 = input1; - this.input2 = input2; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addGrinderRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null); - } - - @Override - public String describe() { - return "Adding grinder recipe for " + outputs[0]; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 89 * hash + Arrays.deepHashCode(this.outputs); - hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.outputs, other.outputs)) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java deleted file mode 100644 index 9dd4a0b..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java +++ /dev/null @@ -1,118 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Implosion Compressor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ImplosionCompressor") -@ModOnly("gregtech") -public class ImplosionCompressor { - /** - * Adds an implosion compressor recipe with a single output. - * - * @param output recipe output - * @param input primary input - * @param tnt amount of TNT needed - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int tnt) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt)); - } - - /** - * Adds an implosion compressor recipe with one or two outputs. - * - * @param output array with 1-2 outputs - * @param input primary input - * @param tnt amount of TNT needed - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input, int tnt) { - if (output.length == 0) { - MineTweakerAPI.logError("Implosion compressor recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input, tnt)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input1; - private final int tnt; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, int tnt) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.tnt = tnt; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addImplosionRecipe( - MineTweakerMC.getItemStack(input1), - tnt, - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2)); - } - - @Override - public String describe() { - return "Adding Implosion compressor recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 97 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 97 * hash + this.tnt; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.tnt != other.tnt) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/LaserEngraver.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/LaserEngraver.java deleted file mode 100644 index cbc10d4..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/LaserEngraver.java +++ /dev/null @@ -1,52 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.LaserEngraver") -public class LaserEngraver { - private static final class AddLaserEngravingAction extends OneWayAction { - private IItemStack output; - private IItemStack input; - private IItemStack lens; - private int dur; - private int euT; - - public AddLaserEngravingAction(IItemStack output, IItemStack input, IItemStack lens, int dur, int euT) { - this.output = output; - this.input = input; - this.lens = lens; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Added laser engraving of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addLaserEngraverRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(lens) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack lens, int dur, int euT) { - MineTweakerAPI.apply(new AddLaserEngravingAction(output, input, lens, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java deleted file mode 100644 index 5b23698..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java +++ /dev/null @@ -1,132 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point for Lathe recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Lathe") -@ModOnly("gregtech") -public class Lathe { - /** - * Adds a lathe recipe with a single output. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, durationTicks, euPerTick)); - } - - /** - * Adds a lathe recipe with 1 or 2 outputs. - * - * @param outputs array with 1-2 outputs - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - input, - durationTicks, - euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addLatheRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding lathe recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 53 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Mixer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Mixer.java deleted file mode 100644 index 6340437..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Mixer.java +++ /dev/null @@ -1,68 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Mixer") -public class Mixer { - private static final class AddMixingAction extends OneWayAction { - private IItemStack output; - private ILiquidStack lOutput; - private IItemStack input1; - private IItemStack input2; - private IItemStack input3; - private IItemStack input4; - private int dur; - private int euT; - private ILiquidStack lInput; - - public AddMixingAction(IItemStack output, ILiquidStack lOutput, ILiquidStack lInput, IItemStack input1, IItemStack input2, - IItemStack input3, IItemStack input4, int dur, int euT) { - this.output = output; - this.lOutput = lOutput; - this.lInput = lInput; - this.input1 = input1; - this.input2 = input2; - this.input3 = input3; - this.input4 = input4; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding mixing w/ multiple inputs"; - } - - @Override - public void apply() { - RA.addMixerRecipe(MineTweakerMC.getItemStack(input1) - , MineTweakerMC.getItemStack(input2) - , MineTweakerMC.getItemStack(input3) - , MineTweakerMC.getItemStack(input4) - , MineTweakerMC.getLiquidStack(lInput) - , MineTweakerMC.getLiquidStack(lOutput) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, ILiquidStack lOutput, ILiquidStack lInput, IItemStack input1, IItemStack input2, - IItemStack input3, IItemStack input4, int dur, int euT) { - MineTweakerAPI.apply(new AddMixingAction(output, lOutput, lInput, input1, input2, input3, input4, dur, euT)); - } - -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java deleted file mode 100644 index c114ad5..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point to Plate Bender recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.PlateBender") -@ModOnly("gregtech") -public class PlateBender { - /** - * Adds a plate bender recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks bending time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBenderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate bender recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java deleted file mode 100644 index 4d0dd2f..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java +++ /dev/null @@ -1,176 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Plate Cutter recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.PlateCutter") -@ModOnly("gregtech") -public class PlateCutter { - /** - * Adds a plate cutter recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks cutting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, null, durationTicks, euPerTick)); - } - - /** - * Adds a plate cutter recipe. - * - * @param outputs recipe outputs - * @param input recipe input - * @param durationTicks cutting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("cutter recipe must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - input, - null, - durationTicks, - euPerTick)); - } - } - - /** - * Adds a plate cutter recipe. - * - * @param outputs recipe outputs - * @param input recipe input - * @param lubricant lubricant - * @param durationTicks cutting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, ILiquidStack lubricant, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("cutter recipe must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - input, - lubricant, - durationTicks, - euPerTick)); - } - } - - /** - * Adds a cutter recipe with lubricant. - * - * @param output recipe output - * @param input recipe input - * @param lubricant lubricant - * @param durationTicks cutting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, ILiquidStack lubricant, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, lubricant, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final ILiquidStack lubricant; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input, ILiquidStack lubricant, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.lubricant = lubricant; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCutterRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(lubricant), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate cutter recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 17 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 17 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 17 * hash + (this.lubricant != null ? this.lubricant.hashCode() : 0); - hash = 17 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 17 * hash + this.duration; - hash = 17 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Polarizer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Polarizer.java deleted file mode 100644 index 4fba029..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Polarizer.java +++ /dev/null @@ -1,50 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Polarizer") -public class Polarizer { - - private static final class AddPolarizationRecipeAction extends OneWayAction { - private IItemStack output; - private IItemStack input; - private int dur; - private int euT; - - public AddPolarizationRecipeAction(IItemStack output, IItemStack input, int dur, int euT) { - this.output = output; - this.input = input; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding polarization of " + input.getDisplayName() + " to " + output.getDisplayName(); - } - - @Override - public void apply() { - RA.addPolarizerRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int dur, int euT) { - MineTweakerAPI.apply(new AddPolarizationRecipeAction(output, input, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Printer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Printer.java deleted file mode 100644 index e4b8e22..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Printer.java +++ /dev/null @@ -1,57 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.printer") -public class Printer { - private static final class AddPrintingAction extends OneWayAction { - private IItemStack output; - private IItemStack input; - private IItemStack special; - private ILiquidStack ink; - private int dur; - private int euT; - - public AddPrintingAction(IItemStack output, IItemStack input, IItemStack special, ILiquidStack ink, int dur, - int euT) { - this.output = output; - this.input = input; - this.special = special; - this.ink = ink; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Added printing of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addPrinterRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getLiquidStack(ink) - , MineTweakerMC.getItemStack(special) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack special, ILiquidStack ink, int dur, int euT) { - MineTweakerAPI.apply(new AddPrintingAction(output, input, special, ink, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Pulveriser.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Pulveriser.java deleted file mode 100644 index 6cb4542..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Pulveriser.java +++ /dev/null @@ -1,51 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Pulveriser") -public class Pulveriser { - private static final class AddPulverisingAction extends OneWayAction { - private IItemStack[] outputs; - private IItemStack input; - private int[] chances; - private int dur; - private int euT; - - public AddPulverisingAction(IItemStack[] outputs, IItemStack input, int[] chances, int dur, int euT) { - this.outputs = outputs; - this.input = input; - this.chances = chances; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Added pulverising of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addPulveriserRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStacks(outputs) - , chances, dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int[] chances, int dur, int euT) { - MineTweakerAPI.apply(new AddPulverisingAction(outputs, input, chances, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sifter.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sifter.java deleted file mode 100644 index 7834397..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sifter.java +++ /dev/null @@ -1,51 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Sifter") -public class Sifter { - private static final class AddSiftingAction extends OneWayAction { - private IItemStack[] outputs; - private IItemStack input; - private int[] chances; - private int dur; - private int euT; - - public AddSiftingAction(IItemStack[] outputs, IItemStack input, int[] chances, int dur, int euT) { - this.outputs = outputs; - this.input = input; - this.chances = chances; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Added sifting of " + input.getDisplayName(); - } - - @Override - public void apply() { - RA.addSifterRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStacks(outputs) - , chances, dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int[] chances, int dur, int euT) { - MineTweakerAPI.apply(new AddSiftingAction(outputs, input, chances, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Slicer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Slicer.java deleted file mode 100644 index 69d2a2a..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Slicer.java +++ /dev/null @@ -1,52 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import static gregtech.api.enums.GT_Values.RA; - -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.gregtech.Slicer") -public class Slicer { - private static final class AddSlicingRecipeAction extends OneWayAction { - private IItemStack input; - private IItemStack shape; - private IItemStack output; - private int dur; - private int euT; - - public AddSlicingRecipeAction(IItemStack input, IItemStack shape, IItemStack output, int dur, int euT) { - this.input = input; - this.shape = shape; - this.output = output; - this.dur = dur; - this.euT = euT; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public String describe() { - return "Adding slicing of " + input.getDisplayName() + " into " + output.getDisplayName(); - } - - @Override - public void apply() { - RA.addSlicerRecipe(MineTweakerMC.getItemStack(input) - , MineTweakerMC.getItemStack(shape) - , MineTweakerMC.getItemStack(output) - , dur, euT); - } - } - - @ZenMethod - public static void addRecipe(IItemStack input, IItemStack shape, IItemStack output, int dur, int euT) { - MineTweakerAPI.apply(new AddSlicingRecipeAction(input, shape, output, dur, euT)); - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java deleted file mode 100644 index 736930c..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java +++ /dev/null @@ -1,87 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the sonictron. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Sonictron") -@ModOnly("gregtech") -public class Sonictron { - /** - * Adds a sonictron sound. - * - * @param itemStack item you want to display for this sound - * @param soundName name of the Sound in the resources/newsound-folder like Vanillasounds - */ - @ZenMethod - public static void addSound(IItemStack itemStack, String soundName) { - MineTweakerAPI.apply(new AddSoundAction(itemStack, soundName)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddSoundAction extends OneWayAction { - private final IItemStack itemStack; - private final String soundName; - - public AddSoundAction(IItemStack itemStack, String soundName) { - this.itemStack = itemStack; - this.soundName = soundName; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addSonictronSound( - MineTweakerMC.getItemStack(itemStack), - soundName); - } - - @Override - public String describe() { - return "Adding sonictron sound " + soundName; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.itemStack != null ? this.itemStack.hashCode() : 0); - hash = 79 * hash + (this.soundName != null ? this.soundName.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddSoundAction other = (AddSoundAction) obj; - if (this.itemStack != other.itemStack && (this.itemStack == null || !this.itemStack.equals(other.itemStack))) { - return false; - } - if ((this.soundName == null) ? (other.soundName != null) : !this.soundName.equals(other.soundName)) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java deleted file mode 100644 index d21764e..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java +++ /dev/null @@ -1,95 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Vacuum Freezer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.VacuumFreezer") -@ModOnly("gregtech") -public class VacuumFreezer { - /** - * Adds a vacuum freezer recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks freezing duration, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration) { - this.output = output; - this.input = input; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addVacuumFreezerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding vacuum freezer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java b/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java deleted file mode 100644 index ffa9c16..0000000 --- a/MineTweaker3-MC1710-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Wiremill recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Wiremill") -@ModOnly("gregtech") -public class Wiremill { - /** - * Adds a Wiremill recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks processing time - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addWiremillRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding wiremill recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 37 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 37 * hash + this.duration; - hash = 37 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC1710-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java b/MineTweaker3-MC1710-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java index ea620d2..6c3ce6c 100644 --- a/MineTweaker3-MC1710-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java +++ b/MineTweaker3-MC1710-Mod-MFR/src/main/java/minetweaker/mods/mfr/machines/Fertilizer.java @@ -85,7 +85,7 @@ public class Fertilizer { } @ZenMethod - public static void remmoveFertilizer(IItemStack item) { + public static void removeFertilizer(IItemStack item) { MineTweakerAPI.apply(new FertilizerRemoveFertilizerAction(item)); } diff --git a/MineTweaker3-MC172-Main/bin/assets/minetweaker/logo.png b/MineTweaker3-MC172-Main/bin/assets/minetweaker/logo.png deleted file mode 100644 index 674382e..0000000 Binary files a/MineTweaker3-MC172-Main/bin/assets/minetweaker/logo.png and /dev/null differ diff --git a/MineTweaker3-MC172-Main/bin/mcmod.info b/MineTweaker3-MC172-Main/bin/mcmod.info deleted file mode 100644 index b4de473..0000000 --- a/MineTweaker3-MC172-Main/bin/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "MineTweaker3", - "name": "MineTweaker 3", - "version": "${version}", - "mcversion": "${mcversion}", - "description": "Customize your minecraft experience!", - "credits": "Created By Stan Hebben", - "logoFile": "assets/minetweaker/logo.png", - "url": "http://minetweaker3.powerofbytes.com", - "authorList": [ "Stan Hebben" ], - "parent": "", - "screenshots": [], - "dependencies": [] -} -] diff --git a/MineTweaker3-MC172-Main/build.gradle b/MineTweaker3-MC172-Main/build.gradle deleted file mode 100644 index eafce52..0000000 --- a/MineTweaker3-MC172-Main/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion172 -} - -version = "1.7.2-" + ext.mineTweakerVersion -archivesBaseName = project.projectDir.name - -dependencies { - dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - } -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mc172.MineTweakerRegistry' -} - -tasks.jar.dependsOn(makeRegistry) - -processResources -{ - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/api/minecraft/MineTweakerMC.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/api/minecraft/MineTweakerMC.java deleted file mode 100644 index 14a40d4..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/api/minecraft/MineTweakerMC.java +++ /dev/null @@ -1,450 +0,0 @@ -package minetweaker.api.minecraft; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import minetweaker.MineTweakerAPI; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.data.IData; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.api.player.IPlayer; -import minetweaker.api.world.IBiome; -import minetweaker.api.world.IDimension; -import minetweaker.mc172.block.MCBlockDefinition; -import minetweaker.mc172.block.MCSpecificBlock; -import minetweaker.mc172.block.MCWorldBlock; -import minetweaker.mc172.data.NBTConverter; -import minetweaker.mc172.item.MCItemStack; -import minetweaker.mc172.oredict.MCOreDictEntry; -import minetweaker.mc172.player.MCPlayer; -import minetweaker.mc172.world.MCBiome; -import minetweaker.mc172.world.MCDimension; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * MineTweaker - MineCraft API bridge. - * - * @author Stan Hebben - */ -public class MineTweakerMC { - private static final Map blockDefinitions = new HashMap(); - public static final IBiome[] biomes; - - static { - biomes = new IBiome[BiomeGenBase.getBiomeGenArray().length]; - for (int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++) { - if (BiomeGenBase.getBiomeGenArray()[i] != null) - biomes[i] = new MCBiome(BiomeGenBase.getBiomeGenArray()[i]); - } - } - - private MineTweakerMC() {} - - /** - * Returns the Minecraft item for this MineTweaker item. - * - * @param item minetweaker item stack - * @return minecraft item stack - */ - public static ItemStack getItemStack(IItemStack item) { - if (item == null) return null; - - Object internal = item.getInternal(); - if (internal == null || !(internal instanceof ItemStack)) { - MineTweakerAPI.logError("Not a valid item stack: " + item); - } - return (ItemStack) internal; - } - - /** - * Returns the Minecraft ingredient for this ingredient. This method is only - * useful for ingredients that represent a single item stack. - * - * @param ingredient item ingredient - * @return minecraft item stack - */ - public static ItemStack getItemStack(IIngredient ingredient) { - if (ingredient == null) return null; - - List items = ingredient.getItems(); - if (items.size() != 1) { - MineTweakerAPI.logError("Not an ingredient with a single item: " + ingredient); - } - return getItemStack(items.get(0)); - } - - /** - * Returns the MineTweaker item stack for this item. Passing null returns - * null. - * - * @param item minecraft item stack - * @return minetweaker item stack, or null - */ - public static IItemStack getIItemStack(ItemStack item) { - if (item == null) return null; - - return new MCItemStack(item); - } - - /** - * Constructs an item stack with wildcard size. - * - * @param item minecraft item stack - * @return minetweaker stack - */ - public static IItemStack getIItemStackWildcardSize(ItemStack item) { - if (item == null) return null; - - return new MCItemStack(item, true); - } - - /** - * Constructs an item stack with wildcard size. - * - * @param item - * @param meta - * @return minetweaker stack - */ - public static IItemStack getIItemStackWildcardSize(Item item, int meta) { - if (item == null) return null; - - return new MCItemStack(new ItemStack(item, 1, meta), true); - } - - /** - * Constructs an item stack with wildcard damage. - * - * @param item stack item - * @param amount stack size - * @return minetweaker item stack - */ - public static IItemStack getIItemStackWildcard(Item item, int amount) { - if (item == null) return null; - - return new MCItemStack(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE)); - } - - /** - * Constructs an item stack with given item, damage and amount. - * - * @param item stack item - * @param damage stack damage - * @param amount stack amount - * @return minetweaker item stack - */ - public static IItemStack getItemStack(Item item, int amount, int damage) { - if (item == null) return null; - - return new MCItemStack(new ItemStack(item, amount, damage)); - } - - /** - * Converts an array of minetweaker item stacks into an array of minecraft - * item stacks. - * - * @param items minetweker item stacks - * @return minecraft item stacks - */ - public static ItemStack[] getItemStacks(IItemStack... items) { - if (items == null) return null; - - ItemStack[] output = new ItemStack[items.length]; - for (int i = 0; i < items.length; i++) { - Object internal = items[i].getInternal(); - if (internal != null && internal instanceof ItemStack) { - output[i] = (ItemStack) internal; - } - } - return output; - } - - /** - * Converts a list of minetweaker item stacks into an array of minecraft - * item stacks. - * - * @param items minetweaker items - * @return minecraft items - */ - public static ItemStack[] getItemStacks(List items) { - if (items == null) return null; - - ItemStack[] output = new ItemStack[items.size()]; - for (int i = 0; i < items.size(); i++) { - Object internal = items.get(i).getInternal(); - if (internal != null && internal instanceof ItemStack) { - output[i] = (ItemStack) internal; - } else { - MineTweakerAPI.logError("Invalid item stack: " + items.get(i)); - } - } - return output; - } - - /** - * Converts an array of minecraft item stacks into an array of minetweaker - * item stacks. - * - * @param items minecraft item stacks - * @return minetweaker item stacks - */ - public static IItemStack[] getIItemStacks(ItemStack... items) { - if (items == null) return null; - - IItemStack[] result = new IItemStack[items.length]; - for (int i = 0; i < items.length; i++) { - result[i] = new MCItemStack(items[i]); - } - return result; - } - - /** - * Converts a list of minecraft item stacks into an array of minetweaker - * item stacks. - * - * @param items minecraft item stacks - * @return minetweaker item stacks - */ - public static IItemStack[] getIItemStacks(List items) { - if (items == null) return null; - - IItemStack[] result = new IItemStack[items.size()]; - for (int i = 0; i < result.length; i++) { - result[i] = new MCItemStack(items.get(i)); - } - return result; - } - - /** - * Gets the ore dictionary entry with the given name. If the entry didn't - * exist yet, it will create it and return an empty entry. - * - * @param name ore entry name - * @return ore dictionary entry - */ - public static IOreDictEntry getOreDict(String name) { - return new MCOreDictEntry(name); - } - - /** - * Converts a Minecraft player into a MineTweaker player. - * - * @param player minecraft player - * @return minetweaker player - */ - public static IPlayer getIPlayer(EntityPlayer player) { - if (player == null) return null; - - return new MCPlayer(player); - } - - /** - * Converts a MineTweaker player into a Minecraft player. - * - * @param player minetweaker player - * @return minecraft player - */ - public static EntityPlayer getPlayer(IPlayer player) { - if (player == null) return null; - - if (!(player instanceof MCPlayer)) { - MineTweakerAPI.logError("Invalid player: " + player); - } - - return ((MCPlayer) player).getInternal(); - } - - /** - * Converts a Minecraft NBT to an IData instance. The IData instance is - * immutable (not modifyiable). - * - * @param nbt nbt data - * @return IData value - */ - public static IData getIData(NBTBase nbt) { - if (nbt == null) return null; - - return NBTConverter.from(nbt, true); - } - - /** - * Converts a Minecraft NBT to a modifyable IData instance. - * - * @param nbt nbt data - * @return mutable IData value - */ - public static IData getIDataModifyable(NBTBase nbt) { - if (nbt == null) return null; - - return NBTConverter.from(nbt, false); - } - - /** - * Converts an IData instance to an NBT value. - * - * @param data IData value - * @return nbt data - */ - public static NBTBase getNBT(IData data) { - if (data == null) return null; - - return NBTConverter.from(data); - } - - /** - * Converts an IData instance to an NBT Tag compound. - * - * @param data IData value - * @return nbt compound data - */ - public static NBTTagCompound getNBTCompound(IData data) { - if (data == null) return null; - - return (NBTTagCompound) NBTConverter.from(data); - } - - /** - * Retrieves the block at the given position. - * - * @param blocks block access - * @param x block x position - * @param y block y position - * @param z block z position - * @return block instance - */ - public static IBlock getBlock(IBlockAccess blocks, int x, int y, int z) { - return new MCWorldBlock(blocks, x, y, z); - } - - /** - * Retrieves the block definition for the given block. - * - * @param block block object - * @return block definition - */ - public static IBlockDefinition getBlockDefinition(Block block) { - if (!blockDefinitions.containsKey(block)) { - blockDefinitions.put(block, new MCBlockDefinition(block)); - } - return blockDefinitions.get(block); - } - - /** - * Retrieves the dimension instance for a given world. - * - * @param world world - * @return dimension - */ - public static IDimension getDimension(World world) { - if (world == null) return null; - - return new MCDimension(world); - } - - /** - * Returns an instance of the given block. - * - * @param block MC block definition - * @return MT block instance - */ - public static IBlock getBlockAnyMeta(Block block) { - return new MCSpecificBlock(block, OreDictionary.WILDCARD_VALUE); - } - - /** - * Returns an instance of the given block. - * - * @param block MC block definition - * @param meta block meta value - * @return MT block instance - */ - public static IBlock getBlock(Block block, int meta) { - return new MCSpecificBlock(block, meta); - } - - /** - * Retrieves the block from an item stack. - * - * @param itemStack - * @return - */ - public static Block getBlock(IItemStack itemStack) { - return ((MCBlockDefinition) itemStack.asBlock().getDefinition()).getInternalBlock(); - } - - /** - * Retrieves the internal fluid stack of the given stack. - * - * @param stack MT liquid stack - * @return MCF fluid stack - */ - public static FluidStack getLiquidStack(ILiquidStack stack) { - if (stack == null) - return null; - - return (FluidStack) stack.getInternal(); - } - - public static ItemStack[] getExamples(IIngredient ingredient) { - List examples = ingredient.getItems(); - ItemStack[] result = new ItemStack[examples.size()]; - for (int i = 0; i < examples.size(); i++) { - result[i] = MineTweakerMC.getItemStack(examples.get(i)); - } - return result; - } - - private static final HashMap oreDictArrays = new HashMap(); - public static IOreDictEntry getOreDictEntryFromArray(List array) { - if (!oreDictArrays.containsKey(array)) { - for (String ore : OreDictionary.getOreNames()) { - if (OreDictionary.getOres(ore) == array) { - oreDictArrays.put(array, MineTweakerAPI.oreDict.get(ore)); - } - } - } - - return oreDictArrays.get(array); - } - - /** - * Converts a Minecraft ingredient to a MineTweaker ingredient. - * - * @param ingredient minecraft ingredient - * @return minetweaker ingredient - */ - public static IIngredient getIIngredient(Object ingredient) { - if (ingredient == null) { - return null; - } else if (ingredient instanceof String) { - return MineTweakerAPI.oreDict.get((String) ingredient); - } else if (ingredient instanceof Item) { - return getIItemStack(new ItemStack((Item) ingredient, 1, 0)); - } else if (ingredient instanceof ItemStack) { - return getIItemStack((ItemStack) ingredient); - } else if (ingredient instanceof List) { - IOreDictEntry entry = getOreDictEntryFromArray((List) ingredient); - - if (entry == null) { - throw new IllegalArgumentException("No matching oredict entry: " + ingredient); - } - - return entry; - } else { - throw new IllegalArgumentException("Not a valid ingredient: " + ingredient); - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/FMLEventHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/FMLEventHandler.java deleted file mode 100644 index fb3cee9..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/FMLEventHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -package minetweaker.mc172; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.event.PlayerCraftedEvent; -import minetweaker.api.event.PlayerLoggedInEvent; -import minetweaker.api.event.PlayerLoggedOutEvent; -import minetweaker.api.event.PlayerSmeltedEvent; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.mc172.network.MineTweakerLoadScriptsPacket; -import minetweaker.mc172.recipes.MCCraftingInventory; -import net.minecraft.entity.player.EntityPlayerMP; - -/** - * - * @author Stan - */ -public class FMLEventHandler { - @SubscribeEvent - public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent ev) { - if (ev.player instanceof EntityPlayerMP) { - EntityPlayerMP player = (EntityPlayerMP) ev.player; - MineTweakerMod.NETWORK.sendTo( - new MineTweakerLoadScriptsPacket(MineTweakerAPI.tweaker.getScriptData()), - player); - } - - MineTweakerImplementationAPI.events.publishPlayerLoggedIn( - new PlayerLoggedInEvent(MineTweakerMC.getIPlayer(ev.player))); - } - - @SubscribeEvent - public void onPlayerItemCrafted(PlayerEvent.ItemCraftedEvent ev) { - IPlayer iPlayer = MineTweakerMC.getIPlayer(ev.player); - - if (MineTweakerMod.INSTANCE.recipes.hasTransformerRecipes()) { - MineTweakerMod.INSTANCE.recipes.applyTransformations( - MCCraftingInventory.get(ev.craftMatrix, ev.player), iPlayer); - } - - if (MineTweakerImplementationAPI.events.hasPlayerCrafted()) { - MineTweakerImplementationAPI.events.publishPlayerCrafted(new PlayerCraftedEvent( - iPlayer, - MineTweakerMC.getIItemStack(ev.crafting), - MCCraftingInventory.get(ev.craftMatrix, ev.player))); - } - } - - @SubscribeEvent - public void onPlayerItemSmelted(PlayerEvent.ItemSmeltedEvent ev) { - if (MineTweakerImplementationAPI.events.hasPlayerSmelted()) { - MineTweakerImplementationAPI.events.publishPlayerSmelted(new PlayerSmeltedEvent( - MineTweakerMC.getIPlayer(ev.player), - MineTweakerMC.getIItemStack(ev.smelting))); - } - } - - @SubscribeEvent - public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent ev) { - MineTweakerImplementationAPI.events.publishPlayerLoggedOut( - new PlayerLoggedOutEvent(MineTweakerMC.getIPlayer(ev.player))); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/ForgeEventHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/ForgeEventHandler.java deleted file mode 100644 index 1f716be..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/ForgeEventHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.formatting.IFormattedText; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.tooltip.IngredientTooltips; -import minetweaker.mc172.formatting.IMCFormattedString; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import org.lwjgl.input.Keyboard; - -/** - * - * @author Stan - */ -public class ForgeEventHandler { - @SubscribeEvent - public void onPlayerInteract(PlayerInteractEvent ev) { - minetweaker.api.event.PlayerInteractEvent event = new minetweaker.api.event.PlayerInteractEvent( - MineTweakerMC.getIPlayer(ev.entityPlayer), - MineTweakerMC.getDimension(ev.world), - ev.x, ev.y, ev.z - ); - - MineTweakerImplementationAPI.events.publishPlayerInteract(event); - } - - @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent ev) { - IItemStack itemStack = MineTweakerMC.getIItemStack(ev.itemStack); - for (IFormattedText tooltip : IngredientTooltips.getTooltips(itemStack)) { - ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString()); - } - - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - for (IFormattedText tooltip : IngredientTooltips.getShiftTooltips(itemStack)) { - ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString()); - } - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MCPlatformFunctions.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MCPlatformFunctions.java deleted file mode 100644 index 4dbb7c2..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MCPlatformFunctions.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172; - -import minetweaker.IPlatformFunctions; -import minetweaker.api.chat.IChatMessage; -import minetweaker.api.item.IItemDefinition; -import static minetweaker.mc172.MineTweakerMod.NETWORK; -import minetweaker.mc172.chat.MCChatMessage; -import minetweaker.mc172.item.MCItemDefinition; -import minetweaker.mc172.network.MineTweakerLoadScriptsPacket; -import net.minecraft.item.Item; - -/** - * - * @author Stan - */ -public class MCPlatformFunctions implements IPlatformFunctions { - public static final MCPlatformFunctions INSTANCE = new MCPlatformFunctions(); - - private MCPlatformFunctions() {} - - @Override - public IChatMessage getMessage(String message) { - return new MCChatMessage(message); - } - - @Override - public void distributeScripts(byte[] data) { - NETWORK.sendToAll(new MineTweakerLoadScriptsPacket(data)); - } - - @Override - public IItemDefinition getItemDefinition(int id) { - Item item = Item.getItemById(id); - if (item == null) return null; - String sid = Item.itemRegistry.getNameForObject(item); - return new MCItemDefinition(sid, item); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java deleted file mode 100644 index 8f8a2ba..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerMod.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.event.FMLServerStoppedEvent; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import cpw.mods.fml.relauncher.Side; -import java.io.File; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.api.logger.FileLogger; -import minetweaker.mc172.formatting.MCFormatter; -import minetweaker.mc172.furnace.FuelTweaker; -import minetweaker.mc172.furnace.MCFurnaceManager; -import minetweaker.mc172.game.MCGame; -import minetweaker.mc172.mods.MCLoadedMods; -import minetweaker.mc172.network.MineTweakerCopyClipboardHandler; -import minetweaker.mc172.network.MineTweakerCopyClipboardPacket; -import minetweaker.mc172.network.MineTweakerLoadScriptsHandler; -import minetweaker.mc172.network.MineTweakerLoadScriptsPacket; -import minetweaker.mc172.network.MineTweakerOpenBrowserHandler; -import minetweaker.mc172.network.MineTweakerOpenBrowserPacket; -import minetweaker.mc172.oredict.MCOreDict; -import minetweaker.mc172.recipes.MCRecipeManager; -import minetweaker.mc172.server.MCServer; -import minetweaker.mc172.util.MineTweakerHacks; -import minetweaker.mc172.vanilla.MCVanilla; -import minetweaker.runtime.IScriptProvider; -import minetweaker.runtime.providers.ScriptProviderCascade; -import minetweaker.runtime.providers.ScriptProviderCustom; -import minetweaker.runtime.providers.ScriptProviderDirectory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.MinecraftForge; - -/** - * Main mod class. Performs some general logic, initialization of the API and - * FML event handling. - * - * @author Stan Hebben - */ -@Mod(modid = MineTweakerMod.MODID, version = "3.0.9B") -public class MineTweakerMod { - public static final String MODID = "MineTweaker3"; - public static final String MCVERSION = "1.7.2"; - - public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(MODID); - - private static final String[] REGISTRIES = { - "minetweaker.mods.ic2.ClassRegistry", - "minetweaker.mods.nei.ClassRegistry", - "minetweaker.mods.gregtech.ClassRegistry", - "minetweaker.mods.buildcraft.ClassRegistry" - }; - private static final String[] REGISTRY_DESCRIPTIONS = { - "IC2 mod support", - "NEI mod support", - "GregTech mod support", - "Buildcraft mod support" - }; - - static { - NETWORK.registerMessage(MineTweakerLoadScriptsHandler.class, MineTweakerLoadScriptsPacket.class, 0, Side.CLIENT); - NETWORK.registerMessage(MineTweakerOpenBrowserHandler.class, MineTweakerOpenBrowserPacket.class, 1, Side.CLIENT); - NETWORK.registerMessage(MineTweakerCopyClipboardHandler.class, MineTweakerCopyClipboardPacket.class, 2, Side.CLIENT); - } - - @Mod.Instance(MODID) - public static MineTweakerMod INSTANCE; - - public final MCRecipeManager recipes; - private final IScriptProvider scriptsGlobal; - private final ScriptProviderCustom scriptsIMC; - - public MineTweakerMod() { - MineTweakerImplementationAPI.init( - new MCOreDict(), - recipes = new MCRecipeManager(), - new MCFurnaceManager(), - MCGame.INSTANCE, - new MCLoadedMods(), - new MCFormatter(), - new MCVanilla()); - - MineTweakerImplementationAPI.logger.addLogger(new FileLogger(new File("minetweaker.log"))); - MineTweakerImplementationAPI.platform = MCPlatformFunctions.INSTANCE; - - File globalDir = new File("scripts"); - if (!globalDir.exists()) { - globalDir.mkdirs(); - } - - scriptsIMC = new ScriptProviderCustom("intermod"); - scriptsGlobal = new ScriptProviderDirectory(globalDir); - MineTweakerImplementationAPI.setScriptProvider(scriptsGlobal); - } - - // ########################## - // ### FML Event Handlers ### - // ########################## - - @EventHandler - public void onIMCEvent(FMLInterModComms.IMCEvent event) { - for (final FMLInterModComms.IMCMessage imcMessage : event.getMessages()) { - if (imcMessage.key.equalsIgnoreCase("addMineTweakerScript")) { - if (imcMessage.isStringMessage()) { - scriptsIMC.add(imcMessage.getSender() + "::imc", imcMessage.getStringValue()); - } else if (imcMessage.isNBTMessage()) { - NBTTagCompound message = imcMessage.getNBTValue(); - scriptsIMC.add(imcMessage.getSender() + "::" + message.getString("name"), message.getString("content")); - } - } - } - } - - @EventHandler - public void onLoad(FMLPreInitializationEvent ev) { - MinecraftForge.EVENT_BUS.register(new ForgeEventHandler()); - FMLCommonHandler.instance().bus().register(new FMLEventHandler()); - } - - @EventHandler - public void onPostInit(FMLPostInitializationEvent ev) { - MineTweakerAPI.registerClassRegistry(MineTweakerRegistry.class); - - for (int i = 0; i < REGISTRIES.length; i++) { - MineTweakerAPI.registerClassRegistry(REGISTRIES[i], REGISTRY_DESCRIPTIONS[i]); - } - - FuelTweaker.INSTANCE.register(); - } - - @EventHandler - public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { - // starts before loading worlds - // perfect place to start MineTweaker! - - File scriptsDir = new File(MineTweakerHacks.getWorldDirectory(ev.getServer()), "scripts"); - if (!scriptsDir.exists()) { - scriptsDir.mkdir(); - } - - IScriptProvider scriptsLocal = new ScriptProviderDirectory(scriptsDir); - IScriptProvider cascaded = new ScriptProviderCascade(scriptsIMC, scriptsGlobal, scriptsLocal); - MineTweakerImplementationAPI.setScriptProvider(cascaded); - MineTweakerImplementationAPI.onServerStart(new MCServer(ev.getServer())); - } - - @EventHandler - public void onServerStarting(FMLServerStartingEvent ev) { - - } - - @EventHandler - public void onServerStopped(FMLServerStoppedEvent ev) { - MineTweakerImplementationAPI.onServerStop(); - MineTweakerImplementationAPI.setScriptProvider(scriptsGlobal); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerRegistry.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerRegistry.java deleted file mode 100644 index e366917..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/MineTweakerRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172; - -import java.util.List; - -/** - * - * @author Stan - */ -public class MineTweakerRegistry { - public static void getClasses(List classes) { - // method stub, actual content is generated by build process - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/actions/SetTranslationAction.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/actions/SetTranslationAction.java deleted file mode 100644 index 35d2eb5..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/actions/SetTranslationAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.actions; - -import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; -import minetweaker.IUndoableAction; -import minetweaker.mc172.util.MineTweakerHacks; -import net.minecraft.util.StringTranslate; - -/** - * - * @author Stan - */ -public class SetTranslationAction implements IUndoableAction { - private static final StringTranslate INSTANCE = MineTweakerHacks.getStringTranslateInstance(); - private static final Charset UTF8 = Charset.forName("utf-8"); - - private final String key; - private final String newValue; - private final String oldValue; - - public SetTranslationAction(String key, String value) { - this.key = key; - newValue = value; - oldValue = INSTANCE.translateKey(key); - } - - @Override - public void apply() { - set(key, newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - set(key, oldValue); - } - - @Override - public String describe() { - return "Translating " + key + " to " + newValue; - } - - @Override - public String describeUndo() { - return "Reverting " + key + " to " + oldValue; - } - - private static void set(String key, String value) { - StringTranslate.inject(new ByteArrayInputStream((key + "=" + value).getBytes(UTF8))); - } - - @Override - public Object getOverrideKey() { - return null; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCBlockDefinition.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCBlockDefinition.java deleted file mode 100644 index 1d1658d..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCBlockDefinition.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.block; - -import minetweaker.api.block.IBlockDefinition; -import net.minecraft.block.Block; - -/** - * - * @author Stan - */ -public class MCBlockDefinition implements IBlockDefinition { - private final Block block; - - public MCBlockDefinition(Block block) { - this.block = block; - } - - public Block getInternalBlock() { - return block; - } - - @Override - public String getId() { - return Block.blockRegistry.getNameForObject(block); - } - - @Override - public String getDisplayName() { - return block.getLocalizedName(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCItemBlock.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCItemBlock.java deleted file mode 100644 index 5c7f07d..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCItemBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.block; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.block.BlockPatternOr; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.data.IData; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCItemBlock implements IBlock { - private final ItemStack item; - - public MCItemBlock(ItemStack item) { - this.item = item; - } - - @Override - public IBlockDefinition getDefinition() { - return MineTweakerMC.getBlockDefinition(Block.getBlockFromItem(item.getItem())); - } - - @Override - public int getMeta() { - return item.getItemDamage(); - } - - @Override - public IData getTileData() { - if (item.stackTagCompound == null) - return null; - - return MineTweakerMC.getIData(item.stackTagCompound); - } - - @Override - public String getDisplayName() { - return item.getDisplayName(); - } - - @Override - public List getBlocks() { - return Collections.singletonList(this); - } - - @Override - public boolean matches(IBlock block) { - return getDefinition() == block.getDefinition() - && (getMeta() == OreDictionary.WILDCARD_VALUE || getMeta() == block.getMeta()) - && (getTileData() == null || (block.getTileData() != null && block.getTileData().contains(getTileData()))); - } - - @Override - public IBlockPattern or(IBlockPattern pattern) { - return new BlockPatternOr(this, pattern); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCSpecificBlock.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCSpecificBlock.java deleted file mode 100644 index eb7ce8f..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCSpecificBlock.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.block; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.block.BlockPatternOr; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.data.IData; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCSpecificBlock implements IBlock { - private final Block block; - private final int meta; - - public MCSpecificBlock(Block block, int meta) { - this.block = block; - this.meta = meta; - } - - @Override - public IBlockDefinition getDefinition() { - return MineTweakerMC.getBlockDefinition(block); - } - - @Override - public int getMeta() { - return meta; - } - - @Override - public IData getTileData() { - return null; - } - - @Override - public List getBlocks() { - return Collections.singletonList(this); - } - - @Override - public boolean matches(IBlock block) { - return block.getDefinition() == getDefinition() - && (meta == OreDictionary.WILDCARD_VALUE || block.getMeta() == meta); - } - - @Override - public IBlockPattern or(IBlockPattern pattern) { - return new BlockPatternOr(this, pattern); - } - - @Override - public String getDisplayName() { - return block.getLocalizedName(); - } - - @Override - public String toString() { - return ""; - } - - private static String getBlockId(Block block) - { - return Block.blockRegistry.getNameForObject(block); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCWorldBlock.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCWorldBlock.java deleted file mode 100644 index dcb3778..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/block/MCWorldBlock.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.block; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.block.BlockPatternOr; -import minetweaker.api.block.IBlock; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.block.IBlockPattern; -import minetweaker.api.data.IData; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCWorldBlock implements IBlock { - private final IBlockAccess blocks; - private final int x; - private final int y; - private final int z; - - public MCWorldBlock(IBlockAccess blocks, int x, int y, int z) { - this.blocks = blocks; - this.x = x; - this.y = y; - this.z = z; - } - - @Override - public IBlockDefinition getDefinition() { - return MineTweakerMC.getBlockDefinition(blocks.getBlock(x, y, z)); - } - - @Override - public int getMeta() { - return blocks.getBlockMetadata(x, y, z); - } - - @Override - public IData getTileData() { - TileEntity tileEntity = blocks.getTileEntity(x, y, z); - - if (tileEntity == null) - return null; - - NBTTagCompound nbt = new NBTTagCompound(); - tileEntity.writeToNBT(nbt); - return MineTweakerMC.getIData(nbt); - } - - @Override - public String getDisplayName() { - Block block = blocks.getBlock(x, y, z); - Item item = Item.getItemFromBlock(block); - if (item != null) { - return (new ItemStack(item, 1, getMeta())).getDisplayName(); - } else { - return block.getLocalizedName(); - } - } - - @Override - public List getBlocks() { - return Collections.singletonList(this); - } - - @Override - public boolean matches(IBlock block) { - return getDefinition() == block.getDefinition() - && (getMeta() == OreDictionary.WILDCARD_VALUE || getMeta() == block.getMeta()) - && (getTileData() == null || (block.getTileData() != null && block.getTileData().contains(getTileData()))); - } - - @Override - public IBlockPattern or(IBlockPattern pattern) { - return new BlockPatternOr(this, pattern); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/ItemBracketHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/ItemBracketHandler.java deleted file mode 100644 index 3aa0540..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/ItemBracketHandler.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.brackets; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import minetweaker.IBracketHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.BracketHandler; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IngredientAny; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStackWildcardSize; -import net.minecraft.item.Item; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.ZenTokener; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionInt; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.ZenType; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * - * @author Stan - */ -@BracketHandler(priority=100) -public class ItemBracketHandler implements IBracketHandler { - private static final Map itemNames; - - static { - itemNames = new HashMap(); - for (String itemName : (Set) Item.itemRegistry.getKeys()) { - itemNames.put(itemName.replace(" ", ""), (Item) Item.itemRegistry.getObject(itemName)); - } - } - - public static IItemStack getItem(String name, int meta) { - //Item item = (Item) Item.itemRegistry.getObject(name); - Item item = itemNames.get(name); - if (item != null) { - return getIItemStackWildcardSize(item, meta); - } else { - return null; - } - } - - private final IZenSymbol symbolAny; - private final IJavaMethod method; - - public ItemBracketHandler() { - symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE"); - method = MineTweakerAPI.getJavaMethod( - ItemBracketHandler.class, - "getItem", - String.class, int.class); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - // any symbol - if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) { - return symbolAny; - } - - // detect special cases: - // item: at the start means item-specific syntax - // :xxx with xxx an integer means sub-item syntax - // :* means any-subitem-syntax - int fromIndex = 0; - int toIndex = tokens.size(); - int meta = 0; - - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("item") && tokens.get(1).getValue().equals(":")) { - fromIndex = 2; - } - if (tokens.get(tokens.size() - 1).getType() == ZenTokener.T_INTVALUE - && tokens.get(tokens.size() - 2).getValue().equals(":")) { - toIndex = tokens.size() - 2; - meta = Integer.parseInt(tokens.get(tokens.size() - 1).getValue()); - } else if (tokens.get(tokens.size() - 1).getValue().equals("*") - && tokens.get(tokens.size() - 2).getValue().equals(":")) { - toIndex = tokens.size() - 2; - meta = OreDictionary.WILDCARD_VALUE; - } - } - - return find(environment, tokens, fromIndex, toIndex, meta); - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex, int meta) { - StringBuilder valueBuilder = new StringBuilder(); - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - valueBuilder.append(token.getValue()); - } - - String itemName = valueBuilder.toString(); - if (itemNames.containsKey(itemName)) { - return new ItemReferenceSymbol(environment, itemName, meta); - } - - return null; - } - - private class ItemReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - private final int meta; - - public ItemReferenceSymbol(IEnvironmentGlobal environment, String name, int meta) { - this.environment = environment; - this.name = name; - this.meta = meta; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name), - new ExpressionInt(position, meta, ZenType.INT)); - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/LiquidBracketHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/LiquidBracketHandler.java deleted file mode 100644 index 4df20de..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/LiquidBracketHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -package minetweaker.mc172.brackets; - -import java.util.List; -import minetweaker.IBracketHandler; -import minetweaker.annotations.BracketHandler; -import minetweaker.mc172.liquid.MCLiquidStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.runtime.GlobalRegistry; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.type.natives.JavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * - * @author Stan - */ -@BracketHandler -public class LiquidBracketHandler implements IBracketHandler { - public static ILiquidStack getLiquid(String name) { - Fluid fluid = FluidRegistry.getFluid(name); - if (fluid != null) { - return new MCLiquidStack(new FluidStack(fluid, 1)); - } else { - return null; - } - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("liquid") && tokens.get(1).getValue().equals(":")) { - return find(environment, tokens, 2, tokens.size()); - } - } - - return null; - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex) { - StringBuilder valueBuilder = new StringBuilder(); - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - valueBuilder.append(token.getValue()); - } - - Fluid fluid = FluidRegistry.getFluid(valueBuilder.toString()); - if (fluid != null) { - return new LiquidReferenceSymbol(environment, valueBuilder.toString()); - } - - return null; - } - - private class LiquidReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - - public LiquidReferenceSymbol(IEnvironmentGlobal environment, String name) { - this.environment = environment; - this.name = name; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - IJavaMethod method = JavaMethod.get( - GlobalRegistry.getTypeRegistry(), - LiquidBracketHandler.class, - "getLiquid", - String.class); - - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name)); - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/OreBracketHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/OreBracketHandler.java deleted file mode 100644 index 99ffa4e..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/brackets/OreBracketHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.brackets; - -import java.util.List; -import minetweaker.IBracketHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.BracketHandler; -import static minetweaker.api.minecraft.MineTweakerMC.getOreDict; -import minetweaker.api.oredict.IOreDictEntry; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * - * @author Stan - */ -@BracketHandler -public class OreBracketHandler implements IBracketHandler { - public static IOreDictEntry getOre(String name) { - return getOreDict(name); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - if (tokens.size() > 2) { - if (tokens.get(0).getValue().equals("ore") && tokens.get(1).getValue().equals(":")) { - return find(environment, tokens, 2, tokens.size()); - } - } - - return null; - } - - private IZenSymbol find(IEnvironmentGlobal environment, List tokens, int startIndex, int endIndex) { - StringBuilder valueBuilder = new StringBuilder(); - for (int i = startIndex; i < endIndex; i++) { - Token token = tokens.get(i); - valueBuilder.append(token.getValue()); - } - - return new OreReferenceSymbol(environment, valueBuilder.toString()); - } - - private class OreReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - - public OreReferenceSymbol(IEnvironmentGlobal environment, String name) { - this.environment = environment; - this.name = name; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - IJavaMethod method = MineTweakerAPI.getJavaMethod( - OreBracketHandler.class, - "getOre", - String.class); - - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name)); - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/chat/MCChatMessage.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/chat/MCChatMessage.java deleted file mode 100644 index 6183acf..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/chat/MCChatMessage.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.chat; - -import minetweaker.api.chat.IChatMessage; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; - -/** - * - * @author Stan - */ -public class MCChatMessage implements IChatMessage { - private final IChatComponent data; - - public MCChatMessage(String message) { - data = new ChatComponentText(message); - } - - public MCChatMessage(IChatComponent data) { - this.data = data; - } - - @Override - public IChatMessage add(IChatMessage other) { - return new MCChatMessage(data.appendSibling((IChatComponent) other.getInternal())); - } - - @Override - public Object getInternal() { - return data; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/client/MCClient.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/client/MCClient.java deleted file mode 100644 index ec70efc..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/client/MCClient.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.client; - -import cpw.mods.fml.client.FMLClientHandler; -import minetweaker.api.client.IClient; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import net.minecraft.client.Minecraft; - -/** - * - * @author Stan - */ -public class MCClient implements IClient { - private final IPlayer player; - - public MCClient() { - player = MineTweakerMC.getIPlayer(Minecraft.getMinecraft().thePlayer); - } - - @Override - public IPlayer getPlayer() { - return player; - } - - @Override - public String getLanguage() { - return FMLClientHandler.instance().getCurrentLanguage(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/data/NBTConverter.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/data/NBTConverter.java deleted file mode 100644 index 2a8c819..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/data/NBTConverter.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import minetweaker.mc172.util.MineTweakerHacks; -import minetweaker.api.data.DataByte; -import minetweaker.api.data.DataByteArray; -import minetweaker.api.data.DataDouble; -import minetweaker.api.data.DataFloat; -import minetweaker.api.data.DataInt; -import minetweaker.api.data.DataIntArray; -import minetweaker.api.data.DataList; -import minetweaker.api.data.DataLong; -import minetweaker.api.data.DataMap; -import minetweaker.api.data.DataShort; -import minetweaker.api.data.DataString; -import minetweaker.api.data.IData; -import minetweaker.api.data.IDataConverter; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagByteArray; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.nbt.NBTTagIntArray; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.nbt.NBTTagString; - -/** - * - * @author Stan - */ -public class NBTConverter implements IDataConverter { - private static final NBTConverter INSTANCE = new NBTConverter(); - - public static NBTBase from(IData data) { - return data.convert(INSTANCE); - } - - public static IData from(NBTBase nbt, boolean immutable) { - if (nbt == null) return null; - - switch (nbt.getId()) { - case 1: // byte - return new DataByte(((NBTBase.NBTPrimitive) nbt).func_150290_f()); - case 2: // short - return new DataShort(((NBTBase.NBTPrimitive) nbt).func_150289_e()); - case 3: // int - return new DataInt(((NBTBase.NBTPrimitive) nbt).func_150287_d()); - case 4: // long - return new DataLong(((NBTBase.NBTPrimitive) nbt).func_150291_c()); - case 5: // float - return new DataFloat(((NBTBase.NBTPrimitive) nbt).func_150288_h()); - case 6: // double - return new DataDouble(((NBTBase.NBTPrimitive) nbt).func_150286_g()); - case 7: // byte[] - return new DataByteArray(((NBTTagByteArray) nbt).func_150292_c(), immutable); - case 8: // string - return new DataString(((NBTTagString) nbt).func_150285_a_()); - case 9: { // list - List values = new ArrayList(); - List original = MineTweakerHacks.getTagList((NBTTagList) nbt); - for (NBTBase value : original) { - values.add(from(value, immutable)); - } - return new DataList(values, immutable); - } - case 10: { // compound - Map values = new HashMap(); - NBTTagCompound original = (NBTTagCompound) nbt; - for (String key : (Set)original.func_150296_c()) { - values.put(key, from(original.getTag(key), immutable)); - } - return new DataMap(values, immutable); - } - case 11: // int[] - return new DataIntArray(((NBTTagIntArray) nbt).func_150302_c(), immutable); - default: - throw new RuntimeException("Unknown tag type: " + nbt.getId()); - } - } - - public static void updateMap(NBTTagCompound nbt, IData data) { - NBTUpdater updater = new NBTUpdater(nbt); - data.convert(updater); - } - - public NBTConverter() {} - - @Override - public NBTBase fromBool(boolean value) { - return new NBTTagInt(value ? 1 : 0); - } - - @Override - public NBTBase fromByte(byte value) { - return new NBTTagByte(value); - } - - @Override - public NBTBase fromShort(short value) { - return new NBTTagShort(value); - } - - @Override - public NBTBase fromInt(int value) { - return new NBTTagInt(value); - } - - @Override - public NBTBase fromLong(long value) { - return new NBTTagLong(value); - } - - @Override - public NBTBase fromFloat(float value) { - return new NBTTagFloat(value); - } - - @Override - public NBTBase fromDouble(double value) { - return new NBTTagDouble(value); - } - - @Override - public NBTBase fromString(String value) { - return new NBTTagString(value); - } - - @Override - public NBTBase fromList(List values) { - NBTTagList result = new NBTTagList(); - for (IData value : values) { - result.appendTag(from(value)); - } - return result; - } - - @Override - public NBTBase fromMap(Map values) { - NBTTagCompound result = new NBTTagCompound(); - for (Map.Entry entry : values.entrySet()) { - result.setTag(entry.getKey(), from(entry.getValue())); - } - return result; - } - - @Override - public NBTBase fromByteArray(byte[] value) { - return new NBTTagByteArray(value); - } - - @Override - public NBTBase fromIntArray(int[] value) { - return new NBTTagIntArray(value); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/data/NBTUpdater.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/data/NBTUpdater.java deleted file mode 100644 index 333b0cf..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/data/NBTUpdater.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.data; - -import java.util.Map; -import minetweaker.api.data.IData; -import minetweaker.api.data.IDataConverter; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; - -/** - * - * @author Stan - */ -public class NBTUpdater extends NBTConverter implements IDataConverter { - private final NBTTagCompound nbt; - - public NBTUpdater(NBTTagCompound compound) { - this.nbt = compound; - } - - @Override - public NBTBase fromMap(Map map) { - for (Map.Entry entry : map.entrySet()) { - if (nbt.hasKey(entry.getKey())) { - if (entry.getValue() == null) { - nbt.removeTag(entry.getKey()); - } else { - if (nbt.getTag(entry.getKey()).getId() == 10) { - NBTTagCompound tag = (NBTTagCompound) nbt.getTag(entry.getKey()); - nbt.setTag(entry.getKey(), entry.getValue().convert(new NBTUpdater(nbt))); - } else { - nbt.setTag(entry.getKey(), NBTConverter.from(entry.getValue())); - } - } - } else if (entry.getValue() != null) { - nbt.setTag(entry.getKey(), from(entry.getValue())); - } - } - - return nbt; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/entity/MCEntityDefinition.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/entity/MCEntityDefinition.java deleted file mode 100644 index 1425219..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/entity/MCEntityDefinition.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.entity; - -import cpw.mods.fml.common.registry.EntityRegistry; -import minetweaker.api.entity.IEntityDefinition; - -/** - * - * @author Stan - */ -public class MCEntityDefinition implements IEntityDefinition { - private final EntityRegistry.EntityRegistration registration; - - public MCEntityDefinition(EntityRegistry.EntityRegistration registration) { - this.registration = registration; - } - - @Override - public String getId() { - return registration.getEntityClass().getName(); - } - - @Override - public String getName() { - return registration.getEntityName(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedMarkupString.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedMarkupString.java deleted file mode 100644 index 5f265e4..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedMarkupString.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.formatting; - -import minetweaker.api.formatting.IFormattedText; -import net.minecraft.util.EnumChatFormatting; - -/** - * - * @author Stan - */ -public class FormattedMarkupString implements IMCFormattedString { - private final EnumChatFormatting markup; - private final IMCFormattedString contents; - - public FormattedMarkupString(EnumChatFormatting markup, IMCFormattedString contents) { - this.markup = markup; - this.contents = contents; - } - - @Override - public String getTooltipString() { - return markup + contents.getTooltipString(markup.toString()); - } - - @Override - public String getTooltipString(String context) { - return markup + contents.getTooltipString(context + markup); - } - - @Override - public IFormattedText add(IFormattedText other) { - return cat(other); - } - - @Override - public IFormattedText cat(IFormattedText other) { - return new FormattedStringJoin(this, (IMCFormattedString) other); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedString.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedString.java deleted file mode 100644 index 3d3c58f..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedString.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.formatting; - -import minetweaker.api.formatting.IFormattedText; - -/** - * - * @author Stan - */ -public class FormattedString implements IMCFormattedString { - private final String value; - - public FormattedString(String value) { - this.value = value; - } - - @Override - public String getTooltipString() { - return value; - } - - @Override - public String getTooltipString(String context) { - return value; - } - - @Override - public IFormattedText add(IFormattedText other) { - return cat(other); - } - - @Override - public IFormattedText cat(IFormattedText other) { - return new FormattedStringJoin(this, (IMCFormattedString) other); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedStringJoin.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedStringJoin.java deleted file mode 100644 index b433270..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/FormattedStringJoin.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.formatting; - -import java.util.Arrays; -import minetweaker.api.formatting.IFormattedText; -import net.minecraft.util.EnumChatFormatting; - -/** - * - * @author Stan - */ -public class FormattedStringJoin implements IMCFormattedString { - private final IMCFormattedString[] values; - - public FormattedStringJoin(IMCFormattedString first, IMCFormattedString second) { - values = new IMCFormattedString[] { first, second }; - } - - public FormattedStringJoin(IMCFormattedString[] values) { - this.values = values; - } - - @Override - public String getTooltipString() { - StringBuilder result = new StringBuilder(); - for (IMCFormattedString value : values) { - result.append(value.getTooltipString()); - } - return result.toString(); - } - - @Override - public String getTooltipString(String context) { - boolean first = true; - - StringBuilder result = new StringBuilder(); - for (IMCFormattedString value : values) { - if (first) { - first = false; - } else { - result.append(context); - } - - result.append(value.getTooltipString()); - result.append(EnumChatFormatting.RESET); - } - - return result.toString(); - } - - @Override - public IFormattedText add(IFormattedText other) { - return cat(other); - } - - @Override - public IFormattedText cat(IFormattedText other) { - IMCFormattedString[] newValues = Arrays.copyOf(values, values.length + 1); - newValues[values.length] = (IMCFormattedString) other; - return new FormattedStringJoin(newValues); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/IMCFormattedString.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/IMCFormattedString.java deleted file mode 100644 index 4da2589..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/IMCFormattedString.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.formatting; - -import minetweaker.api.formatting.IFormattedText; - -/** - * - * @author Stan - */ -public interface IMCFormattedString extends IFormattedText { - public String getTooltipString(); - - public String getTooltipString(String context); -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/MCFormatter.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/MCFormatter.java deleted file mode 100644 index 7533e83..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/formatting/MCFormatter.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.formatting; - -import minetweaker.api.formatting.IFormattedText; -import minetweaker.api.formatting.IFormatter; -import net.minecraft.util.EnumChatFormatting; - -/** - * - * @author Stan - */ -public class MCFormatter implements IFormatter { - - @Override - public IFormattedText string(String text) { - return new FormattedString(text); - } - - @Override - public IFormattedText black(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.BLACK, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkBlue(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_BLUE, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkGreen(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_GREEN, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkAqua(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_AQUA, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkRed(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_RED, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkPurple(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_PURPLE, (IMCFormattedString) text); - } - - @Override - public IFormattedText gold(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.GOLD, (IMCFormattedString) text); - } - - @Override - public IFormattedText gray(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.GRAY, (IMCFormattedString) text); - } - - @Override - public IFormattedText darkGray(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.DARK_GRAY, (IMCFormattedString) text); - } - - @Override - public IFormattedText blue(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.BLUE, (IMCFormattedString) text); - } - - @Override - public IFormattedText green(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.GREEN, (IMCFormattedString) text); - } - - @Override - public IFormattedText aqua(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.AQUA, (IMCFormattedString) text); - } - - @Override - public IFormattedText red(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.RED, (IMCFormattedString) text); - } - - @Override - public IFormattedText lightPurple(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.LIGHT_PURPLE, (IMCFormattedString) text); - } - - @Override - public IFormattedText yellow(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.YELLOW, (IMCFormattedString) text); - } - - @Override - public IFormattedText white(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.WHITE, (IMCFormattedString) text); - } - - @Override - public IFormattedText obfuscated(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.OBFUSCATED, (IMCFormattedString) text); - } - - @Override - public IFormattedText bold(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.BOLD, (IMCFormattedString) text); - } - - @Override - public IFormattedText strikethrough(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.STRIKETHROUGH, (IMCFormattedString) text); - } - - @Override - public IFormattedText underline(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.UNDERLINE, (IMCFormattedString) text); - } - - @Override - public IFormattedText italic(IFormattedText text) { - return new FormattedMarkupString(EnumChatFormatting.ITALIC, (IMCFormattedString) text); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/FuelTweaker.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/FuelTweaker.java deleted file mode 100644 index 89f6838..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/FuelTweaker.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.furnace; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import cpw.mods.fml.common.IFuelHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.item.Item; - -public class FuelTweaker { - public static final FuelTweaker INSTANCE = new FuelTweaker(); - - private List original; - private final HashMap> quickList = new HashMap>(); - - private FuelTweaker() {} - - public void register() { - try { - Field fuelHandlers = GameRegistry.class.getDeclaredField("fuelHandlers"); - fuelHandlers.setAccessible(true); - original = (List) fuelHandlers.get(null); - List modified = new ArrayList(); - modified.add(new OverridingFuelHandler()); - fuelHandlers.set(null, modified); - } catch (NoSuchFieldException ex) { - System.out.println("[MineTweaker] Error: could not get GameRegistry fuel handlers field. Cannot use custom fuel values."); - } catch (SecurityException ex) { - System.out.println("[MineTweaker] Error: could not alter GameRegistry fuel handlers field. Cannot use custom fuel values."); - } catch (IllegalAccessException ex) { - System.out.println("[MineTweaker] Error: could not alter GameRegistry fuel handlers field. Cannot use custom fuel values."); - } - } - - public void addFuelPattern(SetFuelPattern pattern) { - List items = pattern.getPattern().getItems(); - if (items == null) { - MineTweakerAPI.logError("Cannot set fuel for <*>"); - return; - } - - for (IItemStack item : pattern.getPattern().getItems()) { - ItemStack itemStack = MineTweakerMC.getItemStack(item); - Item mcItem = itemStack.getItem(); - if (!quickList.containsKey(mcItem)) { - quickList.put(mcItem, new ArrayList()); - } - quickList.get(mcItem).add(pattern); - } - } - - public void removeFuelPattern(SetFuelPattern pattern) { - for (IItemStack item : pattern.getPattern().getItems()) { - ItemStack itemStack = MineTweakerMC.getItemStack(item); - Item mcItem = itemStack.getItem(); - if (quickList.containsKey(mcItem)) { - quickList.get(mcItem).remove(pattern); - } - } - } - - private class OverridingFuelHandler implements IFuelHandler { - @Override - public int getBurnTime(ItemStack fuel) { - if (quickList.containsKey(fuel.getItem())) { - IItemStack stack = MineTweakerMC.getIItemStack(fuel); - - for (SetFuelPattern override : quickList.get(fuel.getItem())) { - if (override.getPattern().matches(stack)) { - return override.getValue(); - } - } - } - - int max = 0; - for (IFuelHandler handler : original) { - max = Math.max(max, handler.getBurnTime(fuel)); - } - return max; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/MCFurnaceManager.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/MCFurnaceManager.java deleted file mode 100644 index 1e74606..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/MCFurnaceManager.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.furnace; - -import cpw.mods.fml.common.registry.GameRegistry; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.api.recipes.IFurnaceManager; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; - -/** - * - * @author Stan - */ -public class MCFurnaceManager implements IFurnaceManager { - public MCFurnaceManager() { - - } - - @Override - public void remove(IIngredient output, IIngredient input) { - if (output == null) throw new IllegalArgumentException("output cannot be null"); - - Map smeltingList = FurnaceRecipes.smelting().getSmeltingList(); - - List toRemove = new ArrayList(); - List toRemoveValues = new ArrayList(); - for (Map.Entry entry : smeltingList.entrySet()) { - if (output.matches(getIItemStack(entry.getValue())) - && (input == null || input.matches(getIItemStack(entry.getKey())))) { - toRemove.add(entry.getKey()); - toRemoveValues.add(entry.getValue()); - } - } - - if (toRemove.isEmpty()) { - MineTweakerAPI.logWarning("No furnace recipes for " + output.toString()); - } else { - MineTweakerAPI.apply(new RemoveAction(toRemove, toRemoveValues)); - } - } - - @Override - public void addRecipe(IItemStack output, IIngredient input, double xp) { - List items = input.getItems(); - if (items == null) { - MineTweakerAPI.logError("Cannot turn " + input.toString() + " into a furnace recipe"); - } - - ItemStack[] items2 = getItemStacks(items); - ItemStack output2 = getItemStack(output); - MineTweakerAPI.apply(new AddRecipeAction(input, items2, output2, xp)); - } - - @Override - public void setFuel(IIngredient item, int fuel) { - MineTweakerAPI.apply(new SetFuelAction(new SetFuelPattern(item, fuel))); - } - - @Override - public int getFuel(IItemStack item) { - return GameRegistry.getFuelValue(getItemStack(item)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class RemoveAction implements IUndoableAction { - private final List items; - private final List values; - - public RemoveAction(List items, List values) { - this.items = items; - this.values = values; - } - - @Override - public void apply() { - for (ItemStack item : items) { - FurnaceRecipes.smelting().getSmeltingList().remove(item); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (int i = 0; i < items.size(); i++) { - FurnaceRecipes.smelting().getSmeltingList().put(items.get(i), values.get(i)); - } - } - - @Override - public String describe() { - return "Removing " + items.size() + " furnace recipes"; - } - - @Override - public String describeUndo() { - return "Restoring " + items.size() + " furnace recipes"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddRecipeAction implements IUndoableAction { - private final IIngredient ingredient; - private final ItemStack[] input; - private final ItemStack output; - private final double xp; - - public AddRecipeAction(IIngredient ingredient, ItemStack[] input, ItemStack output, double xp) { - this.ingredient = ingredient; - this.input = input; - this.output = output; - this.xp = xp; - } - - @Override - public void apply() { - for (ItemStack inputStack : input) { - FurnaceRecipes.smelting().func_151394_a(inputStack, output, (float) xp); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (ItemStack inputStack : input) { - FurnaceRecipes.smelting().getSmeltingList().remove(inputStack); - } - } - - @Override - public String describe() { - return "Adding furnace recipe for " + ingredient; - } - - @Override - public String describeUndo() { - return "Removing furnace recipe for " + ingredient; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class SetFuelAction implements IUndoableAction { - private final SetFuelPattern pattern; - - public SetFuelAction(SetFuelPattern pattern) { - this.pattern = pattern; - } - - @Override - public void apply() { - FuelTweaker.INSTANCE.addFuelPattern(pattern); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FuelTweaker.INSTANCE.removeFuelPattern(pattern); - } - - @Override - public String describe() { - return "Setting fuel for " + pattern.getPattern(); - } - - @Override - public String describeUndo() { - return "Removing fuel for " + pattern.getPattern(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/SetFuelPattern.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/SetFuelPattern.java deleted file mode 100644 index af4b7ca..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/furnace/SetFuelPattern.java +++ /dev/null @@ -1,21 +0,0 @@ -package minetweaker.mc172.furnace; - -import minetweaker.api.item.IIngredient; - -public class SetFuelPattern { - private final IIngredient pattern; - private final int value; - - public SetFuelPattern(IIngredient pattern, int value) { - this.pattern = pattern; - this.value = value; - } - - public IIngredient getPattern() { - return pattern; - } - - public int getValue() { - return value; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/game/MCGame.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/game/MCGame.java deleted file mode 100644 index 989b7a1..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/game/MCGame.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.game; - -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.block.IBlockDefinition; -import minetweaker.api.entity.IEntityDefinition; -import minetweaker.api.game.IGame; -import minetweaker.api.item.IItemDefinition; -import minetweaker.api.liquid.ILiquidDefinition; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.world.IBiome; -import minetweaker.mc172.entity.MCEntityDefinition; -import minetweaker.mc172.item.MCItemDefinition; -import minetweaker.mc172.liquid.MCLiquidDefinition; -import minetweaker.mc172.util.MineTweakerHacks; -import minetweaker.mc172.util.MineTweakerPlatformUtils; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; - -/** - * - * @author Stan - */ -public class MCGame implements IGame { - private static final Map TRANSLATIONS = MineTweakerHacks.getTranslations(); - - public static final MCGame INSTANCE = new MCGame(); - - private MCGame() {} - - @Override - public List getItems() { - List result = new ArrayList(); - for (String item : (Set)Item.itemRegistry.getKeys()) { - result.add(new MCItemDefinition(item, (Item) Item.itemRegistry.getObject(item))); - } - return result; - } - - @Override - public List getBlocks() { - List result = new ArrayList(); - for (String block : (Set)Block.blockRegistry.getKeys()) { - result.add(MineTweakerMC.getBlockDefinition((Block) Block.blockRegistry.getObject(block))); - } - - return result; - } - - @Override - public List getLiquids() { - List result = new ArrayList(); - for (Map.Entry entry : FluidRegistry.getRegisteredFluids().entrySet()) { - result.add(new MCLiquidDefinition(entry.getValue())); - } - return result; - } - - @Override - public List getBiomes() { - List result = new ArrayList(); - for (IBiome biome : MineTweakerMC.biomes) { - if (biome != null) { - result.add(biome); - } - } - return result; - } - - @Override - public List getEntities() { - List result = new ArrayList(); - - for (EntityRegistry.EntityRegistration entityRegistration : MineTweakerHacks.getEntityClassRegistrations().values()) { - result.add(new MCEntityDefinition(entityRegistration)); - } - - return result; - } - - @Override - public void setLocalization(String key, String value) { - MineTweakerAPI.apply(new SetTranslation(null, key, value)); - } - - @Override - public void setLocalization(String lang, String key, String value) { - MineTweakerAPI.apply(new SetTranslation(lang, key, value)); - } - - @Override - public String localize(String key) { - return LanguageRegistry.instance().getStringLocalization(key); - } - - @Override - public String localize(String key, String lang) { - return LanguageRegistry.instance().getStringLocalization(key, lang); - } - - // ###################### - // ### Action classes ### - // ###################### - - /** - * Ported from ModTweaker. - * - * @author Joshiejack - */ - private static class SetTranslation implements IUndoableAction { - private String original; - private final String lang; - private final String key; - private final String text; - private boolean added; - - public SetTranslation(String lang, String key, String text) { - this.lang = lang; - this.key = key; - this.text = text; - } - - @Override - public void apply() { - if (lang == null || MineTweakerPlatformUtils.isLanguageActive(lang)) { - original = TRANSLATIONS.get(key); - TRANSLATIONS.put(key, text); - added = true; - } else { - added = false; - } - } - - @Override - public boolean canUndo() { - return TRANSLATIONS != null; - } - - @Override - public void undo() { - if (added) { - if (original == null) { - TRANSLATIONS.remove(key); - } else { - TRANSLATIONS.put(key, original); - } - } - } - - @Override - public String describe() { - return "Setting localization for the key: " + key + " to " + text; - } - - @Override - public String describeUndo() { - return "Setting localization for the key: " + key + " to " + original; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/item/MCItemDefinition.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/item/MCItemDefinition.java deleted file mode 100644 index 3ad57dd..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/item/MCItemDefinition.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.item; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemDefinition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.oredict.IOreDictEntry; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCItemDefinition implements IItemDefinition { - private final String id; - private final Item item; - - public MCItemDefinition(String id, Item item) { - this.id = id; - this.item = item; - } - - @Override - public String getId() { - return id; - } - - @Override - public String getName() { - return item.getUnlocalizedName(); - } - - @Override - public IItemStack makeStack(int meta) { - return MineTweakerMC.getIItemStackWildcardSize(new ItemStack(item, 1, meta)); - } - - @Override - public List getOres() { - List result = new ArrayList(); - - for (String key : OreDictionary.getOreNames()) { - for (ItemStack is : OreDictionary.getOres(key)) { - if (is.getItem() == item) { - result.add(MineTweakerAPI.oreDict.get(key)); - break; - } - } - } - - return result; - } - - // ############################# - // ### Object implementation ### - // ############################# - - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.item != null ? this.item.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MCItemDefinition other = (MCItemDefinition) obj; - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/item/MCItemStack.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/item/MCItemStack.java deleted file mode 100644 index 20f1807..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/item/MCItemStack.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.item; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import minetweaker.MineTweakerAPI; -import minetweaker.api.block.IBlock; -import minetweaker.api.data.DataMap; -import minetweaker.mc172.data.NBTConverter; -import minetweaker.mc172.liquid.MCLiquidStack; -import minetweaker.api.data.IData; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemDefinition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.item.IngredientItem; -import minetweaker.api.item.IngredientOr; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.api.player.IPlayer; -import minetweaker.mc172.actions.SetTranslationAction; -import minetweaker.mc172.block.MCItemBlock; -import minetweaker.util.ArrayUtil; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCItemStack implements IItemStack { - private final ItemStack stack; - private final List items; - private IData tag = null; - private boolean wildcardSize; - - public MCItemStack(ItemStack itemStack) { - if (itemStack == null) throw new IllegalArgumentException("stack cannot be null"); - - stack = itemStack.copy(); - items = Collections.singletonList(this); - } - - public MCItemStack(ItemStack itemStack, boolean wildcardSize) { - this(itemStack); - - this.wildcardSize = wildcardSize; - } - - private MCItemStack(ItemStack itemStack, IData tag) { - if (itemStack == null) throw new IllegalArgumentException("stack cannot be null"); - - stack = itemStack; - items = Collections.singletonList(this); - this.tag = tag; - } - - private MCItemStack(ItemStack itemStack, IData tag, boolean wildcardSize) { - stack = itemStack; - items = Collections.singletonList(this); - this.tag = tag; - this.wildcardSize = wildcardSize; - } - - @Override - public IItemDefinition getDefinition() { - return new MCItemDefinition( - Item.itemRegistry.getNameForObject(stack.getItem()), - stack.getItem()); - } - - @Override - public String getName() { - return stack.getUnlocalizedName(); - } - - @Override - public String getDisplayName() { - return stack.getDisplayName(); - } - - @Override - public void setDisplayName(String name) { - MineTweakerAPI.apply(new SetTranslationAction(getName() + ".name", name)); - } - - @Override - public int getDamage() { - return stack.getItemDamage(); - } - - @Override - public IData getTag() { - if (tag == null) { - if (stack.stackTagCompound == null) { - return DataMap.EMPTY; - } - - tag = NBTConverter.from(stack.stackTagCompound, true); - } - return tag; - } - - @Override - public int getMaxDamage() { - return stack.getMaxDamage(); - } - - @Override - public ILiquidStack getLiquid() { - FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack); - return liquid == null ? null : new MCLiquidStack(liquid); - } - - @Override - public IIngredient anyDamage() { - if (stack.getItem().getHasSubtypes()) { - MineTweakerAPI.logWarning("subitems don't have damaged states"); - return this; - } else { - ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, OreDictionary.WILDCARD_VALUE); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag); - } - } - - @Override - public IItemStack withDamage(int damage) { - if (stack.getItem().getHasSubtypes()) { - MineTweakerAPI.logWarning("subitems don't have damaged states"); - return this; - } else { - ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, damage); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag); - } - } - - @Override - public IItemStack withAmount(int amount) { - ItemStack result = new ItemStack(stack.getItem(), amount, stack.getItemDamage()); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag); - } - - @Override - public IItemStack anyAmount() { - ItemStack result = new ItemStack(stack.getItem(), 1, stack.getItemDamage()); - result.stackTagCompound = stack.stackTagCompound; - return new MCItemStack(result, tag, true); - } - - @Override - public IItemStack withTag(IData tag) { - ItemStack result = new ItemStack(stack.getItem(), stack.stackSize, stack.getItemDamage()); - if (tag == null) { - result.stackTagCompound = null; - } else { - result.stackTagCompound = (NBTTagCompound) NBTConverter.from(tag); - } - return new MCItemStack(result, tag); - } - - @Override - public IItemStack updateTag(IData tagUpdate) { - if (tag == null) { - if (stack.stackTagCompound == null) { - return withTag(tagUpdate); - } - - tag = NBTConverter.from(stack.stackTagCompound, true); - } - - IData updated = tag.update(tagUpdate); - return withTag(updated); - } - - @Override - public String getMark() { - return null; - } - - @Override - public int getAmount() { - return stack.stackSize; - } - - @Override - public List getItems() { - return items; - } - - @Override - public List getLiquids() { - return Collections.emptyList(); - } - - @Override - public IItemStack amount(int amount) { - return withAmount(amount); - } - - @Override - public WeightedItemStack percent(float chance) { - return new WeightedItemStack(this, chance * 0.01f); - } - - @Override - public WeightedItemStack weight(float chance) { - return new WeightedItemStack(this, chance); - } - - @Override - public IIngredient transform(IItemTransformer transformer) { - return new IngredientItem(this, null, ArrayUtil.EMPTY_CONDITIONS, new IItemTransformer[] { transformer }); - } - - @Override - public IIngredient only(IItemCondition condition) { - return new IngredientItem(this, null, new IItemCondition[] { condition }, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient marked(String mark) { - return new IngredientItem(this, mark, ArrayUtil.EMPTY_CONDITIONS, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient or(IIngredient ingredient) { - return new IngredientOr(this, ingredient); - } - - @Override - public boolean matches(IItemStack item) { - ItemStack internal = getItemStack(item); - return internal.getItem() == stack.getItem() - && (wildcardSize || internal.stackSize >= stack.stackSize) - && (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE - || stack.getItemDamage() == internal.getItemDamage() - || (!stack.getHasSubtypes() && !stack.getItem().isDamageable())); - } - - @Override - public boolean matches(ILiquidStack liquid) { - return false; - } - - @Override - public boolean contains(IIngredient ingredient) { - List iitems = ingredient.getItems(); - if (iitems == null || iitems.size() != 1) return false; - return matches(iitems.get(0)); - } - - @Override - public IItemStack applyTransform(IItemStack item, IPlayer byPlayer) { - return item; - } - - @Override - public boolean hasTransformers() { - return false; - } - - @Override - public IBlock asBlock() { - if (Block.getBlockFromItem(stack.getItem()) == null) { - throw new ClassCastException("This item is not a block"); - } else { - return new MCItemBlock(stack); - } - } - - @Override - public Object getInternal() { - return stack; - } - - @Override - public List getOres() { - List result = new ArrayList(); - - for (String key : OreDictionary.getOreNames()) { - for (ItemStack is : OreDictionary.getOres(key)) { - if (is.getItem() == stack.getItem() - && (is.getItemDamage() == OreDictionary.WILDCARD_VALUE || is.getItemDamage() == stack.getItemDamage())) { - result.add(MineTweakerAPI.oreDict.get(key)); - break; - } - } - } - - return result; - } - - // ############################# - // ### Object implementation ### - // ############################# - - @Override - public int hashCode() { - int hash = 7; - hash = 41 * hash + stack.getItem().hashCode(); - hash = 41 * hash + stack.getItemDamage(); - hash = 41 * hash + stack.stackSize; - hash = 41 * hash + (stack.stackTagCompound == null ? 0 : stack.stackTagCompound.hashCode()); - hash = 41 * hash + (this.wildcardSize ? 1 : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MCItemStack other = (MCItemStack) obj; - if (this.stack.getItem() != other.stack.getItem()) return false; - if (this.stack.getItemDamage() != other.stack.getItemDamage()) return false; - if (this.stack.stackSize != other.stack.stackSize) return false; - if (this.stack.stackTagCompound != other.stack.stackTagCompound && (this.stack == null || this.stack.equals(other.stack))) return false; - if (this.wildcardSize != other.wildcardSize) return false; - return true; - } - - @Override - public String toString() { - StringBuilder result = new StringBuilder(); - result.append('<'); - result.append(Item.itemRegistry.getNameForObject(stack.getItem())); - - if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - result.append(":*"); - } else if (stack.getItemDamage() > 0) { - result.append(':').append(stack.getItemDamage()); - } - result.append('>'); - - if (stack.getTagCompound() != null) { - result.append(".withTag("); - result.append(NBTConverter.from(stack.getTagCompound(), wildcardSize).toString()); - result.append(")"); - } - - if (!wildcardSize) { - result.append(" * ").append(stack.stackSize); - } - - return result.toString(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/liquid/MCLiquidDefinition.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/liquid/MCLiquidDefinition.java deleted file mode 100644 index a1ee39c..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/liquid/MCLiquidDefinition.java +++ /dev/null @@ -1,434 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.liquid; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidDefinition; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -/** - * - * @author Stan - */ -public class MCLiquidDefinition implements ILiquidDefinition { - private final Fluid fluid; - - public MCLiquidDefinition(Fluid fluid) { - this.fluid = fluid; - } - - @Override - public String getName() { - return fluid.getName(); - } - - @Override - public String getDisplayName() { - return fluid.getLocalizedName(); - } - - @Override - public ILiquidStack asStack(int millibuckets) { - return new MCLiquidStack(new FluidStack(fluid, millibuckets)); - } - - @Override - public int getLuminosity() { - return fluid.getLuminosity(); - } - - @Override - public void setLuminosity(int value) { - MineTweakerAPI.apply(new ActionSetLuminosity(value)); - } - - @Override - public int getDensity() { - return fluid.getDensity(); - } - - @Override - public void setDensity(int density) { - MineTweakerAPI.apply(new ActionSetDensity(density)); - } - - @Override - public int getTemperature() { - return fluid.getTemperature(); - } - - @Override - public void setTemperature(int temperature) { - MineTweakerAPI.apply(new ActionSetTemperature(temperature)); - } - - @Override - public int getViscosity() { - return fluid.getViscosity(); - } - - @Override - public void setViscosity(int viscosity) { - MineTweakerAPI.apply(new ActionSetViscosity(viscosity)); - } - - @Override - public boolean isGaseous() { - return fluid.isGaseous(); - } - - @Override - public void setGaseous(boolean gaseous) { - MineTweakerAPI.apply(new ActionSetGaseous(gaseous)); - } - - @Override - public List getContainers() { - List result = new ArrayList(); - for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.fluid.getFluid() == fluid) { - result.add(MineTweakerMC.getIItemStack(data.filledContainer)); - } - } - return result; - } - - @Override - public void addContainer(IItemStack filled, IItemStack empty, int amount) { - MineTweakerAPI.apply(new AddContainerAction(filled, empty, amount)); - } - - @Override - public void removeContainer(IItemStack filled) { - //MineTweakerAPI.apply(new RemoveContainerAction(filled)); - MineTweakerAPI.logError("Cannot remove container items in MineCraft 1.7.X"); - } - - // ####################### - // ### Private methods ### - // ####################### - - /*private void removeContainerInner(IItemStack filled) { - ItemStack filledItem = MineTweakerMC.getItemStack(filled); - FluidContainerRegistry.FluidContainerData data = filledContainerMap.get(Arrays.asList(filledItem.itemID, filledItem.getItemDamage())); - if (data != null) { - filledContainerMap.remove(Arrays.asList(filledItem.itemID, filledItem.getItemDamage())); - containerFluidMap.remove(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage())); - - // rebuild empty containers set - emptyContainers.clear(); - for (FluidContainerRegistry.FluidContainerData fdata : filledContainerMap.values()) { - emptyContainers.add(Arrays.asList(fdata.emptyContainer.itemID, fdata.emptyContainer.getItemDamage())); - } - } - MineTweakerAPI.logError("Removal of containers is not possible in 1.7.X"); - }*/ - - /*private FluidContainerRegistry.FluidContainerData getData(IItemStack filled) { - ItemStack filledStack = MineTweakerMC.getItemStack(filled); - return filledContainerMap.get(Arrays.asList(filledStack.itemID, filledStack.getItemDamage())); - }*/ - - // ###################### - // ### Action classes ### - // ###################### - - private class AddContainerAction implements IUndoableAction { - private final IItemStack filled; - private final IItemStack empty; - private final int amount; - - public AddContainerAction(IItemStack filled, IItemStack empty, int amount) { - this.filled = filled; - this.empty = empty; - this.amount = amount; - } - - @Override - public void apply() { - FluidContainerRegistry.registerFluidContainer(new FluidStack(fluid, amount), MineTweakerMC.getItemStack(filled), MineTweakerMC.getItemStack(empty)); - } - - @Override - public boolean canUndo() { - return false; - //return true; - } - - @Override - public void undo() { - //removeContainerInner(filled); - } - - @Override - public String describe() { - return "Adding " + filled.getDisplayName() + " as liquid container for " + fluid.getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Removing liquid container " + filled; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - /*private class RemoveContainerAction implements IUndoableAction { - private final IItemStack filled; - private final IItemStack empty; - private final FluidStack amount; - - public RemoveContainerAction(IItemStack filled) { - this.filled = filled; - - FluidContainerRegistry.FluidContainerData data = getData(filled); - empty = MineTweakerMC.getIItemStack(data.emptyContainer); - amount = data.fluid; - } - - @Override - public void apply() { - removeContainerInner(filled); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - FluidContainerRegistry.registerFluidContainer(amount, MineTweakerMC.getItemStack(filled), MineTweakerMC.getItemStack(empty)); - } - - @Override - public String describe() { - return "Removing liquid container " + filled; - } - - @Override - public String describeUndo() { - return "Restoring liquid container " + filled; - } - - @Override - public Object getOverrideKey() { - return null; - } - }*/ - - private class ActionSetLuminosity implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetLuminosity(int newValue) { - oldValue = getLuminosity(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setLuminosity(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setLuminosity(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " luminosity to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " luminosity to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetDensity implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetDensity(int newValue) { - oldValue = getDensity(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setDensity(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setDensity(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " density to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " density to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetTemperature implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetTemperature(int newValue) { - oldValue = getTemperature(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setTemperature(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setTemperature(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " temperature to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " temperature to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetViscosity implements IUndoableAction { - private final int oldValue; - private final int newValue; - - public ActionSetViscosity(int newValue) { - oldValue = getViscosity(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setViscosity(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setViscosity(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " viscosity to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " viscosity to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionSetGaseous implements IUndoableAction { - private final boolean oldValue; - private final boolean newValue; - - public ActionSetGaseous(boolean newValue) { - oldValue = isGaseous(); - this.newValue = newValue; - } - - @Override - public void apply() { - fluid.setGaseous(newValue); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - fluid.setGaseous(oldValue); - } - - @Override - public String describe() { - return "Setting " + fluid.getName() + " gaseous to " + newValue; - } - - @Override - public String describeUndo() { - return "Restoring " + fluid.getName() + " gaseous to " + oldValue; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/liquid/MCLiquidStack.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/liquid/MCLiquidStack.java deleted file mode 100644 index e88e839..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/liquid/MCLiquidStack.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.liquid; - -import java.util.Collections; -import java.util.List; -import minetweaker.api.data.IData; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.item.IngredientOr; -import minetweaker.api.liquid.ILiquidDefinition; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIData; -import static minetweaker.api.minecraft.MineTweakerMC.getNBTCompound; -import minetweaker.api.player.IPlayer; -import net.minecraftforge.fluids.FluidStack; - -/** - * - * @author Stan - */ -public class MCLiquidStack implements ILiquidStack { - private final FluidStack stack; - private IData tag = null; - - public MCLiquidStack(FluidStack stack) { - this.stack = stack; - } - - private MCLiquidStack(FluidStack stack, IData tag) { - this.stack = stack; - this.tag = tag; - } - - @Override - public ILiquidDefinition getDefinition() { - return new MCLiquidDefinition(stack.getFluid()); - } - - @Override - public String getName() { - return stack.getFluid().getName(); - } - - @Override - public String getDisplayName() { - return stack.getFluid().getLocalizedName(); - } - - @Override - public int getAmount() { - return stack.amount; - } - - @Override - public IData getTag() { - if (tag == null) { - if (stack.tag == null) { - return null; - } - - tag = getIData(stack.tag); - } - - return tag; - } - - @Override - public ILiquidStack withTag(IData data) { - FluidStack result = new FluidStack(stack.fluidID, stack.amount); - result.tag = getNBTCompound(data); - return new MCLiquidStack(result, data.immutable()); - } - - @Override - public ILiquidStack withAmount(int amount) { - FluidStack result = new FluidStack(stack.fluidID, amount); - result.tag = stack.tag; - return new MCLiquidStack(result, tag); - } - - @Override - public int getLuminosity() { - return stack.getFluid().getLuminosity(stack); - } - - @Override - public int getDensity() { - return stack.getFluid().getDensity(stack); - } - - @Override - public int getTemperature() { - return stack.getFluid().getTemperature(stack); - } - - @Override - public int getViscosity() { - return stack.getFluid().getViscosity(stack); - } - - @Override - public boolean isGaseous() { - return stack.getFluid().isGaseous(stack); - } - - @Override - public Object getInternal() { - return stack; - } - - // ################################## - // ### IIngredient implementation ### - // ################################## - - @Override - public String getMark() - { - return null; - } - - @Override - public List getItems() - { - return Collections.emptyList(); - } - - @Override - public List getLiquids() - { - return Collections.singletonList(this); - } - - @Override - public IIngredient amount(int amount) - { - return withAmount(amount); - } - - @Override - public IIngredient or(IIngredient ingredient) - { - return new IngredientOr(this, ingredient); - } - - @Override - public IIngredient transform(IItemTransformer transformer) - { - throw new UnsupportedOperationException("Liquid stack can't have transformers"); - } - - @Override - public IIngredient only(IItemCondition condition) - { - throw new UnsupportedOperationException("Liquid stack can't have conditions"); - } - - @Override - public IIngredient marked(String mark) - { - throw new UnsupportedOperationException("Liquid stack can't be marked"); - } - - @Override - public boolean matches(IItemStack item) - { - return false; - } - - @Override - public boolean matches(ILiquidStack liquid) - { - return getDefinition().equals(liquid.getDefinition()) - && getAmount() <= liquid.getAmount(); - } - - @Override - public boolean contains(IIngredient ingredient) - { - if (!ingredient.getItems().isEmpty()) - return false; - - for (ILiquidStack liquid : ingredient.getLiquids()) - { - if (!matches(liquid)) - return false; - } - - return false; - } - - @Override - public IItemStack applyTransform(IItemStack item, IPlayer byPlayer) - { - return item; - } - - @Override - public boolean hasTransformers() - { - return false; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/mods/MCLoadedMods.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/mods/MCLoadedMods.java deleted file mode 100644 index 53cfbad..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/mods/MCLoadedMods.java +++ /dev/null @@ -1,44 +0,0 @@ -package minetweaker.mc172.mods; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import java.util.Iterator; -import java.util.List; -import minetweaker.api.mods.ILoadedMods; -import minetweaker.api.mods.IMod; -import stanhebben.zenscript.util.MappingIterator; - -/** - * - * @author Stan - */ -public class MCLoadedMods implements ILoadedMods { - public MCLoadedMods() {} - - @Override - public boolean contains(String name) { - return Loader.isModLoaded(name); - } - - @Override - public IMod get(String name) { - for (ModContainer mod : Loader.instance().getActiveModList()) { - if (mod.getModId().equals(name)) { - return new MCMod(mod); - } - } - - return null; - } - - @Override - public Iterator iterator() { - List mods = Loader.instance().getActiveModList(); - return new MappingIterator(mods.iterator()) { - @Override - public IMod map(ModContainer value) { - return new MCMod(value); - } - }; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/mods/MCMod.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/mods/MCMod.java deleted file mode 100644 index 5c3eba7..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/mods/MCMod.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.mods; - -import cpw.mods.fml.common.ModContainer; -import minetweaker.api.mods.IMod; - -/** - * - * @author Stan - */ -public class MCMod implements IMod { - private final ModContainer mod; - - public MCMod(ModContainer mod) { - this.mod = mod; - } - - @Override - public String getId() { - return mod.getModId(); - } - - @Override - public String getName() { - return mod.getName(); - } - - @Override - public String getVersion() { - return mod.getVersion(); - } - - @Override - public String getDescription() { - return mod.getMetadata().description; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerCopyClipboardHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerCopyClipboardHandler.java deleted file mode 100644 index 512696d..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerCopyClipboardHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.network; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import java.awt.Desktop; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; - -/** - * - * @author Stan - */ -public class MineTweakerCopyClipboardHandler implements IMessageHandler { - @Override - public IMessage onMessage(MineTweakerCopyClipboardPacket message, MessageContext ctx) { - if (Desktop.isDesktopSupported()) { - StringSelection stringSelection = new StringSelection(message.getData()); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(stringSelection, null); - } - - return null; - } -} \ No newline at end of file diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerCopyClipboardPacket.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerCopyClipboardPacket.java deleted file mode 100644 index f8b3aab..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerCopyClipboardPacket.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.network; - -import static com.google.common.base.Charsets.UTF_8; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import io.netty.buffer.ByteBuf; -import java.nio.ByteBuffer; - -/** - * - * @author Stan - */ -public class MineTweakerCopyClipboardPacket implements IMessage -{ - private String data; - - public MineTweakerCopyClipboardPacket() { - } - - public MineTweakerCopyClipboardPacket(String data) { - this.data = data; - } - - public String getData() { - return data; - } - - @Override - public void fromBytes(ByteBuf buf) { - data = UTF_8.decode(ByteBuffer.wrap(buf.array())).toString().trim(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeBytes(UTF_8.encode(data).array()); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerLoadScriptsHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerLoadScriptsHandler.java deleted file mode 100644 index d4ef7c4..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerLoadScriptsHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.network; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import minetweaker.MineTweakerAPI; -import minetweaker.MineTweakerImplementationAPI; -import minetweaker.mc172.client.MCClient; -import minetweaker.runtime.providers.ScriptProviderMemory; - -/** - * - * @author Stan - */ -public class MineTweakerLoadScriptsHandler implements IMessageHandler { - @Override - public IMessage onMessage(MineTweakerLoadScriptsPacket message, MessageContext ctx) { - if (MineTweakerAPI.server == null) { - MineTweakerAPI.client = new MCClient(); - - MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderMemory(message.getData())); - MineTweakerImplementationAPI.reload(); - } - - return null; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerLoadScriptsPacket.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerLoadScriptsPacket.java deleted file mode 100644 index 6a67480..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerLoadScriptsPacket.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.network; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import io.netty.buffer.ByteBuf; - -/** - * - * @author Stan - */ -public class MineTweakerLoadScriptsPacket implements IMessage { - private byte[] data; - - public MineTweakerLoadScriptsPacket() { - // used for deserialization - } - - public MineTweakerLoadScriptsPacket(byte[] data) { - this.data = data; - } - - public byte[] getData() { - return data; - } - - @Override - public void fromBytes(ByteBuf buf) { - int size = buf.readInt(); - data = new byte[size]; - buf.readBytes(data); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(data.length); - buf.writeBytes(data); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerOpenBrowserHandler.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerOpenBrowserHandler.java deleted file mode 100644 index 45c1769..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerOpenBrowserHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.network; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * - * @author Stan - */ -public class MineTweakerOpenBrowserHandler implements IMessageHandler { - @Override - public IMessage onMessage(MineTweakerOpenBrowserPacket message, MessageContext ctx) { - if(Desktop.isDesktopSupported()){ - Desktop desktop = Desktop.getDesktop(); - try { - desktop.browse(new URI(message.getUrl())); - } catch (IOException e) { - } catch (URISyntaxException e) { - } - } - - return null; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerOpenBrowserPacket.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerOpenBrowserPacket.java deleted file mode 100644 index 5505de3..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/network/MineTweakerOpenBrowserPacket.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.network; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import io.netty.buffer.ByteBuf; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; - -/** - * - * @author Stan - */ -public class MineTweakerOpenBrowserPacket implements IMessage { - private static final Charset UTF8 = Charset.forName("utf-8"); - - private String url; - - public MineTweakerOpenBrowserPacket() { - - } - - public MineTweakerOpenBrowserPacket(String url) { - this.url = url; - } - - public String getUrl() { - return url; - } - - @Override - public void fromBytes(ByteBuf buf) { - url = UTF8.decode(ByteBuffer.wrap(buf.array())).toString().trim(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeBytes(UTF8.encode(url).array()); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/oredict/MCOreDict.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/oredict/MCOreDict.java deleted file mode 100644 index 5055dc5..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/oredict/MCOreDict.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.oredict; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getOreDict; -import minetweaker.api.oredict.IOreDict; -import minetweaker.api.oredict.IOreDictEntry; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCOreDict implements IOreDict { - @Override - public IOreDictEntry get(String name) { - return getOreDict(name); - } - - @Override - public List getEntries() { - List entries = new ArrayList(); - for (String key : OreDictionary.getOreNames()) { - if (!OreDictionary.getOres(key).isEmpty()) { - entries.add(MineTweakerMC.getOreDict(key)); - } - } - return entries; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/oredict/MCOreDictEntry.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/oredict/MCOreDictEntry.java deleted file mode 100644 index 2825531..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/oredict/MCOreDictEntry.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.oredict; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.mc172.util.MineTweakerHacks; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.item.IngredientOr; -import minetweaker.api.item.IngredientStack; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStackWildcardSize; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.oredict.IOreDictEntry; -import minetweaker.api.oredict.IngredientOreDict; -import minetweaker.api.player.IPlayer; -import minetweaker.util.ArrayUtil; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -/** - * - * @author Stan - */ -public class MCOreDictEntry implements IOreDictEntry { - private static final List> OREDICT_CONTENTS = MineTweakerHacks.getOreIdStacks(); - private static final List> OREDICT_CONTENTS_UN = MineTweakerHacks.getOreIdStacksUn(); - - private final int id; - - public MCOreDictEntry(Integer id) { - this.id = id; - } - - public MCOreDictEntry(String id) { - this.id = OreDictionary.getOreID(id); - } - - // #################################### - // ### IOreDictEntry implementation ### - // #################################### - - @Override - public String getName() { - return OreDictionary.getOreName(id); - } - - @Override - public boolean isEmpty() { - return OreDictionary.getOres(id).isEmpty(); - } - - @Override - public void add(IItemStack item) { - ItemStack stack = getItemStack(item); - if (stack != null) { - MineTweakerAPI.apply(new ActionAddItem(id, stack)); - } - } - - @Override - public void addAll(IOreDictEntry entry) { - if (entry instanceof MCOreDictEntry) { - MineTweakerAPI.apply(new ActionAddAll(id, ((MCOreDictEntry) entry).id)); - } else { - MineTweakerAPI.logError("not a valid entry"); - } - } - - @Override - public void remove(IItemStack item) { - ItemStack result = null; - for (ItemStack itemStack : OreDictionary.getOres(id)) { - if (item.matches(getIItemStackWildcardSize(itemStack))) { - result = itemStack; - break; - } - } - - if (result != null) { - MineTweakerAPI.apply(new ActionRemoveItem(id, result)); - } - } - - @Override - public boolean contains(IItemStack item) { - for (ItemStack itemStack : OreDictionary.getOres(id)) { - if (getIItemStackWildcardSize(itemStack).matches(item)) { - return true; - } - } - - return false; - } - - @Override - public void mirror(IOreDictEntry other) { - if (other instanceof MCOreDictEntry) { - MineTweakerAPI.apply(new ActionMirror(id, ((MCOreDictEntry) other).id)); - } else { - MineTweakerAPI.logError("not a valid oredict entry"); - } - } - - @Override - public String getMark() { - return null; - } - - @Override - public int getAmount() { - return 1; - } - - @Override - public List getItems() { - List result = new ArrayList(); - for (ItemStack item : OreDictionary.getOres(id)) { - result.add(getIItemStackWildcardSize(item)); - } - return result; - } - - @Override - public List getLiquids() { - return Collections.emptyList(); - } - - @Override - public IIngredient amount(int amount) { - return new IngredientStack(this, amount); - } - - @Override - public IIngredient transform(IItemTransformer transformer) { - return new IngredientOreDict(this, null, ArrayUtil.EMPTY_CONDITIONS, new IItemTransformer[] { transformer }); - } - - @Override - public IIngredient only(IItemCondition condition) { - return new IngredientOreDict(this, null, new IItemCondition[] { condition }, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient marked(String mark) { - return new IngredientOreDict(this, mark, ArrayUtil.EMPTY_CONDITIONS, ArrayUtil.EMPTY_TRANSFORMERS); - } - - @Override - public IIngredient or(IIngredient ingredient) { - return new IngredientOr(this, ingredient); - } - - @Override - public boolean matches(IItemStack item) { - return contains(item); - } - - @Override - public boolean matches(ILiquidStack liquid) { - return false; - } - - @Override - public boolean contains(IIngredient ingredient) { - List items = ingredient.getItems(); - for (IItemStack item : items) { - if (!matches(item)) return false; - } - - return true; - } - - @Override - public IItemStack applyTransform(IItemStack item, IPlayer byPlayer) { - return item; - } - - @Override - public boolean hasTransformers() { - return false; - } - - @Override - public Object getInternal() { - return OreDictionary.getOreName(id); - } - - // ############################# - // ### Object implementation ### - // ############################# - - @Override - public String toString() { - return ""; - } - - @Override - public int hashCode() { - return id; - } - - @Override - public boolean equals(Object other) { - if (!(other instanceof MCOreDictEntry)) return false; - return ((MCOreDictEntry) other).id == id; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class ActionAddItem implements IUndoableAction { - private final Integer id; - private final ItemStack item; - - public ActionAddItem(Integer id, ItemStack item) { - this.id = id; - this.item = item; - } - - @Override - public void apply() { - OreDictionary.registerOre(id, item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - OREDICT_CONTENTS.get(id).remove(item); - } - - @Override - public String describe() { - return "Adding " + item.getDisplayName() + " to ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public String describeUndo() { - return "Removing " + item.getDisplayName() + " from ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class ActionMirror implements IUndoableAction { - private final Integer idTarget; - private final Integer idSource; - - private final ArrayList targetCopy; - private final ArrayList targetCopyUn; - - public ActionMirror(Integer idTarget, Integer idSource) { - this.idTarget = idTarget; - this.idSource = idSource; - - targetCopy = OREDICT_CONTENTS.get(idTarget); - targetCopyUn = OREDICT_CONTENTS_UN.get(idTarget); - } - - @Override - public void apply() { - OREDICT_CONTENTS.set(idTarget, OREDICT_CONTENTS.get(idSource)); - OREDICT_CONTENTS_UN.set(idTarget, OREDICT_CONTENTS_UN.get(idSource)); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - OREDICT_CONTENTS.set(idTarget, targetCopy); - OREDICT_CONTENTS_UN.set(idTarget, targetCopyUn); - } - - @Override - public String describe() { - return "Mirroring " + OreDictionary.getOreName(idSource) + " to " + OreDictionary.getOreName(idTarget); - } - - @Override - public String describeUndo() { - return "Undoing mirror of " + OreDictionary.getOreName(idSource) + " to " + OreDictionary.getOreName(idTarget); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class ActionRemoveItem implements IUndoableAction { - private final Integer id; - private final ItemStack item; - - public ActionRemoveItem(Integer id, ItemStack item) { - this.id = id; - this.item = item; - } - - @Override - public void apply() { - OREDICT_CONTENTS.get(id).remove(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - OREDICT_CONTENTS.get(id).add(item); - } - - @Override - public String describe() { - return "Removing " + item.getDisplayName() + " from ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public String describeUndo() { - return "Restoring " + item.getDisplayName() + " to ore dictionary entry " + OreDictionary.getOreName(id); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class ActionAddAll implements IUndoableAction { - private final Integer idTarget; - private final Integer idSource; - - public ActionAddAll(Integer idTarget, Integer idSource) { - this.idTarget = idTarget; - this.idSource = idSource; - } - - @Override - public void apply() { - List ores = OreDictionary.getOres(idTarget); - for (ItemStack stack : OreDictionary.getOres(idSource)) { - ores.add(stack); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - List ores = OreDictionary.getOres(idTarget); - for (ItemStack stack : OreDictionary.getOres(idSource)) { - ores.remove(stack); - } - } - - @Override - public String describe() { - return "Copying contents of ore dictionary entry " + OreDictionary.getOreName(idSource) + " to " + OreDictionary.getOreName(idTarget); - } - - @Override - public String describeUndo() { - return "Removing contents of ore dictionary entry " + OreDictionary.getOreName(idSource) + " from " + OreDictionary.getOreName(idTarget); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/player/MCPlayer.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/player/MCPlayer.java deleted file mode 100644 index 847ee5b..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/player/MCPlayer.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.player; - -import minetweaker.MineTweakerAPI; -import minetweaker.api.chat.IChatMessage; -import minetweaker.api.data.IData; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.mc172.MineTweakerMod; -import minetweaker.mc172.data.NBTConverter; -import minetweaker.mc172.network.MineTweakerCopyClipboardPacket; -import minetweaker.mc172.network.MineTweakerOpenBrowserPacket; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; - -/** - * - * @author Stan - */ -public class MCPlayer implements IPlayer { - private final EntityPlayer player; - - public MCPlayer(EntityPlayer player) { - if (player == null) throw new IllegalArgumentException("player cannot be null"); - this.player = player; - } - - public EntityPlayer getInternal() { - return player; - } - - @Override - public String getId() { - return null; - } - - @Override - public String getName() { - return player.getCommandSenderName(); - } - - @Override - public IData getData() { - return NBTConverter.from(player.getEntityData(), true); - } - - @Override - public void update(IData data) { - NBTConverter.updateMap(player.getEntityData(), data); - } - - @Override - public void sendChat(IChatMessage message) { - Object internal = message.getInternal(); - if (!(internal instanceof IChatComponent)) { - MineTweakerAPI.logError("not a valid chat message"); - return; - } - player.addChatMessage((IChatComponent) internal); - } - - @Override - public void sendChat(String message) { - player.addChatMessage(new ChatComponentText(message)); - } - - @Override - public int getHotbarSize() { - return 9; - } - - @Override - public IItemStack getHotbarStack(int i) { - return i < 0 || i >= 9 ? null : MineTweakerMC.getIItemStack(player.inventory.getStackInSlot(i)); - } - - @Override - public int getInventorySize() { - return player.inventory.getSizeInventory(); - } - - @Override - public IItemStack getInventoryStack(int i) { - return MineTweakerMC.getIItemStack(player.inventory.getStackInSlot(i)); - } - - @Override - public IItemStack getCurrentItem() { - return MineTweakerMC.getIItemStack(player.getCurrentEquippedItem()); - } - - @Override - public boolean isCreative() { - return player.capabilities.isCreativeMode; - } - - @Override - public boolean isAdventure() { - return !player.capabilities.allowEdit; - } - - @Override - public void openBrowser(String url) { - if (player instanceof EntityPlayerMP) { - MineTweakerMod.NETWORK.sendTo( - new MineTweakerOpenBrowserPacket(url), - (EntityPlayerMP) player); - } - } - - @Override - public void copyToClipboard(String value) { - if (player instanceof EntityPlayerMP) { - MineTweakerMod.NETWORK.sendTo( - new MineTweakerCopyClipboardPacket(value), - (EntityPlayerMP) player); - } - } - - @Override - public void give(IItemStack stack) { - player.inventory.addItemStackToInventory(MineTweakerMC.getItemStack(stack).copy()); - } - - @Override - public boolean equals(Object other) { - if (other.getClass() != this.getClass()) - return false; - - return ((MCPlayer) other).player == player; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 23 * hash + (this.player != null ? this.player.hashCode() : 0); - return hash; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/MCCraftingInventory.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/MCCraftingInventory.java deleted file mode 100644 index cc12df2..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/MCCraftingInventory.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import java.util.List; -import minetweaker.mc172.util.MineTweakerHacks; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIPlayer; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.player.IPlayer; -import minetweaker.api.recipes.ICraftingInventory; -import minetweaker.mc172.player.MCPlayer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotCrafting; -import net.minecraft.item.ItemStack; - -/** - * - * @author Stan - */ -public class MCCraftingInventory implements ICraftingInventory { - private static final ThreadLocal cache = new ThreadLocal(); - private static final ThreadLocal cache2 = new ThreadLocal(); - - public static MCCraftingInventory get(InventoryCrafting inventory) { - if (cache.get() == null || cache.get().inventory != inventory) { - MCCraftingInventory result = new MCCraftingInventory(inventory); - cache.set(result); - return result; - } else { - MCCraftingInventory result = cache.get(); - result.update(); - return result; - } - } - - public static MCCraftingInventory get(IInventory inventory, EntityPlayer player) { - if (cache2.get() == null || cache2.get().inventory != inventory || cache2.get().player != player) { - MCCraftingInventory result = new MCCraftingInventory(inventory, player); - cache2.set(result); - return result; - } else { - MCCraftingInventory result = cache2.get(); - result.update(); - return result; - } - } - - private int width; - private int height; - private final IInventory inventory; - private IItemStack[] stacks; - private ItemStack[] original; - private int stackCount; - private final IPlayer player; - private final EntityPlayer playerOrig; - - private MCCraftingInventory(InventoryCrafting inventory) { - this.inventory = inventory; - width = height = (int) Math.sqrt(inventory.getSizeInventory()); - stacks = new IItemStack[width * height]; - original = new ItemStack[stacks.length]; - stackCount = 0; - update(); - - Container container = MineTweakerHacks.getCraftingContainer(inventory); - if (container != null) { - List slots = container.inventorySlots; - if (!slots.isEmpty() && slots.get(0) instanceof SlotCrafting) { - SlotCrafting slotCrafting = (SlotCrafting) slots.get(0); - playerOrig = MineTweakerHacks.getCraftingSlotPlayer(slotCrafting); - player = getIPlayer(playerOrig); - } else { - playerOrig = null; - player = null; - } - } else { - playerOrig = null; - player = null; - } - } - - public MCCraftingInventory(IInventory inventory, EntityPlayer player) { - this.inventory = inventory; - width = height = (int) Math.sqrt(inventory.getSizeInventory()); - stacks = new IItemStack[width * height]; - original = new ItemStack[stacks.length]; - stackCount = 0; - update(); - - playerOrig = player; - this.player = player == null ? null : new MCPlayer(player); - } - - private void update() { - if (inventory.getSizeInventory() != original.length) { - width = height = (int) Math.sqrt(inventory.getSizeInventory()); - stacks = new IItemStack[inventory.getSizeInventory()]; - original = new ItemStack[stacks.length]; - stackCount = 0; - } - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - if (changed(i)) { - //System.out.println("Slot " + i + " changed"); - original[i] = inventory.getStackInSlot(i); - if (inventory.getStackInSlot(i) != null) { - if (stacks[i] == null) stackCount++; - stacks[i] = getIItemStack(original[i]); - } else { - if (stacks[i] != null) stackCount--; - stacks[i] = null; - } - } - } - //System.out.println("Num stack count: " + stackCount); - } - - @Override - public IPlayer getPlayer() { - return player; - } - - @Override - public int getSize() { - return width * height; - } - - @Override - public int getWidth() { - return width; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public int getStackCount() { - return stackCount; - } - - @Override - public IItemStack getStack(int i) { - return stacks[i]; - } - - @Override - public IItemStack getStack(int x, int y) { - return stacks[y * width + x]; - } - - @Override - public void setStack(int x, int y, IItemStack stack) { - //System.out.println("SetStack(" + x + ", " + y + ") " + stack); - - int ix = y * width + x; - if (stack != stacks[ix]) { - if (stack == null) { - stackCount--; - inventory.setInventorySlotContents(ix, null); - } else { - inventory.setInventorySlotContents(ix, getItemStack(stack)); - - if (stacks[ix] == null) { - stackCount++; - } - } - stacks[ix] = stack; - } - } - - @Override - public void setStack(int i, IItemStack stack) { - //System.out.println("SetStack(" + i + ") " + stack); - - if (stack != stacks[i]) { - if (stack == null) { - stackCount--; - inventory.setInventorySlotContents(i, null); - } else { - inventory.setInventorySlotContents(i, getItemStack(stack)); - - if (stacks[i] == null) { - stackCount++; - } - } - stacks[i] = stack; - } - } - - private boolean changed(int i) { - if (original[i] != inventory.getStackInSlot(i)) return true; - if (original[i] != null && stacks[i].getAmount() != original[i].stackSize) return true; - - return false; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/MCRecipeManager.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/MCRecipeManager.java deleted file mode 100644 index 20b6070..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/MCRecipeManager.java +++ /dev/null @@ -1,419 +0,0 @@ -package minetweaker.mc172.recipes; - -import minetweaker.api.recipes.ShapedRecipe; -import minetweaker.api.recipes.ShapelessRecipe; -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.mc172.util.MineTweakerHacks; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getOreDict; -import minetweaker.api.player.IPlayer; -import minetweaker.api.recipes.ICraftingInventory; -import minetweaker.api.recipes.ICraftingRecipe; -import minetweaker.api.recipes.IRecipeFunction; -import minetweaker.api.recipes.IRecipeManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -/** - * - * @author Stan - */ -public class MCRecipeManager implements IRecipeManager { - private final List recipes; - private final List transformerRecipes; - - public MCRecipeManager() { - recipes = (List) CraftingManager.getInstance().getRecipeList(); - transformerRecipes = new ArrayList(); - } - - public boolean hasTransformerRecipes() { - return transformerRecipes.size() > 0; - } - - public void applyTransformations(ICraftingInventory inventory, IPlayer byPlayer) { - for (ICraftingRecipe recipe : transformerRecipes) { - if (recipe.matches(inventory)) { - recipe.applyTransformers(inventory, byPlayer); - return; - } - } - } - - @Override - public List getRecipesFor(IIngredient ingredient) { - List results = new ArrayList(); - - for (IRecipe recipe : recipes) { - if (ingredient.matches(MineTweakerMC.getIItemStack(recipe.getRecipeOutput()))) { - ICraftingRecipe converted = RecipeConverter.toCraftingRecipe(recipe); - results.add(converted); - } - } - - return results; - } - - @Override - public List getAll() { - List results = new ArrayList(); - - for (IRecipe recipe : recipes) { - ICraftingRecipe converted = RecipeConverter.toCraftingRecipe(recipe); - results.add(converted); - } - - return results; - } - - @Override - public int remove(IIngredient output) { - List toRemove = new ArrayList(); - List removeIndex = new ArrayList(); - for (int i = 0; i < recipes.size(); i++) { - IRecipe recipe = recipes.get(i); - - // certain special recipes have no predefined output. ignore those - // since these cannot be removed with MineTweaker scripts - if (recipe.getRecipeOutput() != null) { - if (output.matches(getIItemStack(recipe.getRecipeOutput()))) { - toRemove.add(recipe); - removeIndex.add(i); - } - } - } - - MineTweakerAPI.apply(new ActionRemoveRecipes(toRemove, removeIndex)); - return toRemove.size(); - } - - @Override - public void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) { - addShaped(output, ingredients, function, false); - } - - @Override - public void addShapedMirrored(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function) { - addShaped(output, ingredients, function, true); - } - - @Override - public void addShapeless(IItemStack output, IIngredient[] ingredients, IRecipeFunction function) { - ShapelessRecipe recipe = new ShapelessRecipe(output, ingredients, function); - IRecipe irecipe = RecipeConverter.convert(recipe); - MineTweakerAPI.apply(new ActionAddRecipe(irecipe, recipe)); - } - - @Override - public int removeShaped(IIngredient output, IIngredient[][] ingredients) { - int ingredientsWidth = 0; - int ingredientsHeight = 0; - - if (ingredients != null) { - ingredientsHeight = ingredients.length; - - for (int i = 0; i < ingredients.length; i++) { - ingredientsWidth = Math.max(ingredientsWidth, ingredients[i].length); - } - } - - List toRemove = new ArrayList(); - List removeIndex = new ArrayList(); - outer: for (int i = 0; i < recipes.size(); i++) { - IRecipe recipe = recipes.get(i); - - if (recipe.getRecipeOutput() == null || !output.matches(getIItemStack(recipe.getRecipeOutput()))) { - continue; - } - - if (ingredients != null) { - if (recipe instanceof ShapedRecipes) { - ShapedRecipes srecipe = (ShapedRecipes) recipe; - if (ingredientsWidth != srecipe.recipeWidth || ingredientsHeight != srecipe.recipeHeight) { - continue; - } - - for (int j = 0; j < ingredientsHeight; j++) { - IIngredient[] row = ingredients[j]; - for (int k = 0; k < ingredientsWidth; k++) { - IIngredient ingredient = k > row.length ? null : row[k]; - ItemStack recipeIngredient = srecipe.recipeItems[j * srecipe.recipeWidth + k]; - - if (!matches(recipeIngredient, ingredient)) { - continue outer; - } - } - } - } else if (recipe instanceof ShapedOreRecipe) { - ShapedOreRecipe srecipe = (ShapedOreRecipe) recipe; - int recipeWidth = MineTweakerHacks.getShapedOreRecipeWidth(srecipe); - int recipeHeight = srecipe.getRecipeSize() / recipeWidth; - if (ingredientsWidth != recipeWidth || ingredientsHeight != recipeHeight) { - continue; - } - - for (int j = 0; j < ingredientsHeight; j++) { - IIngredient[] row = ingredients[j]; - for (int k = 0; k < ingredientsWidth; k++) { - IIngredient ingredient = k > row.length ? null : row[k]; - Object input = srecipe.getInput()[j * recipeWidth + k]; - if (!matches(input, ingredient)) { - continue outer; - } - } - } - } - } else { - if (recipe instanceof ShapedRecipes) { - - } else if (recipe instanceof ShapedOreRecipe) { - - } else { - continue; - } - } - - toRemove.add(recipe); - removeIndex.add(i); - } - - MineTweakerAPI.apply(new ActionRemoveRecipes(toRemove, removeIndex)); - return toRemove.size(); - } - - @Override - public int removeShapeless(IIngredient output, IIngredient[] ingredients, boolean wildcard) { - List toRemove = new ArrayList(); - List removeIndex = new ArrayList(); - outer: for (int i = 0; i < recipes.size(); i++) { - IRecipe recipe = recipes.get(i); - - if (recipe.getRecipeOutput() == null || !output.matches(getIItemStack(recipe.getRecipeOutput()))) { - continue; - } - - if (ingredients != null) { - if (recipe instanceof ShapelessRecipes) { - ShapelessRecipes srecipe = (ShapelessRecipes) recipe; - - if (ingredients.length > srecipe.getRecipeSize()) { - continue; - } else if (!wildcard && ingredients.length < srecipe.getRecipeSize()) { - continue; - } - - checkIngredient: for (int j = 0; j < ingredients.length; j++) { - for (int k = 0; k < srecipe.getRecipeSize(); k++) { - if (matches(srecipe.recipeItems.get(k), ingredients[j])) { - continue checkIngredient; - } - } - - continue outer; - } - } else if (recipe instanceof ShapelessOreRecipe) { - ShapelessOreRecipe srecipe = (ShapelessOreRecipe) recipe; - ArrayList inputs = srecipe.getInput(); - - if (inputs.size() < ingredients.length) { - continue; - } if (!wildcard && inputs.size() > ingredients.length) { - continue; - } - - checkIngredient: for (int j = 0; j < ingredients.length; j++) { - for (int k = 0; k < srecipe.getRecipeSize(); k++) { - if (matches(inputs.get(k), ingredients[j])) { - continue checkIngredient; - } - } - - continue outer; - } - } - } else { - if (recipe instanceof ShapelessRecipes) { - - } else if (recipe instanceof ShapelessOreRecipe) { - - } else { - continue; - } - } - - toRemove.add(recipe); - removeIndex.add(i); - } - - MineTweakerAPI.apply(new ActionRemoveRecipes(toRemove, removeIndex)); - return toRemove.size(); - } - - @Override - public IItemStack craft(IItemStack[][] contents) { - Container container = new ContainerVirtual(); - - int width = 0; - int height = contents.length; - for (IItemStack[] row : contents) { - width = Math.max(width, row.length); - } - - ItemStack[] iContents = new ItemStack[width * height]; - for (int i = 0; i < height; i++) { - for (int j = 0; j < contents[i].length; j++) { - if (contents[i][j] != null) { - iContents[i * width + j] = getItemStack(contents[i][j]); - } - } - } - - InventoryCrafting inventory = new InventoryCrafting(container, width, height); - for (int i = 0; i < iContents.length; i++) { - inventory.setInventorySlotContents(i, iContents[i]); - } - ItemStack result = CraftingManager.getInstance().findMatchingRecipe(inventory, null); - if (result == null) { - return null; - } else { - return getIItemStack(result); - } - } - - private class ContainerVirtual extends Container { - @Override - public boolean canInteractWith(EntityPlayer var1) { - return false; - } - } - - private class ActionRemoveRecipes implements IUndoableAction { - private final List removingIndices; - private final List removingRecipes; - - public ActionRemoveRecipes(List recipes, List indices) { - this.removingIndices = indices; - this.removingRecipes = recipes; - } - - @Override - public void apply() { - for (int i = removingIndices.size() - 1; i >= 0; i--) { - recipes.remove((int) removingIndices.get(i)); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (int i = 0; i < removingIndices.size(); i++) { - int index = Math.min(recipes.size(), removingIndices.get(i)); - recipes.add(index, removingRecipes.get(i)); - } - } - - @Override - public String describe() { - return "Removing " + removingIndices.size() + " recipes"; - } - - @Override - public String describeUndo() { - return "Restoring " + removingIndices.size() + " recipes"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class ActionAddRecipe implements IUndoableAction { - private final IRecipe recipe; - private final ICraftingRecipe craftingRecipe; - - public ActionAddRecipe(IRecipe recipe, ICraftingRecipe craftingRecipe) { - this.recipe = recipe; - this.craftingRecipe = craftingRecipe; - } - - @Override - public void apply() { - recipes.add(recipe); - if (craftingRecipe.hasTransformers()) { - transformerRecipes.add(craftingRecipe); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - recipes.remove(recipe); - if (craftingRecipe.hasTransformers()) { - transformerRecipes.remove(craftingRecipe); - } - } - - @Override - public String describe() { - return "Adding recipe for " + recipe.getRecipeOutput().getDisplayName(); - } - - @Override - public String describeUndo() { - return "Removing recipe for " + recipe.getRecipeOutput().getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static boolean matches(Object input, IIngredient ingredient) { - if ((input == null) != (ingredient == null)) { - return false; - } else if (ingredient != null) { - if (input instanceof ItemStack) { - if (!ingredient.matches(getIItemStack((ItemStack) input))) { - return false; - } - } else if (input instanceof String) { - if (!ingredient.contains(getOreDict((String) input))) { - return false; - } - } - } - - return true; - } - - private void addShaped(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, boolean mirrored) { - ShapedRecipe recipe = new ShapedRecipe(output, ingredients, function, mirrored); - IRecipe irecipe = RecipeConverter.convert(recipe); - MineTweakerAPI.apply(new ActionAddRecipe(irecipe, recipe)); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/RecipeConverter.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/RecipeConverter.java deleted file mode 100644 index 14ec11d..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/RecipeConverter.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import minetweaker.api.recipes.ShapedRecipe; -import minetweaker.api.recipes.ShapelessRecipe; -import java.util.ArrayList; -import java.util.Arrays; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ICraftingRecipe; -import minetweaker.api.recipes.UnknownRecipe; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -/** - * - * @author Stan - */ -public class RecipeConverter { - private RecipeConverter() {} - - public static final int TYPE_ADVANCED = 0; - public static final int TYPE_ORE = 1; - public static final int TYPE_BASIC = 2; - - private static int getIngredientType(IIngredient pattern) { - Object internal = pattern.getInternal(); - if (internal == null) { - return TYPE_ADVANCED; - } else if (internal instanceof ItemStack) { - return TYPE_BASIC; - } else { - return TYPE_ORE; - } - } - - private static int getRecipeType(IIngredient[] ingredients) { - int type = TYPE_BASIC; - for (IIngredient ingredient : ingredients) { - type = Math.min(type, getIngredientType(ingredient)); - } - return type; - } - - public static IRecipe convert(ShapelessRecipe recipe) { - IIngredient[] ingredients = recipe.getIngredients(); - int type = getRecipeType(ingredients); - - if (type == TYPE_BASIC) { - ItemStack[] items = new ItemStack[ingredients.length]; - for (int i = 0; i < ingredients.length; i++) { - items[i] = getItemStack(ingredients[i]); - } - return new ShapelessRecipeBasic(items, recipe); - } else if (type == TYPE_ORE) { - Object[] items = new Object[ingredients.length]; - for (int i = 0; i < ingredients.length; i++) { - items[i] = ingredients[i].getInternal(); - } - return new ShapelessRecipeOre(items, recipe); - } else { - return new ShapelessRecipeAdvanced(recipe); - } - } - - public static IRecipe convert(ShapedRecipe recipe) { - IIngredient[] ingredients = recipe.getIngredients(); - byte[] posx = recipe.getIngredientsX(); - byte[] posy = recipe.getIngredientsY(); - - // determine recipe type - int type = getRecipeType(ingredients); - - // construct recipe - if (type == TYPE_BASIC && !recipe.isMirrored()) { - ItemStack[] basicIngredients = new ItemStack[recipe.getHeight() * recipe.getWidth()]; - for (int i = 0; i < ingredients.length; i++) { - basicIngredients[posx[i] + posy[i] * recipe.getWidth()] = getItemStack(ingredients[i]); - } - - return new ShapedRecipeBasic(basicIngredients, recipe); - } else if (type == TYPE_ORE) { - Object[] converted = new Object[recipe.getHeight() * recipe.getWidth()]; - for (int i = 0; i < ingredients.length; i++) { - converted[posx[i] + posy[i] * recipe.getWidth()] = ingredients[i].getInternal(); - } - - // arguments contents: - // 1) recipe patterns - // 2) characters + ingredients - - int counter = 0; - String[] parts = new String[recipe.getHeight()]; - ArrayList rarguments = new ArrayList(); - for (int i = 0; i < recipe.getHeight(); i++) { - char[] pattern = new char[recipe.getWidth()]; - for (int j = 0; j < recipe.getWidth(); j++) { - int off = i * recipe.getWidth() + j; - if (converted[off] == null) { - pattern[j] = ' '; - } else { - pattern[j] = (char) ('A' + counter); - rarguments.add(pattern[j]); - rarguments.add(converted[off]); - counter++; - } - } - parts[i] = new String(pattern); - } - - rarguments.addAll(0, Arrays.asList(parts)); - - return new ShapedRecipeOre(rarguments.toArray(), recipe); - } else { - return new ShapedRecipeAdvanced(recipe); - } - } - - public static ICraftingRecipe toCraftingRecipe(IRecipe recipe) { - IItemStack output = MineTweakerMC.getIItemStack(recipe.getRecipeOutput()); - - if (recipe instanceof ShapelessRecipes) { - ShapelessRecipes shapeless = (ShapelessRecipes) recipe; - - IIngredient[] ingredients = new IIngredient[shapeless.recipeItems.size()]; - for (int i = 0; i < ingredients.length; i++) { - ingredients[i] = MineTweakerMC.getIIngredient(shapeless.recipeItems.get(i)); - } - - return new ShapelessRecipe(output, ingredients, null); - } else if (recipe instanceof ShapedRecipes) { - ShapedRecipes shaped = (ShapedRecipes) recipe; - - IIngredient[][] ingredients = new IIngredient[shaped.recipeHeight][shaped.recipeWidth]; - for (int i = 0; i < shaped.recipeHeight; i++) { - for (int j = 0; j < shaped.recipeWidth; j++) { - ingredients[i][j] = MineTweakerMC.getIItemStack(shaped.recipeItems[i * shaped.recipeWidth + j]); - } - } - - return new ShapedRecipe(output, ingredients, null, false); - } else if (recipe instanceof ShapedOreRecipe) { - ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; - - int width = (int) Math.sqrt(recipe.getRecipeSize()); - int height = recipe.getRecipeSize() / width; - - IIngredient[][] recipeIngredients = new IIngredient[height][width]; - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - recipeIngredients[i][j] = MineTweakerMC.getIIngredient(shaped.getInput()[i * width + j]); - } - } - - return new ShapedRecipe(output, recipeIngredients, null, false); - } else if (recipe instanceof ShapelessOreRecipe) { - ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; - - IIngredient[] ingredients = new IIngredient[shapeless.getRecipeSize()]; - for (int i = 0; i < ingredients.length; i++) { - ingredients[i] = MineTweakerMC.getIIngredient(shapeless.getInput().get(i)); - } - - return new ShapelessRecipe(output, ingredients, null); - } else { - return new UnknownRecipe(output); - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeAdvanced.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeAdvanced.java deleted file mode 100644 index 6402b2b..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeAdvanced.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapedRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -/** - * TODO: NEI integration for this kind of recipes. - * - * @author Stan - */ -public class ShapedRecipeAdvanced implements IRecipe { - private final ShapedRecipe recipe; - - public ShapedRecipeAdvanced(ShapedRecipe recipe) { - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } - - @Override - public int getRecipeSize() { - return recipe.getWidth() * recipe.getHeight(); - } - - @Override - public ItemStack getRecipeOutput() { - return getItemStack(recipe.getOutput()); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeBasic.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeBasic.java deleted file mode 100644 index 851d8d9..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeBasic.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapedRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class ShapedRecipeBasic extends ShapedRecipes { - private final ShapedRecipe recipe; - - public ShapedRecipeBasic(ItemStack[] basicInputs, ShapedRecipe recipe) { - super(recipe.getWidth(), recipe.getHeight(), basicInputs, getItemStack(recipe.getOutput())); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - IItemStack result = recipe.getCraftingResult(MCCraftingInventory.get(inventory)); - if (result == null) { - return null; - } else { - return getItemStack(result).copy(); - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeOre.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeOre.java deleted file mode 100644 index d845e04..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapedRecipeOre.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapedRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.oredict.ShapedOreRecipe; - -/** - * - * @author Stan - */ -public class ShapedRecipeOre extends ShapedOreRecipe { - private final ShapedRecipe recipe; - - public ShapedRecipeOre(Object[] contents, ShapedRecipe recipe) { - super(getItemStack(recipe.getOutput()), contents); - - if (recipe.isMirrored()) { - setMirrored(true); - } - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeAdvanced.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeAdvanced.java deleted file mode 100644 index 7088511..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeAdvanced.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapelessRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class ShapelessRecipeAdvanced implements IRecipe { - private final ShapelessRecipe recipe; - - public ShapelessRecipeAdvanced(ShapelessRecipe recipe) { - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } - - @Override - public int getRecipeSize() { - return recipe.getSize(); - } - - @Override - public ItemStack getRecipeOutput() { - return getItemStack(recipe.getOutput()); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeBasic.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeBasic.java deleted file mode 100644 index 3824b06..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeBasic.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import minetweaker.api.recipes.ShapelessRecipe; -import java.util.Arrays; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class ShapelessRecipeBasic extends ShapelessRecipes { - private final ShapelessRecipe recipe; - - public ShapelessRecipeBasic(ItemStack[] ingredients, ShapelessRecipe recipe) { - super(getItemStack(recipe.getOutput()), Arrays.asList(ingredients)); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeOre.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeOre.java deleted file mode 100644 index cd53c3c..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/recipes/ShapelessRecipeOre.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.recipes; - -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.recipes.ShapelessRecipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -/** - * - * @author Stan - */ -public class ShapelessRecipeOre extends ShapelessOreRecipe { - private final ShapelessRecipe recipe; - - public ShapelessRecipeOre(Object[] ingredients, ShapelessRecipe recipe) { - super(getItemStack(recipe.getOutput()), ingredients); - - this.recipe = recipe; - } - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - return recipe.matches(MCCraftingInventory.get(inventory)); - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - return getItemStack(recipe.getCraftingResult(MCCraftingInventory.get(inventory))).copy(); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/server/MCServer.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/server/MCServer.java deleted file mode 100644 index bface92..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/server/MCServer.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.server; - -import java.util.Arrays; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.player.IPlayer; -import minetweaker.api.server.AbstractServer; -import minetweaker.api.server.ICommandFunction; -import minetweaker.api.server.ICommandTabCompletion; -import minetweaker.api.server.ICommandValidator; -import net.minecraft.command.CommandHandler; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; - -/** - * - * @author Stan - */ -public class MCServer extends AbstractServer { - private final MinecraftServer server; - - public MCServer(MinecraftServer server) { - this.server = server; - } - - @Override - public void addCommand(String name, String usage, String[] aliases, ICommandFunction function, ICommandValidator validator, ICommandTabCompletion completion) { - ICommand command = new MCCommand(name, usage, aliases, function, validator, completion); - MineTweakerAPI.apply(new AddCommandAction(command)); - } - - @Override - public void removeCommand(String name) { - ICommand command = (ICommand)((CommandHandler) server.getCommandManager()).getCommands().get(name); - if (command == null) { - MineTweakerAPI.logWarning("No such command: " + name); - } else { - MineTweakerAPI.apply(new RemoveCommandAction(command)); - } - } - - @Override - public boolean isOp(IPlayer player) { - return (MinecraftServer.getServer().getConfigurationManager().getOps().isEmpty() - || MinecraftServer.getServer().getConfigurationManager().getOps().contains(player.getName())) - || player == ServerPlayer.INSTANCE; - } - - private static IPlayer getPlayer(ICommandSender commandSender) { - if (commandSender instanceof EntityPlayer) { - return MineTweakerMC.getIPlayer((EntityPlayer) commandSender); - } else if (commandSender instanceof DedicatedServer) { - return ServerPlayer.INSTANCE; - } else { - System.out.println("Unsupported command sender: " + commandSender); - System.out.println("player name: " + commandSender.getCommandSenderName()); - return null; - } - } - - private static void removeCommand(ICommand command) { - CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); - ch.getCommands().remove(command.getCommandName()); - - if (command.getCommandAliases() != null) { - for (String alias : (List)command.getCommandAliases()) { - ch.getCommands().remove(alias); - } - } - } - - private class MCCommand implements ICommand { - private final String name; - private final String usage; - private final List aliases; - private final ICommandFunction function; - private final ICommandValidator validator; - private final ICommandTabCompletion completion; - - public MCCommand(String name, String usage, String[] aliases, ICommandFunction function, ICommandValidator validator, ICommandTabCompletion completion) { - this.name = name; - this.usage = usage; - this.aliases = Arrays.asList(aliases); - this.function = function; - this.validator = validator; - this.completion = completion; - } - - @Override - public String getCommandName() { - return name; - } - - @Override - public String getCommandUsage(ICommandSender var1) { - return usage; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public void processCommand(ICommandSender var1, String[] var2) { - function.execute(var2, getPlayer(var1)); - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender var1) { - if (validator == null) { - return true; - } else { - return validator.canExecute(getPlayer(var1)); - } - } - - @Override - public List addTabCompletionOptions(ICommandSender var1, String[] var2) { - if (completion != null) { - return Arrays.asList(completion.getTabCompletionOptions(var2, getPlayer(var1))); - } else { - return null; - } - } - - @Override - public boolean isUsernameIndex(String[] var1, int var2) { - return false; - } - - @Override - public int compareTo(Object o) { - return 0; - } - } - - private class AddCommandAction implements IUndoableAction { - private final ICommand command; - - public AddCommandAction(ICommand command) { - this.command = command; - } - - @Override - public void apply() { - CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); - ch.registerCommand(command); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - removeCommand(command); - } - - @Override - public String describe() { - return "Adding command " + command.getCommandName(); - } - - @Override - public String describeUndo() { - return "Removing command " + command.getCommandName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private class RemoveCommandAction implements IUndoableAction { - private final ICommand command; - - public RemoveCommandAction(ICommand command) { - this.command = command; - } - - @Override - public void apply() { - removeCommand(command); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); - ch.registerCommand(command); - } - - @Override - public String describe() { - return "Adding command " + command.getCommandName(); - } - - @Override - public String describeUndo() { - return "Removing command " + command.getCommandName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/server/ServerPlayer.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/server/ServerPlayer.java deleted file mode 100644 index 2d51aeb..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/server/ServerPlayer.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.server; - -import java.awt.Desktop; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.io.IOException; -import java.net.URI; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.api.chat.IChatMessage; -import minetweaker.api.data.IData; -import minetweaker.api.item.IItemStack; -import minetweaker.api.player.IPlayer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; - -/** - * - * @author Stan - */ -public class ServerPlayer implements IPlayer { - public static final ServerPlayer INSTANCE = new ServerPlayer(); - - private ServerPlayer() { - - } - - @Override - public String getId() { - return "server"; - } - - @Override - public String getName() { - return "Server"; - } - - @Override - public IData getData() { - // TODO: implement - return null; - } - - @Override - public void update(IData data) { - // TODO: implement - } - - @Override - public void sendChat(IChatMessage message) { - DedicatedServer.getServer().addChatMessage((IChatComponent) message.getInternal()); - } - - @Override - public void sendChat(String message) { - DedicatedServer.getServer().addChatMessage(new ChatComponentText(message)); - } - - @Override - public int getHotbarSize() { - return 0; - } - - @Override - public IItemStack getHotbarStack(int i) { - return null; - } - - @Override - public int getInventorySize() { - return 0; - } - - @Override - public IItemStack getInventoryStack(int i) { - return null; - } - - @Override - public IItemStack getCurrentItem() { - return null; - } - - @Override - public boolean isCreative() { - return true; - } - - @Override - public boolean isAdventure() { - return false; - } - - @Override - public void openBrowser(String url) { - if (Desktop.isDesktopSupported()) { - try { - Desktop.getDesktop().browse(URI.create(url)); - } catch (IOException ex) { - Logger.getLogger(ServerPlayer.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - @Override - public void copyToClipboard(String value) { - if (Desktop.isDesktopSupported()) { - StringSelection stringSelection = new StringSelection(value); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(stringSelection, null); - } - } - - @Override - public void give(IItemStack stack) { - - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerHacks.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerHacks.java deleted file mode 100644 index 917f8ad..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerHacks.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.util; - -import com.google.common.collect.BiMap; -import cpw.mods.fml.common.registry.EntityRegistry; -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.SlotCrafting;import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.StatCollector; -import net.minecraft.util.StringTranslate; -import net.minecraft.util.WeightedRandom; -import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; - -/** - * Common class for all runtime hacks (stuff requiring reflection). It is not - * unexpected to have it break with new minecraft versions and may need regular - * adjustment - as such, those have been collected here. - * - * @author Stan Hebben - */ -public class MineTweakerHacks { - private static final Field NBTTAGLIST_TAGLIST; - private static final Field OREDICTIONARY_IDTOSTACK; - private static final Field OREDICTIONARY_IDTOSTACKUN; - private static final Field MINECRAFTSERVER_ANVILFILE; - - private static final Field SHAPEDORERECIPE_WIDTH; - private static final Field INVENTORYCRAFTING_EVENTHANDLER; - private static final Field SLOTCRAFTING_PLAYER; - - private static final Field ENTITYREGISTRY_CLASSREGISTRATIONS; - private static final Field SEEDENTRY_SEED; - private static final Constructor SEEDENTRY_CONSTRUCTOR; - - static { - NBTTAGLIST_TAGLIST = getField(NBTTagList.class, MineTweakerObfuscation.NBTTAGLIST_TAGLIST); - OREDICTIONARY_IDTOSTACK = getField(OreDictionary.class, MineTweakerObfuscation.OREDICTIONARY_IDTOSTACK); - OREDICTIONARY_IDTOSTACKUN = getField(OreDictionary.class, MineTweakerObfuscation.OREDICTIONARY_IDTOSTACKUN); - MINECRAFTSERVER_ANVILFILE = getField(MinecraftServer.class, MineTweakerObfuscation.MINECRAFTSERVER_ANVILFILE); - SHAPEDORERECIPE_WIDTH = getField(ShapedOreRecipe.class, new String[] {"width"}); - - INVENTORYCRAFTING_EVENTHANDLER = getField(InventoryCrafting.class, MineTweakerObfuscation.INVENTORYCRAFTING_EVENTHANDLER); - SLOTCRAFTING_PLAYER = getField(SlotCrafting.class, MineTweakerObfuscation.SLOTCRAFTING_PLAYER); - - ENTITYREGISTRY_CLASSREGISTRATIONS = getField(EntityRegistry.class, new String[] {"entityClassRegistrations"}); - - Class forgeSeedEntry = null; - try { - forgeSeedEntry = (Class) Class.forName("net.minecraftforge.common.ForgeHooks$SeedEntry"); - } catch (ClassNotFoundException ex) {} - - SEEDENTRY_SEED = getField(forgeSeedEntry, "seed"); - - Constructor seedEntryConstructor = null; - - try { - seedEntryConstructor = forgeSeedEntry.getConstructor(ItemStack.class, int.class); - seedEntryConstructor.setAccessible(true); - } catch (NoSuchMethodException ex) { - Logger.getLogger(MineTweakerHacks.class.getName()).log(Level.SEVERE, null, ex); - } catch (SecurityException ex) { - Logger.getLogger(MineTweakerHacks.class.getName()).log(Level.SEVERE, null, ex); - } - - SEEDENTRY_CONSTRUCTOR = seedEntryConstructor; - } - - private MineTweakerHacks() {} - - public static BiMap, EntityRegistry.EntityRegistration> getEntityClassRegistrations() { - try { - return (BiMap, EntityRegistry.EntityRegistration>) ENTITYREGISTRY_CLASSREGISTRATIONS.get(EntityRegistry.instance()); - } catch (IllegalArgumentException ex) { - return null; - } catch (IllegalAccessException ex) { - return null; - } - } - - public static List getTagList(NBTTagList list) { - if (NBTTAGLIST_TAGLIST == null) { - return null; - } - try { - return (List) NBTTAGLIST_TAGLIST.get(list); - } catch (IllegalArgumentException ex) { - return null; - } catch (IllegalAccessException ex) { - return null; - } - } - - public static List getSeeds() { - return getPrivateStaticObject(ForgeHooks.class, "seedList"); - } - - public static Map getChestLoot() { - return getPrivateStaticObject(ChestGenHooks.class, "chestInfo"); - } - - public static Map getTranslations() { - return getPrivateObject( - getPrivateStaticObject(StatCollector.class, "localizedName", "field_74839_a"), - "languageList", - "field_74816_c"); - } - - public static List> getOreIdStacks() { - try { - return (List>) OREDICTIONARY_IDTOSTACK.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("ERROR - could not load ore dictionary stacks!"); - return null; - } - } - - public static List> getOreIdStacksUn() { - try { - return (List>) OREDICTIONARY_IDTOSTACKUN.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("ERROR - could not load ore dictionary stacks!"); - return null; - } - } - - public static File getAnvilFile(MinecraftServer server) { - try { - return (File) MINECRAFTSERVER_ANVILFILE.get(server); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not load anvil file!"); - return null; - } - } - - public static File getWorldDirectory(MinecraftServer server) { - if (server.isDedicatedServer()) { - return server.getFile("world"); - } else { - File worldsDir = getAnvilFile(server); - if (worldsDir == null) return null; - - return new File(worldsDir, server.getFolderName()); - } - } - - public static int getShapedOreRecipeWidth(ShapedOreRecipe recipe) { - try { - return SHAPEDORERECIPE_WIDTH.getInt(recipe); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not load anvil file!"); - return 3; - } - } - - public static Container getCraftingContainer(InventoryCrafting inventory) { - try { - return (Container) INVENTORYCRAFTING_EVENTHANDLER.get(inventory); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get inventory eventhandler"); - return null; - } - } - - public static EntityPlayer getCraftingSlotPlayer(SlotCrafting slot) { - try { - return (EntityPlayer) SLOTCRAFTING_PLAYER.get(slot); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get inventory eventhandler"); - return null; - } - } - - public static StringTranslate getStringTranslateInstance() { - try { - Field field = getField(StringTranslate.class, MineTweakerObfuscation.STRINGTRANSLATE_INSTANCE); - return (StringTranslate) field.get(null); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get string translator"); - return null; - } - } - - public static ItemStack getSeedEntrySeed(Object entry) { - try { - return (ItemStack) SEEDENTRY_SEED.get(entry); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not get SeedEntry seed"); - return null; - } - } - - public static WeightedRandom.Item constructSeedEntry(WeightedItemStack stack) { - try { - return SEEDENTRY_CONSTRUCTOR.newInstance(MineTweakerMC.getItemStack(stack.getStack()), (int) stack.getChance()); - } catch (InstantiationException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } catch (IllegalAccessException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } catch (IllegalArgumentException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } catch (InvocationTargetException ex) { - MineTweakerAPI.logError("could not construct SeedEntry"); - } - - return null; - } - - public static T getPrivateStaticObject(Class cls, String... names) { - for (String name : names) { - try { - Field field = cls.getDeclaredField(name); - field.setAccessible(true); - return (T) field.get(null); - } catch (NoSuchFieldException ex) { - - } catch (SecurityException ex) { - - } catch (IllegalAccessException ex) { - - } - } - - return null; - } - - public static T getPrivateObject(Object object, String... names) { - Class cls = object.getClass(); - for (String name : names) { - try { - Field field = cls.getDeclaredField(name); - field.setAccessible(true); - return (T) field.get(object); - } catch (NoSuchFieldException ex) { - - } catch (SecurityException ex) { - - } catch (IllegalAccessException ex) { - - } - } - - return null; - } - - // ####################### - // ### Private Methods ### - // ####################### - - private static Field getField(Class cls, String... names) { - for (String name : names) { - try { - Field field = cls.getDeclaredField(name); - field.setAccessible(true); - return field; - } catch (NoSuchFieldException ex) { - } catch (SecurityException ex) { - } - } - - return null; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerObfuscation.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerObfuscation.java deleted file mode 100644 index 7fe041f..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerObfuscation.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.util; - -/** - * - * @author Stanneke - */ -public class MineTweakerObfuscation { - private MineTweakerObfuscation() {} - - public static final String[] NBTTAGLIST_TAGLIST = {"tagList", "field_74747_a"}; - public static final String[] CRAFTINGMANAGER_RECIPES = {"recipes", "field_77597_b"}; - public static final String[] OREDICTIONARY_IDTOSTACK = {"idToStack"}; - public static final String[] OREDICTIONARY_IDTOSTACKUN = {"idToStackUn"}; - public static final String[] MINECRAFTSERVER_ANVILFILE = {"anvilFile", "field_71308_o"}; - public static final String[] INVENTORYCRAFTING_EVENTHANDLER = {"eventHandler", "field_70465_c"}; - public static final String[] SLOTCRAFTING_PLAYER = {"thePlayer", "field_75238_b"}; - public static final String[] STRINGTRANSLATE_INSTANCE = {"instance", "field_74817_a"}; -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerPlatformUtils.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerPlatformUtils.java deleted file mode 100644 index 8ca71ae..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/util/MineTweakerPlatformUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.util; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.EntityLivingBase; - -/** - * - * @author Stan - */ -public class MineTweakerPlatformUtils { - private MineTweakerPlatformUtils() {} - - public static Class getLivingEntityClass(String entityClassName) { - try { - Class entityClass = Class.forName(entityClassName); - if (!EntityLivingBase.class.isAssignableFrom(entityClass)) { - throw new RuntimeException("Not an entity class: " + entityClassName); - } - return (Class) entityClass; - } catch (ClassNotFoundException ex) { - throw new RuntimeException("entity class not found: " + entityClassName); - } - } - - public static String getLanguage() { - return FMLCommonHandler.instance().getSide() == Side.SERVER ? null : FMLClientHandler.instance().getCurrentLanguage(); - } - - public static boolean isLanguageActive(String lang) { - String current = getLanguage(); - return current != null && current.equals(lang); - } - - public static boolean isClient() { - return FMLCommonHandler.instance().getSide() == Side.CLIENT; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCLootRegistry.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCLootRegistry.java deleted file mode 100644 index a89aa67..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCLootRegistry.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.vanilla; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.vanilla.ILootRegistry; -import minetweaker.api.vanilla.LootEntry; -import minetweaker.mc172.util.MineTweakerHacks; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraftforge.common.ChestGenHooks; - -/** - * - * @author Stan - */ -public class MCLootRegistry implements ILootRegistry { - private static final Map LOOT = MineTweakerHacks.getChestLoot(); - - @Override - public void addChestLoot(String type, WeightedItemStack item) { - WeightedRandomChestContent content = new WeightedRandomChestContent( - MineTweakerMC.getItemStack(item.getStack()), - 1, - 1, - (int) item.getChance()); - MineTweakerAPI.apply(new AddLootAction(type, content)); - } - - @Override - public void addChestLoot(String type, WeightedItemStack item, int min, int max) { - WeightedRandomChestContent content = new WeightedRandomChestContent( - MineTweakerMC.getItemStack(item.getStack()), - min, - max, - (int) item.getChance()); - MineTweakerAPI.apply(new AddLootAction(type, content)); - } - - @Override - public void removeChestLoot(String type, IIngredient pattern) { - MineTweakerAPI.apply(new RemoveLootAction(type, pattern)); - } - - @Override - public List getLoot(String type) { - ChestGenHooks recipe = LOOT.get(type); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - List results = new ArrayList(); - for (WeightedRandomChestContent content : contents) { - results.add(new LootEntry(new WeightedItemStack( - MineTweakerMC.getIItemStack(content.theItemId), - content.itemWeight), - content.theMinimumChanceToGenerateItem, - content.theMaximumChanceToGenerateItem)); - } - return results; - } - - @Override - public List getLootTypes() { - Set keys = LOOT.keySet(); - List keyList = new ArrayList(); - keyList.addAll(keys); - return keyList; - } - - // ###################### - // ### Action Classes ### - // ###################### - - /** - * Ported from ModTweaker. - * - * @author JoshieJack - */ - private static class AddLootAction implements IUndoableAction { - private final String chest; - private final WeightedRandomChestContent content; - - public AddLootAction(String chest, WeightedRandomChestContent content) { - this.chest = chest; - this.content = content; - } - - @Override - public void apply() { - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - contents.add(content); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - contents.remove(content); - } - - public String getRecipeInfo() { - return content.theItemId.getDisplayName(); - } - - @Override - public String describe() { - return "Adding chest loot " + content.theItemId.getDisplayName() + " to loot class " + chest; - } - - @Override - public String describeUndo() { - return "Removing chest loot " + content.theItemId.getDisplayName() + " from loot class " + chest; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - /** - * Ported from ModTweaker. - * - * @author JoshieJack - */ - private static class RemoveLootAction implements IUndoableAction { - private final String chest; - private final IIngredient pattern; - private final List removed; - - public RemoveLootAction(String chest, IIngredient pattern) { - this.chest = chest; - this.pattern = pattern; - removed = new ArrayList(); - } - - @Override - public void apply() { - removed.clear(); - - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - for (WeightedRandomChestContent r : contents) { - if (pattern.matches(MineTweakerMC.getIItemStack(r.theItemId))) { - removed.add(r); - } - } - - for (WeightedRandomChestContent r : removed) { - contents.remove(r); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ChestGenHooks recipe = LOOT.get(chest); - List contents = MineTweakerHacks.getPrivateObject(recipe, "contents"); - - for (WeightedRandomChestContent entry : removed) { - contents.add(entry); - } - } - - @Override - public String describe() { - return "Removing chest loot " + pattern + " for loot type " + chest; - } - - @Override - public String describeUndo() { - return "Restoring chest loot " + pattern + " for loot type " + chest + " (" + removed.size() + " entries)"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCSeedRegistry.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCSeedRegistry.java deleted file mode 100644 index 01cbb7b..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCSeedRegistry.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.vanilla; - -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.WeightedItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.vanilla.ISeedRegistry; -import minetweaker.mc172.util.MineTweakerHacks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandom; - -/** - * - * @author Stan - */ -public class MCSeedRegistry implements ISeedRegistry { - private static final List SEEDS = MineTweakerHacks.getSeeds(); - - @Override - public void addSeed(WeightedItemStack item) { - MineTweakerAPI.apply(new AddSeedAction(item)); - } - - @Override - public void removeSeed(IIngredient pattern) { - MineTweakerAPI.apply(new RemoveSeedAction(pattern)); - } - - @Override - public List getSeeds() { - List entries = (List) SEEDS; - - List results = new ArrayList(); - for (WeightedRandom.Item entry : entries) { - results.add(new WeightedItemStack( - MineTweakerMC.getIItemStack(MineTweakerHacks.getSeedEntrySeed(entry)), - entry.itemWeight - )); - } - return results; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddSeedAction implements IUndoableAction { - private final IItemStack item; - private final WeightedRandom.Item entry; - - public AddSeedAction(WeightedItemStack item) { - this.item = item.getStack(); - entry = MineTweakerHacks.constructSeedEntry(item); - } - - @Override - public void apply() { - SEEDS.add(entry); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - SEEDS.remove(entry); - } - - @Override - public String describe() { - return "Adding seed entry " + item; - } - - @Override - public String describeUndo() { - return "Removing seed entry " + item; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveSeedAction implements IUndoableAction { - private final IIngredient pattern; - private final List removed; - - public RemoveSeedAction(IIngredient ingredient) { - this.pattern = ingredient; - removed = new ArrayList(); - } - - @Override - public void apply() { - removed.clear(); - - for (Object entry : SEEDS) { - ItemStack itemStack = MineTweakerHacks.getSeedEntrySeed(entry); - if (pattern.matches(MineTweakerMC.getIItemStack(itemStack))) { - removed.add(entry); - } - } - - for (Object entry : removed) { - SEEDS.remove(entry); - } - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - for (Object entry : removed) { - SEEDS.add(entry); - } - } - - @Override - public String describe() { - return "Removing seeds " + pattern; - } - - @Override - public String describeUndo() { - return "Restoring seeds " + pattern + " (" + removed.size() + " entries)"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCVanilla.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCVanilla.java deleted file mode 100644 index 26e57ca..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/vanilla/MCVanilla.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.vanilla; - -import minetweaker.api.vanilla.ILootRegistry; -import minetweaker.api.vanilla.ISeedRegistry; -import minetweaker.api.vanilla.IVanilla; - -/** - * - * @author Stan - */ -public class MCVanilla implements IVanilla { - private final MCLootRegistry lootRegistry = new MCLootRegistry(); - private final MCSeedRegistry seedRegistry = new MCSeedRegistry(); - - @Override - public ILootRegistry getLoot() { - return lootRegistry; - } - - @Override - public ISeedRegistry getSeeds() { - return seedRegistry; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/world/MCBiome.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/world/MCBiome.java deleted file mode 100644 index 3486872..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/world/MCBiome.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.world; - -import minetweaker.api.world.IBiome; -import net.minecraft.world.biome.BiomeGenBase; - -/** - * - * @author Stan - */ -public class MCBiome implements IBiome { - private final BiomeGenBase biome; - - public MCBiome(BiomeGenBase biome) { - this.biome = biome; - } - - @Override - public String getName() { - return biome.biomeName; - } -} diff --git a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/world/MCDimension.java b/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/world/MCDimension.java deleted file mode 100644 index 89e1585..0000000 --- a/MineTweaker3-MC172-Main/src/main/java/minetweaker/mc172/world/MCDimension.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mc172.world; - -import minetweaker.api.block.IBlock; -import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.world.IDimension; -import net.minecraft.world.World; - -/** - * - * @author Stan - */ -public class MCDimension implements IDimension { - private final World world; - - public MCDimension(World world) { - this.world = world; - } - - @Override - public boolean isDay() { - return world.isDaytime(); - } - - @Override - public int getBrightness(int x, int y, int z) { - return world.getBlockLightValue(x, y, z); - } - - @Override - public IDimension getDimension() { - return this; - } - - @Override - public IBlock getBlock(int x, int y, int z) { - return MineTweakerMC.getBlock(world, x, y, z); - } -} diff --git a/MineTweaker3-MC172-Main/src/main/resources/assets/minetweaker/logo.png b/MineTweaker3-MC172-Main/src/main/resources/assets/minetweaker/logo.png deleted file mode 100644 index 674382e..0000000 Binary files a/MineTweaker3-MC172-Main/src/main/resources/assets/minetweaker/logo.png and /dev/null differ diff --git a/MineTweaker3-MC172-Main/src/main/resources/mcmod.info b/MineTweaker3-MC172-Main/src/main/resources/mcmod.info deleted file mode 100644 index b4de473..0000000 --- a/MineTweaker3-MC172-Main/src/main/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "MineTweaker3", - "name": "MineTweaker 3", - "version": "${version}", - "mcversion": "${mcversion}", - "description": "Customize your minecraft experience!", - "credits": "Created By Stan Hebben", - "logoFile": "assets/minetweaker/logo.png", - "url": "http://minetweaker3.powerofbytes.com", - "authorList": [ "Stan Hebben" ], - "parent": "", - "screenshots": [], - "dependencies": [] -} -] diff --git a/MineTweaker3-MC172-Mod-Buildcraft/build.gradle b/MineTweaker3-MC172-Mod-Buildcraft/build.gradle deleted file mode 100644 index 9939c31..0000000 --- a/MineTweaker3-MC172-Mod-Buildcraft/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion172 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC172-Main') - compile files('libs/buildcraft-6.0.16-dev.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.buildcraft.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC172-Mod-Buildcraft/libs/buildcraft-6.0.16-dev.jar b/MineTweaker3-MC172-Mod-Buildcraft/libs/buildcraft-6.0.16-dev.jar deleted file mode 100644 index 71b9c5c..0000000 Binary files a/MineTweaker3-MC172-Mod-Buildcraft/libs/buildcraft-6.0.16-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/AssemblyTable.java b/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/AssemblyTable.java deleted file mode 100644 index e20cb57..0000000 --- a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/AssemblyTable.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.recipes.BuildcraftRecipes; -import buildcraft.core.recipes.AssemblyRecipeManager; -import buildcraft.core.recipes.AssemblyRecipeManager.AssemblyRecipe; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.AssemblyTable") -@ModOnly("BuildCraft|Core") -public class AssemblyTable { - @ZenMethod - public static void addRecipe(IItemStack output, double energy, IIngredient[] ingredients) { - MineTweakerAPI.apply(new AddRecipeAction(output, energy, ingredients)); - } - - @ZenMethod - public static void remove(IIngredient output) { - removeRecipe(output, null, false); - } - - @ZenMethod - public static void removeRecipe(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard) { - List toRemove = new ArrayList(); - - outer: for (AssemblyRecipe recipe : ((AssemblyRecipeManager) BuildcraftRecipes.assemblyTable).getRecipes()) { - if (output.matches(MineTweakerMC.getIItemStack(recipe.getOutput())) - && ingredientsMatch(recipe, ingredients, wildcard)) { - toRemove.add(recipe); - } - } - - for (AssemblyRecipe recipe : toRemove) { - MineTweakerAPI.apply(new RemoveRecipeAction(recipe)); - } - } - - /** - * Checks if ingredients from the recipe match with the given ingredients. - * - * @param recipe recipe to check - * @param ingredients required ingredients - * @param wildcard true if there can be more ingredients in the recipe than given, false otherwise - * @return matching result - */ - private static boolean ingredientsMatch(AssemblyRecipe recipe, IIngredient[] ingredients, boolean wildcard) { - if (ingredients == null) - return true; - - int matchedIngredients = 0; - boolean[] matched = new boolean[ingredients.length]; - checkIngredient: for (int i = 0; i < recipe.getInputs().length; i++) { - Object ingredientObject = recipe.getInputs()[i]; - if (ingredientObject instanceof Number) - continue; - - IIngredient recipeIngredient = MineTweakerMC.getIIngredient(recipe.getInputs()[i]); - - for (int j = 0; j < ingredients.length; j++) { - if (!matched[j] && ingredients[j].contains(recipeIngredient)) { - matched[j] = true; - matchedIngredients++; - continue checkIngredient; - } - } - - if (!wildcard) - return false; - } - - return matchedIngredients == ingredients.length; - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction implements IUndoableAction { - private final IItemStack output; - private final AssemblyRecipe recipe; - - public AddRecipeAction(IItemStack output, double energy, IIngredient[] ingredients) { - this.output = output; - - Object[] mcIngredients = new Object[ingredients.length]; - for (int i = 0; i < ingredients.length; i++) { - mcIngredients[i] = ingredients[i].getInternal(); - if (mcIngredients[i] == null) { - throw new IllegalArgumentException("Not a valid assembly table ingredient"); - } - } - - recipe = new AssemblyRecipe(MineTweakerMC.getItemStack(output), energy, mcIngredients); - } - - @Override - public void apply() { - ((AssemblyRecipeManager) BuildcraftRecipes.assemblyTable).getRecipes().add(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - BuildcraftRecipes.assemblyTable.getRecipes().remove(recipe); - } - - @Override - public String describe() { - return "Adding assembly table recipe for " + output; - } - - @Override - public String describeUndo() { - return "Removing assembly table recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveRecipeAction implements IUndoableAction { - private final AssemblyRecipe recipe; - - public RemoveRecipeAction(AssemblyRecipe recipe) { - this.recipe = recipe; - } - - @Override - public void apply() { - BuildcraftRecipes.assemblyTable.getRecipes().remove(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ((AssemblyRecipeManager) BuildcraftRecipes.assemblyTable).getRecipes().add(recipe); - } - - @Override - public String describe() { - return "Removing assembly table recipe for " + MineTweakerMC.getIItemStack(recipe.getOutput()); - } - - @Override - public String describeUndo() { - return "Restoring assembly table recipe for " + MineTweakerMC.getIItemStack(recipe.getOutput()); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Fuels.java b/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Fuels.java deleted file mode 100644 index 5053306..0000000 --- a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Fuels.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.core.StackKey; -import buildcraft.api.fuels.IronEngineCoolant; -import buildcraft.api.fuels.IronEngineFuel; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.Fuels") -@ModOnly("BuildCraft|Core") -public class Fuels { - private static final Constructor CONSTRUCT_FUEL; - - static { - Constructor newFuel = null; - try { - newFuel = IronEngineFuel.Fuel.class.getDeclaredConstructor(Fluid.class, float.class, int.class); - newFuel.setAccessible(true); - } catch (NoSuchMethodException ex) { - MineTweakerAPI.logError("Could not load combustion engine fuel constructor", ex); - } catch (SecurityException ex) { - MineTweakerAPI.logError("Could not load combustion engine fuel constructor", ex); - } - - CONSTRUCT_FUEL = newFuel; - } - - @ZenMethod - public static void addCombustionEngineFuel(ILiquidStack fuel, double powerPerCycle, int totalBurningTime) { - MineTweakerAPI.apply(new AddFuelAction(fuel, powerPerCycle, totalBurningTime)); - } - - @ZenMethod - public static void removeCombustionEngineFuel(ILiquidStack fuel) { - Fluid fluid = MineTweakerMC.getLiquidStack(fuel).getFluid(); - if (IronEngineFuel.fuels.containsKey(fluid.getName())) { - MineTweakerAPI.apply(new RemoveFuelAction(fluid.getName(), IronEngineFuel.fuels.get(fluid.getName()))); - } else { - MineTweakerAPI.logWarning("No such iron engine fuel: " + fluid.getName()); - } - } - - @ZenMethod - public static void addCombustionEngineCoolant(ILiquidStack coolant, float coolingPerMB) { - MineTweakerAPI.apply(new AddLiquidCoolantAction(coolant.getName(), new MTCoolant(coolingPerMB))); - } - - @ZenMethod - public static void addCoolantItem(IItemStack coolantItem, ILiquidStack coolantLiquid) { - MineTweakerAPI.apply(new AddCoolantItemAction(new StackKey(MineTweakerMC.getItemStack(coolantItem)), MineTweakerMC.getLiquidStack(coolantLiquid))); - } - - @ZenMethod - public static void removeCombustionEngineCoolant(ILiquidStack coolant) { - FluidStack fluid = MineTweakerMC.getLiquidStack(coolant); - - if (IronEngineCoolant.isCoolant(fluid.getFluid())) { - MineTweakerAPI.apply(new RemoveLiquidCoolantAction(fluid.getFluid().getName(), IronEngineCoolant.getCoolant(fluid))); - } else { - MineTweakerAPI.logWarning("No such iron engine coolant: " + fluid.getFluid().getName()); - } - } - - @ZenMethod - public static void removeCoolantItem(IIngredient item) { - int numRemoved = 0; - for (IItemStack itemStack : item.getItems()) { - StackKey key = new StackKey(MineTweakerMC.getItemStack(itemStack)); - if (IronEngineCoolant.solidCoolants.containsKey(key)) { - MineTweakerAPI.apply(new RemoveCoolantItemAction(key, IronEngineCoolant.solidCoolants.get(key))); - numRemoved++; - } - } - - if (numRemoved == 0) { - MineTweakerAPI.logWarning("No such iron engine coolant: " + item); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddFuelAction implements IUndoableAction { - private final String fuelName; - private final IronEngineFuel.Fuel fuel; - - public AddFuelAction(ILiquidStack fuel, double powerPerCycle, int totalBurningTime) { - fuelName = fuel.getName(); - IronEngineFuel.Fuel ieFuel = null; - try { - if (CONSTRUCT_FUEL == null) - System.out.println("No constructor for fuel"); - - ieFuel = (IronEngineFuel.Fuel) CONSTRUCT_FUEL.newInstance(MineTweakerMC.getLiquidStack(fuel).getFluid(), (float) powerPerCycle, totalBurningTime); - } catch (InstantiationException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalArgumentException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } catch (InvocationTargetException ex) { - Logger.getLogger(Fuels.class.getName()).log(Level.SEVERE, null, ex); - } - - this.fuel = ieFuel; - } - - @Override - public void apply() { - IronEngineFuel.fuels.put(fuelName, fuel); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineFuel.fuels.remove(fuelName); - } - - @Override - public String describe() { - return "Adding iron engine fuel " + fuelName; - } - - @Override - public String describeUndo() { - return "Removing iron engine fuel " + fuelName; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveFuelAction implements IUndoableAction { - private final String fuelName; - private final IronEngineFuel.Fuel fuel; - - public RemoveFuelAction(String fuelName, IronEngineFuel.Fuel fuel) { - this.fuelName = fuelName; - this.fuel = fuel; - } - - @Override - public void apply() { - IronEngineFuel.fuels.remove(fuelName); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineFuel.fuels.put(fuelName, fuel); - } - - @Override - public String describe() { - return "Removing iron engine fuel " + fuelName; - } - - @Override - public String describeUndo() { - return "Restoring iron engine fuel " + fuelName; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddLiquidCoolantAction implements IUndoableAction { - private final String liquid; - private final IronEngineCoolant.Coolant coolant; - - public AddLiquidCoolantAction(String liquid, IronEngineCoolant.Coolant coolant) { - this.liquid = liquid; - this.coolant = coolant; - } - - @Override - public void apply() { - IronEngineCoolant.liquidCoolants.put(liquid, coolant); - } - - @Override - public boolean canUndo() { - return false; - } - - @Override - public void undo() { - IronEngineCoolant.liquidCoolants.remove(liquid); - } - - @Override - public String describe() { - return "Adding iron engine coolant " + liquid; - } - - @Override - public String describeUndo() { - return "Removing iron engine coolant " + liquid; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddCoolantItemAction implements IUndoableAction { - private final StackKey item; - private final FluidStack liquid; - - public AddCoolantItemAction(StackKey item, FluidStack liquid) { - this.item = item; - this.liquid = liquid; - } - - @Override - public void apply() { - IronEngineCoolant.solidCoolants.put(item, liquid); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineCoolant.solidCoolants.remove(item); - } - - @Override - public String describe() { - return "Adding iron engine coolant item " + MineTweakerMC.getIItemStack(item.stack); - } - - @Override - public String describeUndo() { - return "Removing iron engine coolant item " + MineTweakerMC.getIItemStack(item.stack); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveLiquidCoolantAction implements IUndoableAction { - private final String liquid; - private final IronEngineCoolant.Coolant coolant; - - public RemoveLiquidCoolantAction(String liquid, IronEngineCoolant.Coolant coolant) { - this.liquid = liquid; - this.coolant = coolant; - } - - @Override - public void apply() { - IronEngineCoolant.liquidCoolants.remove(liquid); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineCoolant.liquidCoolants.put(liquid, coolant); - } - - @Override - public String describe() { - return "Removing iron engine coolant " + liquid; - } - - @Override - public String describeUndo() { - return "Restoring iron engine coolant " + liquid; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveCoolantItemAction implements IUndoableAction { - private final StackKey item; - private final FluidStack liquid; - - public RemoveCoolantItemAction(StackKey item, FluidStack liquid) { - this.item = item; - this.liquid = liquid; - } - - @Override - public void apply() { - IronEngineCoolant.solidCoolants.remove(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - IronEngineCoolant.solidCoolants.put(item, liquid); - } - - @Override - public String describe() { - return "Removing iron engine coolant item " + item.stack.getDisplayName(); - } - - @Override - public String describeUndo() { - return "Restoring iron engine coolant item " + item.stack.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class MTCoolant implements IronEngineCoolant.Coolant { - private final float coolingPerMB; - - public MTCoolant(float coolingPerMB) { - this.coolingPerMB = coolingPerMB; - } - - @Override - public float getDegreesCoolingPerMB(float f) { - return coolingPerMB; - } - } -} diff --git a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/IIntegrationRecipeFunction.java b/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/IIntegrationRecipeFunction.java deleted file mode 100644 index f372d7d..0000000 --- a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/IIntegrationRecipeFunction.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import minetweaker.api.item.IItemStack; - -/** - * - * @author Stan - */ -public interface IIntegrationRecipeFunction { - public IItemStack recipe(IItemStack output, IItemStack inputA, IItemStack inputB); -} diff --git a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/IntegrationTable.java b/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/IntegrationTable.java deleted file mode 100644 index f55ee76..0000000 --- a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/IntegrationTable.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.recipes.BuildcraftRecipes; -import buildcraft.api.recipes.IIntegrationRecipeManager.IIntegrationRecipe; -import java.util.ArrayList; -import java.util.List; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.IntegrationTable") -@ModOnly("BuildCraft|Core") -public class IntegrationTable { - @ZenMethod - public static void addRecipe(IItemStack output, double energy, IIngredient inputA, IIngredient inputB, @Optional IIntegrationRecipeFunction function) { - MineTweakerAPI.apply(new AddRecipeAction(output, energy, inputA, inputB, function)); - } - - @ZenMethod - public static void remove(IIngredient output) { - removeRecipe(output, null, null); - } - - @ZenMethod - public static void removeRecipe(IIngredient output, @Optional IIngredient inputA, @Optional IIngredient inputB) { - List toRemove = new ArrayList(); - - outer: for (IIntegrationRecipe recipe : BuildcraftRecipes.integrationTable.getRecipes()) { - for (ItemStack component : recipe.getComponents()) { - if (!output.matches(MineTweakerMC.getIItemStack(component))) - continue outer; - - if (inputA != null) { - for (ItemStack example1 : recipe.getExampleInputsA()) { - if (!inputA.matches(MineTweakerMC.getIItemStack(example1))) { - continue outer; - } - } - } - - if (inputB != null) { - for (ItemStack example2 : recipe.getExampleInputsB()) { - if (!inputB.matches(MineTweakerMC.getIItemStack(example2))) { - continue outer; - } - } - } - - toRemove.add(recipe); - } - } - - for (IIntegrationRecipe recipe : toRemove) { - MineTweakerAPI.apply(new RemoveRecipeAction(recipe)); - } - } - - // ###################### - // ### Action Classes ### - // ###################### - - private static class AddRecipeAction implements IUndoableAction { - private final MTIntegrationRecipe recipe; - - public AddRecipeAction(IItemStack output, double energy, IIngredient inputA, IIngredient inputB, IIntegrationRecipeFunction function) { - recipe = new MTIntegrationRecipe(output, energy, inputA, inputB, function); - } - - @Override - public void apply() { - BuildcraftRecipes.integrationTable.addRecipe(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - BuildcraftRecipes.integrationTable.getRecipes().remove(recipe); - } - - @Override - public String describe() { - return "Adding integration table recipe for " + recipe.output; - } - - @Override - public String describeUndo() { - return "Removing integration table recipe for " + recipe.output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveRecipeAction implements IUndoableAction { - private final IIntegrationRecipe recipe; - - public RemoveRecipeAction(IIntegrationRecipe recipe) { - this.recipe = recipe; - } - - @Override - public void apply() { - BuildcraftRecipes.integrationTable.getRecipes().remove(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - BuildcraftRecipes.integrationTable.addRecipe(recipe); - } - - @Override - public String describe() { - return "Removing integration table recipe for " + MineTweakerMC.getIItemStack(recipe.getComponents()[0]); - } - - @Override - public String describeUndo() { - return "Restoring integration table recipe for " + MineTweakerMC.getIItemStack(recipe.getComponents()[0]); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class MTIntegrationRecipe implements IIntegrationRecipe { - private final IItemStack output; - private final ItemStack[] components; - private final double energy; - private final IIngredient inputA; - private final ItemStack[] inputAExamples; - private final IIngredient inputB; - private final ItemStack[] inputBExamples; - private final IIntegrationRecipeFunction function; - - private MTIntegrationRecipe(IItemStack output, double energy, IIngredient inputA, IIngredient inputB, IIntegrationRecipeFunction function) { - this.output = output; - this.components = new ItemStack[] { MineTweakerMC.getItemStack(output) }; - this.energy = energy; - this.inputA = inputA; - this.inputAExamples = MineTweakerMC.getExamples(inputA); - this.inputB = inputB; - this.inputBExamples = MineTweakerMC.getExamples(inputB); - this.function = function; - } - - @Override - public double getEnergyCost() { - return energy; - } - - @Override - public boolean isValidInputA(ItemStack is) { - return inputA.matches(MineTweakerMC.getIItemStack(is)); - } - - @Override - public boolean isValidInputB(ItemStack is) { - return inputB.matches(MineTweakerMC.getIItemStack(is)); - } - - @Override - public ItemStack getOutputForInputs(ItemStack is, ItemStack is1, ItemStack[] iss) { - if (function != null) { - IItemStack actualInputA = MineTweakerMC.getIItemStack(is); - IItemStack actualInputB = MineTweakerMC.getIItemStack(is1); - return MineTweakerMC.getItemStack(function.recipe(output, actualInputA, actualInputB)); - } else { - return MineTweakerMC.getItemStack(output); - } - } - - @Override - public ItemStack[] getComponents() { - return components; - } - - @Override - public ItemStack[] getExampleInputsA() { - return inputAExamples; - } - - @Override - public ItemStack[] getExampleInputsB() { - return inputBExamples; - } - } -} diff --git a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Refinery.java b/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Refinery.java deleted file mode 100644 index 9092371..0000000 --- a/MineTweaker3-MC172-Mod-Buildcraft/src/main/java/minetweaker/mods/buildcraft/Refinery.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.buildcraft; - -import buildcraft.api.recipes.BuildcraftRecipes; -import buildcraft.core.recipes.RefineryRecipeManager; -import buildcraft.core.recipes.RefineryRecipeManager.RefineryRecipe; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import java.util.SortedSet; -import java.util.logging.Level; -import java.util.logging.Logger; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.buildcraft.Refinery") -@ModOnly("BuildCraft|Core") -public class Refinery { - private static final Constructor CONSTRUCT_REFINERYRECIPE; - private static final Field REFINERYRECIPEMANAGER_RECIPES; - - static { - Constructor constructor = null; - try { - constructor = RefineryRecipe.class.getDeclaredConstructor(FluidStack.class, FluidStack.class, FluidStack.class, int.class, int.class); - constructor.setAccessible(true); - } catch (NoSuchMethodException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (SecurityException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - Field recipes = null; - try { - recipes = RefineryRecipeManager.class.getDeclaredField("recipes"); - recipes.setAccessible(true); - } catch (NoSuchFieldException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (SecurityException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - CONSTRUCT_REFINERYRECIPE = constructor; - REFINERYRECIPEMANAGER_RECIPES = recipes; - } - - - @ZenMethod - public static void addRecipe(ILiquidStack output, int energyPerMB, int ticksPerMB, ILiquidStack input1, @Optional ILiquidStack input2) { - MineTweakerAPI.apply(new AddRecipeAction(output, energyPerMB, ticksPerMB, input1, input2)); - } - - @ZenMethod - public static void remove(ILiquidStack output) { - Fluid fluid = MineTweakerMC.getLiquidStack(output).getFluid(); - - List toRemove = new ArrayList(); - for (RefineryRecipe recipe : ((RefineryRecipeManager) BuildcraftRecipes.refinery).getRecipes()) { - if (recipe.getResult().getFluid() == fluid) { - toRemove.add(recipe); - } - } - - for (RefineryRecipe recipe : toRemove) { - MineTweakerAPI.apply(new RemoveRecipeAction(recipe)); - } - } - - private static SortedSet getRecipes() { - try { - return (SortedSet) REFINERYRECIPEMANAGER_RECIPES.get((RefineryRecipeManager) BuildcraftRecipes.refinery); - } catch (IllegalArgumentException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - throw new RuntimeException("Refinery recipes unavailable"); - } - - // ###################### - // ### Action Classes ### - // ###################### - - private static class AddRecipeAction implements IUndoableAction { - private final ILiquidStack output; - private final RefineryRecipe recipe; - - public AddRecipeAction(ILiquidStack output, int energyPerMB, int ticksPerMB, ILiquidStack input1, ILiquidStack input2) { - this.output = output; - - RefineryRecipe rrecipe = null; - try { - rrecipe = (RefineryRecipe) CONSTRUCT_REFINERYRECIPE.newInstance( - MineTweakerMC.getLiquidStack(input1), - MineTweakerMC.getLiquidStack(input2), - MineTweakerMC.getLiquidStack(output), - energyPerMB, - ticksPerMB); - } catch (InstantiationException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (IllegalArgumentException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } catch (InvocationTargetException ex) { - Logger.getLogger(Refinery.class.getName()).log(Level.SEVERE, null, ex); - } - - recipe = rrecipe; - } - - @Override - public void apply() { - getRecipes().add(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - getRecipes().add(recipe); - } - - @Override - public String describe() { - return "Adding refinery recipe for " + output; - } - - @Override - public String describeUndo() { - return "Removing refinery recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveRecipeAction implements IUndoableAction { - private final RefineryRecipe recipe; - - public RemoveRecipeAction(RefineryRecipe recipe) { - this.recipe = recipe; - } - - @Override - public void apply() { - getRecipes().remove(recipe); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - getRecipes().add(recipe); - } - - @Override - public String describe() { - return "Removing refinery recipe for " - + recipe.getResult().getFluid().getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Restoring refinery recipe for " - + recipe.getResult().getFluid().getLocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/build.gradle b/MineTweaker3-MC172-Mod-GregTech/build.gradle deleted file mode 100644 index 7617791..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion172 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC172-Main') - compile files('libs/gregtech-1.7-api.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.gregtech.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-api.jar b/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-api.jar deleted file mode 100644 index e351d4e..0000000 Binary files a/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-api.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-dev.jar b/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-dev.jar deleted file mode 100644 index ce91455..0000000 Binary files a/MineTweaker3-MC172-Mod-GregTech/libs/gregtech-1.7-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java deleted file mode 100644 index 267a92b..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/AlloySmelter.java +++ /dev/null @@ -1,112 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the Alloy Smelter recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.AlloySmelter") -@ModOnly(MOD_ID) -public class AlloySmelter { - /** - * Adds an alloy smelter recipe. - * - * @param output alloy smelter output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks smelting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAlloySmelterRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding alloy smelter recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 53 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java deleted file mode 100644 index 64ecb5d..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Amplifabricator.java +++ /dev/null @@ -1,96 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the amplifabricator. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Amplifabricator") -@ModOnly(MOD_ID) -public class Amplifabricator { - /** - * Adds an amplifier. - * - * @param item amplifier item - * @param durationTicks duration in ticks - * @param amount amplification amount - */ - @ZenMethod - public static void addAmplifier(IItemStack item, int durationTicks, int amount) { - MineTweakerAPI.apply(new AddAmplifierAction(item, durationTicks, amount)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddAmplifierAction extends OneWayAction { - private final IItemStack item; - private final int duration; - private final int amount; - - public AddAmplifierAction(IItemStack item, int duration, int amount) { - this.item = item; - this.duration = duration; - this.amount = amount; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAmplifier( - MineTweakerMC.getItemStack(item), - duration, - amount); - } - - @Override - public String describe() { - return "Adding amplifier " + item; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.item != null ? this.item.hashCode() : 0); - hash = 59 * hash + this.duration; - hash = 59 * hash + this.amount; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddAmplifierAction other = (AddAmplifierAction) obj; - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.amount != other.amount) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java deleted file mode 100644 index d0ad251..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Assembler.java +++ /dev/null @@ -1,112 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the assembler recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Assembler") -@ModOnly(MOD_ID) -public class Assembler { - /** - * Adds an assemble recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks assembling duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addAssemblerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding assembler recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java deleted file mode 100644 index abbb5d1..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/BlastFurnace.java +++ /dev/null @@ -1,146 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Blast Furnace recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.BlastFurnace") -@ModOnly(MOD_ID) -public class BlastFurnace { - /** - * Adds a recipe with a single output. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - * @param heat required heat capacity - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, null, durationTicks, euPerTick, heat)); - } - - /** - * Adds a recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - * @param heat required heat capacity - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick, int heat) { - if (output.length == 0) { - MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output[0], output.length > 1 ? output[1] : null, durationTicks, euPerTick, heat)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack input1; - private final IItemStack input2; - private final IItemStack output1; - private final IItemStack output2; - private final int duration; - private final int euPerTick; - private final int heat; - - public AddRecipeAction(IItemStack input1, IItemStack input2, IItemStack output1, IItemStack output2, int duration, int euPerTick, int heat) { - this.input1 = input1; - this.input2 = input2; - this.output1 = output1; - this.output2 = output2; - this.duration = duration; - this.euPerTick = euPerTick; - this.heat = heat; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBlastRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick, - heat); - } - - @Override - public String describe() { - return "Adding blast furnace recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 89 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 89 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 89 * hash + this.duration; - hash = 89 * hash + this.euPerTick; - hash = 89 * hash + this.heat; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.heat != other.heat) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java deleted file mode 100644 index eb7a56d..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Boxing.java +++ /dev/null @@ -1,200 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the boxing and unboxing recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Boxing") -@ModOnly(MOD_ID) -public class Boxing { - /** - * Adds a boxing recipe. - * - * @param fullBox the full box - * @param item the item to be packed - * @param emptyBox empty box - * @param durationTicks boxing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addBoxingRecipe(IItemStack fullBox, IItemStack item, IItemStack emptyBox, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddBoxingAction(fullBox, item, emptyBox, durationTicks, euPerTick)); - } - - /** - * Adds an unboxing recipe. - * - * @param item the item after unpacking - * @param emptyBox the empty box after unpacking - * @param fullBox full box - * @param durationTicks unboxing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addUnboxingRecipe(IItemStack item, IItemStack emptyBox, IItemStack fullBox, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddUnboxingAction(item, emptyBox, fullBox, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddBoxingAction extends OneWayAction { - private final IItemStack fullBox; - private final IItemStack item; - private final IItemStack emptyBox; - private final int duration; - private final int euPerTick; - - public AddBoxingAction(IItemStack fullBox, IItemStack item, IItemStack emptyBox, int duration, int euPerTick) { - this.fullBox = fullBox; - this.item = item; - this.emptyBox = emptyBox; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBoxingRecipe( - MineTweakerMC.getItemStack(item), - MineTweakerMC.getItemStack(emptyBox), - MineTweakerMC.getItemStack(fullBox), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding boxing recipe to pack " + item + " in " + emptyBox; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.fullBox != null ? this.fullBox.hashCode() : 0); - hash = 89 * hash + (this.item != null ? this.item.hashCode() : 0); - hash = 89 * hash + (this.emptyBox != null ? this.emptyBox.hashCode() : 0); - hash = 89 * hash + this.duration; - hash = 89 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBoxingAction other = (AddBoxingAction) obj; - if (this.fullBox != other.fullBox && (this.fullBox == null || !this.fullBox.equals(other.fullBox))) { - return false; - } - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - if (this.emptyBox != other.emptyBox && (this.emptyBox == null || !this.emptyBox.equals(other.emptyBox))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } - - private static class AddUnboxingAction extends OneWayAction { - private final IItemStack item; - private final IItemStack emptyBox; - private final IItemStack fullBox; - private final int duration; - private final int euPerTick; - - public AddUnboxingAction(IItemStack item, IItemStack emptyBox, IItemStack fullBox, int duration, int euPerTick) { - this.item = item; - this.emptyBox = emptyBox; - this.fullBox = fullBox; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addUnboxingRecipe( - MineTweakerMC.getItemStack(fullBox), - MineTweakerMC.getItemStack(item), - MineTweakerMC.getItemStack(emptyBox), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding unboxing recipe to unbox " + fullBox; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 83 * hash + (this.item != null ? this.item.hashCode() : 0); - hash = 83 * hash + (this.emptyBox != null ? this.emptyBox.hashCode() : 0); - hash = 83 * hash + (this.fullBox != null ? this.fullBox.hashCode() : 0); - hash = 83 * hash + this.duration; - hash = 83 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddUnboxingAction other = (AddUnboxingAction) obj; - if (this.item != other.item && (this.item == null || !this.item.equals(other.item))) { - return false; - } - if (this.emptyBox != other.emptyBox && (this.emptyBox == null || !this.emptyBox.equals(other.emptyBox))) { - return false; - } - if (this.fullBox != other.fullBox && (this.fullBox == null || !this.fullBox.equals(other.fullBox))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java deleted file mode 100644 index 3fa4b6d..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/CNC.java +++ /dev/null @@ -1,104 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the CNC recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.CNC") -@ModOnly(MOD_ID) -public class CNC { - /** - * Adds a CNC recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCNCRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding CNC recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java deleted file mode 100644 index 53f54fb..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Canner.java +++ /dev/null @@ -1,137 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provider access to the Canner recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Canner") -@ModOnly(MOD_ID) -public class Canner { - /** - * Adds a canner recipe with a single output. - * - * @param output crafting output - * @param input1 primary input - * @param input2 secondary input (optional - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, durationTicks, euPerTick)); - } - - /** - * Adds a canner recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary input - * @param input2 secondary input (optional, can be null) - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input1, IItemStack input2, int durationTicks, int euPerTick) { - if (output.length == 0) { - MineTweakerAPI.logError("canner requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, IItemStack input2, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCannerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding canner recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 79 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java deleted file mode 100644 index e58240b..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Centrifuge.java +++ /dev/null @@ -1,129 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.gregtech.Centrifuge") -@ModOnly(MOD_ID) -public class Centrifuge { - /** - * Adds a centrifuge recipe. - * - * @param outputs array with 1-6 outputs - * @param input recipe input - * @param cells number of cells required, can be 0 - * @param durationTicks centrifuging time, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks)); - } - } - - /** - * Adds a centrifuge recipe taking a fuel can as container. - * - * @param outputs array with 1-6 outputs - * @param input recipe input - * @param duration centrifuging time, in ticks - */ - @ZenMethod - public static void addRecipeFuelCan(IItemStack[] outputs, IItemStack input, int duration) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, -1, duration)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IItemStack input; - private final int cells; - private final int duration; - - public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCentrifugeRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - duration); - } - - @Override - public String describe() { - return "Adding centrifuge recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 59 * hash + Arrays.deepHashCode(this.output); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.cells; - hash = 59 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java deleted file mode 100644 index 2e26609..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ChemicalReactor.java +++ /dev/null @@ -1,104 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Chemical Reactor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ChemicalReactor") -@ModOnly(MOD_ID) -public class ChemicalReactor { - /** - * Adds a Chemical Reactor recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks reaction time, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int duration; - - public AddRecipeAction(IItemStack output, IItemStack input1, IItemStack input2, int duration) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addChemicalRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding chemical reactor recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 11 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 11 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 11 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 11 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java deleted file mode 100644 index 4bebe07..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/DistillationTower.java +++ /dev/null @@ -1,133 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the distillation tower recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.DistillationTower") -@ModOnly(MOD_ID) -public class DistillationTower { - /** - * Adds a distillation tower recipe with a single output. - * - * @param output recipe output - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks distillation time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int cells, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input, cells, durationTicks, euPerTick)); - } - - /** - * Adds a distillation tower recipe with multiple outputs. - * - * @param outputs array with 1-4 outputs - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks distillation time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("Distillation tower recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] outputs; - private final IItemStack input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] outputs, IItemStack input, int cells, int duration, int euPerTick) { - this.outputs = outputs; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addDistillationRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null, - duration, euPerTick); - } - - @Override - public String describe() { - return "Adding Distillation tower recipe for " + outputs[0]; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 41 * hash + Arrays.deepHashCode(this.outputs); - hash = 41 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 41 * hash + this.cells; - hash = 41 * hash + this.duration; - hash = 41 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.outputs, other.outputs)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java deleted file mode 100644 index 43e53f6..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Electrolyzer.java +++ /dev/null @@ -1,122 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Electrolyzer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Electrolyzer") -@ModOnly(MOD_ID) -public class Electrolyzer { - /** - * Adds an electrolyzer recipe. - * - * @param outputs array with 1-6 outputs - * @param input recipe input - * @param cells number of cells required (can be 0) - * @param durationTicks electrolyzing duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int cells, int durationTicks, int euPerTick) { - if (outputs.length < 1) { - MineTweakerAPI.logError("Electrolyzer recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IItemStack input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IItemStack input, int cells, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addElectrolyzerRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - duration, - cells); - } - - @Override - public String describe() { - return "Adding electrolyzer recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + Arrays.deepHashCode(this.output); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.cells; - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java deleted file mode 100644 index 2d8bcd9..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Extruder.java +++ /dev/null @@ -1,112 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the extruder recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Extruder") -@ModOnly(MOD_ID) -public class Extruder { - /** - * Adds an extruder recipe. - * - * @param output recipe output - * @param input recipe input - * @param shape shape (set stack size to 0 to prevent the shape from being consumed) - * @param durationTicks extruding time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, IItemStack shape, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final IItemStack shape; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, IItemStack shape, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.shape = shape; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addExtruderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(shape), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding extruder recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + (this.shape != null ? this.shape.hashCode() : 0); - hash = 67 * hash + this.duration; - hash = 67 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.shape != other.shape && (this.shape == null || !this.shape.equals(other.shape))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java deleted file mode 100644 index 4ce7ba5..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ForgeHammer.java +++ /dev/null @@ -1,104 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Forge Hammer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ForgeHammer") -@ModOnly(MOD_ID) -public class ForgeHammer { - /** - * Add a Forge Hammer recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks forging duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addForgeHammerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding forge hammer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java deleted file mode 100644 index 3d92219..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Fuels.java +++ /dev/null @@ -1,178 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the fuels used by the various generators. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Fuels") -@ModOnly(MOD_ID) -public class Fuels { - /** - * Adds a Diesel Engine fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addDieselFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 0)); - } - - /** - * Adds a Gas Turbine fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addGasTurbineFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 1)); - } - - /** - * Adds a Thermal Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addThermalGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 2)); - } - - /** - * Adds a Dense Fluid Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addDenseFluidFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 3)); - } - - /** - * Adds a Plasma Generator fuel. If the given item does not contain any - * liquid, it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addPlasmaGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 4)); - } - - /** - * Adds a Magic Generator fuel. If the given item does not contain any liquid, - * it will generate the equivalent of 1000 millibuckets. - * - * @param output output item (optional, can be null) - * @param input input item - * @param euPerMillibucket eu production per millibucket - */ - @ZenMethod - public static void addMagicGeneratorFuel(IItemStack output, IItemStack input, int euPerMillibucket) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, euPerMillibucket, 5)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private static final String[] GENERATORS = { - "diesel", - "gas turbine", - "thermal", - "dense fluid", - "plasma", - "magic" - }; - - private final IItemStack output; - private final IItemStack input; - private final int euPerMillibucket; - private final int type; - - public AddRecipeAction(IItemStack output, IItemStack input, int euPerMillibucket, int type) { - this.output = output; - this.input = input; - this.euPerMillibucket = euPerMillibucket; - this.type = type; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addFuel( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - euPerMillibucket, - type); - } - - @Override - public String describe() { - return "Adding " + GENERATORS[type] + " fuel " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.euPerMillibucket; - hash = 59 * hash + this.type; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.euPerMillibucket != other.euPerMillibucket) { - return false; - } - if (this.type != other.type) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java deleted file mode 100644 index 3f07eb7..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/FusionReactor.java +++ /dev/null @@ -1,126 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the fusion reactor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.FusionReactor") -@ModOnly(MOD_ID) -public class FusionReactor { - /** - * Adds a Fusion Reactor recipe. - * - * @param output reactor output - * @param input1 primary input - * @param input2 secondary input - * @param durationTicks fusion duration, in ticks - * @param energyPerTick eu consumption per tick - * @param startEnergy starting energy - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int durationTicks, int energyPerTick, int startEnergy) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, energyPerTick, startEnergy)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input1; - private final IItemStack input2; - private final int durationTicks; - private final int energyPerTick; - private final int startEnergy; - - public AddRecipeAction( - IItemStack output, - IItemStack input1, - IItemStack input2, - int durationTicks, - int energyPerTick, - int startEnergy) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.durationTicks = durationTicks; - this.energyPerTick = energyPerTick; - this.startEnergy = startEnergy; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addFusionReactorRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - durationTicks, - energyPerTick, - startEnergy); - } - - @Override - public String describe() { - return "Adding fusion reactor recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 97 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 97 * hash + this.durationTicks; - hash = 97 * hash + this.energyPerTick; - hash = 97 * hash + this.startEnergy; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.durationTicks != other.durationTicks) { - return false; - } - if (this.energyPerTick != other.energyPerTick) { - return false; - } - if (this.startEnergy != other.startEnergy) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java deleted file mode 100644 index 631d2ec..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Grinder.java +++ /dev/null @@ -1,116 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import gregtech.api.util.GT_ModHandler; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Grinder recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Grinder") -@ModOnly(MOD_ID) -public class Grinder { - /** - * Adds a recipe with a single output. - * - * @param output grinder output - * @param input1 grinder primary input - * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(new IItemStack[] { output }, input1, input2)); - } - - /** - * Adds a recipe with multiple outputs. - * - * @param outputs array with 1-4 outputs - * @param input1 grinder primary input - * @param input2 grinder liquid input (optional, will use 1 water cell if set to null) - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(outputs, input1, input2)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] outputs; - private final IItemStack input1; - private final IItemStack input2; - - private AddRecipeAction(IItemStack[] outputs, IItemStack input1, IItemStack input2) { - this.outputs = outputs; - this.input1 = input1; - this.input2 = input2; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addGrinderRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null); - } - - @Override - public String describe() { - return "Adding grinder recipe for " + outputs[0]; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 89 * hash + Arrays.deepHashCode(this.outputs); - hash = 89 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 89 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.outputs, other.outputs)) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java deleted file mode 100644 index 01e4caa..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/ImplosionCompressor.java +++ /dev/null @@ -1,119 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Implosion Compressor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.ImplosionCompressor") -@ModOnly(MOD_ID) -public class ImplosionCompressor { - /** - * Adds an implosion compressor recipe with a single output. - * - * @param output recipe output - * @param input primary input - * @param tnt amount of TNT needed - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int tnt) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt)); - } - - /** - * Adds an implosion compressor recipe with one or two outputs. - * - * @param output array with 1-2 outputs - * @param input primary input - * @param tnt amount of TNT needed - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IItemStack input, int tnt) { - if (output.length == 0) { - MineTweakerAPI.logError("Implosion compressor recipe requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input, tnt)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input1; - private final int tnt; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input1, int tnt) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.tnt = tnt; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addImplosionRecipe( - MineTweakerMC.getItemStack(input1), - tnt, - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2)); - } - - @Override - public String describe() { - return "Adding Implosion compressor recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 97 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 97 * hash + this.tnt; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.tnt != other.tnt) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java deleted file mode 100644 index 3e96030..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Lathe.java +++ /dev/null @@ -1,133 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point for Lathe recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Lathe") -@ModOnly(MOD_ID) -public class Lathe { - /** - * Adds a lathe recipe with a single output. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, durationTicks, euPerTick)); - } - - /** - * Adds a lathe recipe with 1 or 2 outputs. - * - * @param outputs array with 1-2 outputs - * @param input recipe input - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input, int durationTicks, int euPerTick) { - if (outputs.length == 0) { - MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - input, - durationTicks, - euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack input, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addLatheRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding lathe recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 53 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java deleted file mode 100644 index baaada2..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateBender.java +++ /dev/null @@ -1,104 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Access point to Plate Bender recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.PlateBender") -@ModOnly(MOD_ID) -public class PlateBender { - /** - * Adds a plate bender recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks bending time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addBenderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate bender recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java deleted file mode 100644 index 6a8c7bb..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/PlateCutter.java +++ /dev/null @@ -1,104 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Plate Cutter recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.PlateCutter") -@ModOnly(MOD_ID) -public class PlateCutter { - /** - * Adds a plate cutter recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks cutting time, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addCutterRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate cutter recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 17 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 17 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 17 * hash + this.duration; - hash = 17 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java deleted file mode 100644 index 995a745..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sawmill.java +++ /dev/null @@ -1,131 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import gregtech.api.util.GT_ModHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Sawmill recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Sawmill") -@ModOnly(MOD_ID) -public class Sawmill { - /** - * Adds a new sawmill recipe. - * - * @param output recipe output - * @param input1 primary input - * @param input2 secondary input (optional, if set to null will use a water cell) - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction(output, null, null, input1, input2)); - } - - /** - * Adds a new sawmill recipe with 1-3 outputs. - * - * @param outputs array with 1-3 outputs - * @param input1 primary input - * @param input2 secondary input (optional, if set to null will use a water cell) - */ - @ZenMethod - public static void addRecipe(IItemStack[] outputs, IItemStack input1, @Optional IItemStack input2) { - if (input2 == null) input2 = MineTweakerMC.getIItemStack(GT_ModHandler.getWaterCell(1)); - MineTweakerAPI.apply(new AddRecipeAction( - outputs[0], - outputs.length > 1 ? outputs[1] : null, - outputs.length > 2 ? outputs[2] : null, - input1, - input2)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IItemStack output3; - private final IItemStack input1; - private final IItemStack input2; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack input1, IItemStack input2) { - this.output1 = output1; - this.output2 = output2; - this.output3 = output3; - this.input1 = input1; - this.input2 = input2; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addSawmillRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - MineTweakerMC.getItemStack(output3)); - } - - @Override - public String describe() { - return "Adding Sawmill recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 23 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 23 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 23 * hash + (this.output3 != null ? this.output3.hashCode() : 0); - hash = 23 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 23 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.output3 != other.output3 && (this.output3 == null || !this.output3.equals(other.output3))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java deleted file mode 100644 index e94c81c..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Sonictron.java +++ /dev/null @@ -1,88 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the sonictron. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Sonictron") -@ModOnly(MOD_ID) -public class Sonictron { - /** - * Adds a sonictron sound. - * - * @param itemStack item you want to display for this sound - * @param soundName name of the Sound in the resources/newsound-folder like Vanillasounds - */ - @ZenMethod - public static void addSound(IItemStack itemStack, String soundName) { - MineTweakerAPI.apply(new AddSoundAction(itemStack, soundName)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddSoundAction extends OneWayAction { - private final IItemStack itemStack; - private final String soundName; - - public AddSoundAction(IItemStack itemStack, String soundName) { - this.itemStack = itemStack; - this.soundName = soundName; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addSonictronSound( - MineTweakerMC.getItemStack(itemStack), - soundName); - } - - @Override - public String describe() { - return "Adding sonictron sound " + soundName; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.itemStack != null ? this.itemStack.hashCode() : 0); - hash = 79 * hash + (this.soundName != null ? this.soundName.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddSoundAction other = (AddSoundAction) obj; - if (this.itemStack != other.itemStack && (this.itemStack == null || !this.itemStack.equals(other.itemStack))) { - return false; - } - if ((this.soundName == null) ? (other.soundName != null) : !this.soundName.equals(other.soundName)) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java deleted file mode 100644 index c92f222..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/VacuumFreezer.java +++ /dev/null @@ -1,96 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Vacuum Freezer recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.VacuumFreezer") -@ModOnly(MOD_ID) -public class VacuumFreezer { - /** - * Adds a vacuum freezer recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks freezing duration, in ticks - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration) { - this.output = output; - this.input = input; - this.duration = duration; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addVacuumFreezerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding vacuum freezer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java b/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java deleted file mode 100644 index 18e2059..0000000 --- a/MineTweaker3-MC172-Mod-GregTech/src/main/java/minetweaker/mods/gregtech/machines/Wiremill.java +++ /dev/null @@ -1,104 +0,0 @@ -package minetweaker.mods.gregtech.machines; - -import gregtech.api.GregTech_API; -import static gregtech.api.GregTech_API.MOD_ID; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the Wiremill recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.gregtech.Wiremill") -@ModOnly(MOD_ID) -public class Wiremill { - /** - * Adds a Wiremill recipe. - * - * @param output recipe output - * @param input recipe input - * @param durationTicks processing time - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IItemStack input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IItemStack input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - GregTech_API.sRecipeAdder.addWiremillRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding wiremill recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 37 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 37 * hash + this.duration; - hash = 37 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/build.gradle b/MineTweaker3-MC172-Mod-IC2/build.gradle deleted file mode 100644 index b3091d1..0000000 --- a/MineTweaker3-MC172-Mod-IC2/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion172 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC172-Main') - compile files('libs/industrialcraft-2-2.1.476-experimental-api.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.ic2.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC172-Mod-IC2/libs/industrialcraft-2-2.1.476-experimental-api.jar b/MineTweaker3-MC172-Mod-IC2/libs/industrialcraft-2-2.1.476-experimental-api.jar deleted file mode 100644 index 22761c4..0000000 Binary files a/MineTweaker3-MC172-Mod-IC2/libs/industrialcraft-2-2.1.476-experimental-api.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-IC2/libs/industrialcraft-2-2.1.476-experimental-dev.jar b/MineTweaker3-MC172-Mod-IC2/libs/industrialcraft-2-2.1.476-experimental-dev.jar deleted file mode 100644 index f098d8e..0000000 Binary files a/MineTweaker3-MC172-Mod-IC2/libs/industrialcraft-2-2.1.476-experimental-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2BracketHandler.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2BracketHandler.java deleted file mode 100644 index a272068..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2BracketHandler.java +++ /dev/null @@ -1,103 +0,0 @@ -package minetweaker.mods.ic2; - -import ic2.api.item.IC2Items; -import java.util.List; -import minetweaker.IBracketHandler; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.BracketHandler; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; -import stanhebben.zenscript.ZenTokener; -import stanhebben.zenscript.compiler.IEnvironmentGlobal; -import stanhebben.zenscript.expression.ExpressionCallStatic; -import stanhebben.zenscript.expression.ExpressionInt; -import stanhebben.zenscript.expression.ExpressionString; -import stanhebben.zenscript.expression.partial.IPartialExpression; -import stanhebben.zenscript.parser.Token; -import stanhebben.zenscript.symbols.IZenSymbol; -import stanhebben.zenscript.type.ZenType; -import stanhebben.zenscript.type.natives.IJavaMethod; -import stanhebben.zenscript.util.ZenPosition; - -/** - * Makes a ic2-item specific item syntax available in the form <item-ic2:name[:meta]>. - * - * @author Stan Hebben - */ -@BracketHandler -@ModOnly("IC2") -public class IC2BracketHandler implements IBracketHandler { - public static IItemStack getItem(String name, int meta) { - ItemStack stack = IC2Items.getItem(name); - stack.setItemDamage(meta); - return getIItemStack(stack); - } - - private final IJavaMethod method; - - public IC2BracketHandler() { - method = MineTweakerAPI.getJavaMethod(IC2BracketHandler.class, "getItem", String.class, int.class); - } - - @Override - public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { - if (tokens.size() >= 5) { - if (tokens.get(0).getValue().equals("ic2") - && tokens.get(1).getValue().equals("-") - && tokens.get(2).getValue().equals("item") - && tokens.get(3).getValue().equals(":")) { - String name = tokens.get(4).getValue(); - int meta = 0; - if (tokens.size() > 6 && tokens.get(5).getValue().equals(":")) { - if (tokens.get(6).getType() == ZenTokener.T_INTVALUE) { - meta = Integer.parseInt(tokens.get(6).getValue()); - } else if (tokens.get(6).getValue().equals("*")) { - meta = OreDictionary.WILDCARD_VALUE; - } else { - MineTweakerAPI.logError("Not a valid meta value: " + tokens.get(6).getValue()); - } - } - ItemStack item = IC2Items.getItem(name); - if (item == null) { - MineTweakerAPI.logError("Not a valid IC2 item: " + name); - return null; - } else { - return new ItemReferenceSymbol(environment, name, meta); - } - } else { - return null; - } - } else { - return null; - } - } - - // ############################# - // ### Private inner classes ### - // ############################# - - private class ItemReferenceSymbol implements IZenSymbol { - private final IEnvironmentGlobal environment; - private final String name; - private final int meta; - - public ItemReferenceSymbol(IEnvironmentGlobal environment, String name, int meta) { - this.environment = environment; - this.name = name; - this.meta = meta; - } - - @Override - public IPartialExpression instance(ZenPosition position) { - return new ExpressionCallStatic( - position, - environment, - method, - new ExpressionString(position, name), - new ExpressionInt(position, meta, ZenType.INT)); - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2ExplosionWhitelist.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2ExplosionWhitelist.java deleted file mode 100644 index ed5c0a8..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2ExplosionWhitelist.java +++ /dev/null @@ -1,161 +0,0 @@ -package minetweaker.mods.ic2; - -import ic2.api.tile.ExplosionWhitelist; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Manages the explosion whitelist in IC2. Blocks on this whitelist will not resist - * an explosion but won't be destroyed. - * - * The explosion code by default ignores blocks which absorb more than 1000 explosion power to - * prevent abusing personal safes, Trade-O-Mats and other blocks to serve as a cheap and - * invulnerable reactor chambers. Said blocks will not shield the explosion and won't get - * destroyed. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.ExplosionWhitelist") -@ModOnly("IC2") -public class IC2ExplosionWhitelist { - /** - * Adds a block to the explosion whitelist. - * - * @param item item to add - */ - @ZenMethod - public static void add(IItemStack item) { - ItemStack iStack = getItemStack(item); - Block block = Block.getBlockFromItem(iStack.getItem()); - if (block == null) { - MineTweakerAPI.logError("This item is not a block"); - } else { - MineTweakerAPI.apply(new AddAction(block)); - } - } - - /** - * Removes a block from the explosion whitelist. - * - * @param item item to remove - */ - @ZenMethod - public static void remove(IItemStack item) { - ItemStack iStack = getItemStack(item); - Block block = Block.getBlockFromItem(iStack.getItem()); - if (block == null) { - MineTweakerAPI.logError("This item is not a block"); - } else { - if (ExplosionWhitelist.isBlockWhitelisted(block)) { - MineTweakerAPI.logWarning("This block is not in the whitelist"); - } else { - MineTweakerAPI.apply(new RemoveAction(block)); - } - } - } - - /** - * Checks if the given item is already whitelisted. - * - * @param item item to check - * @return true if whitelisted - */ - @ZenMethod - public static boolean isWhitelisted(IItemStack item) { - ItemStack iStack = getItemStack(item); - Block block = Block.getBlockFromItem(iStack.getItem()); - if (block == null) { - MineTweakerAPI.logWarning("This item is not a block"); - return false; - } else { - return ExplosionWhitelist.isBlockWhitelisted(block); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddAction implements IUndoableAction { - private final Block block; - - public AddAction(Block block) { - this.block = block; - } - - @Override - public void apply() { - ExplosionWhitelist.addWhitelistedBlock(block); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ExplosionWhitelist.removeWhitelistedBlock(block); - } - - @Override - public String describe() { - return "Adding block to IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Removing block from IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class RemoveAction implements IUndoableAction { - private final Block block; - - public RemoveAction(Block block) { - this.block = block; - } - - @Override - public void apply() { - ExplosionWhitelist.removeWhitelistedBlock(block); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - ExplosionWhitelist.addWhitelistedBlock(block); - } - - @Override - public String describe() { - return "Removing block from IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public String describeUndo() { - return "Adding block to IC2 explosion whitelist: " + block.getLocalizedName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2RecipeInput.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2RecipeInput.java deleted file mode 100644 index 315d0d6..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/IC2RecipeInput.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2; - -import ic2.api.recipe.IRecipeInput; -import java.util.ArrayList; -import java.util.List; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import net.minecraft.item.ItemStack; - -/** - * Wrapper class for ITweakerItemStackPatterns to IC2 recipe inputs. - * - * @author Stan Hebben - */ -public class IC2RecipeInput implements IRecipeInput { - private final IIngredient ingredient; - - public IC2RecipeInput(IIngredient ingredient) { - this.ingredient = ingredient; - } - - @Override - public boolean matches(ItemStack subject) { - return ingredient.matches(getIItemStack(subject)); - } - - @Override - public int getAmount() { - return ingredient.getAmount(); - } - - @Override - public List getInputs() { - List items = new ArrayList(); - for (IItemStack item : ingredient.getItems()) { - items.add(getItemStack(item)); - } - return items; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.ingredient != null ? this.ingredient.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final IC2RecipeInput other = (IC2RecipeInput) obj; - if (this.ingredient != other.ingredient && (this.ingredient == null || !this.ingredient.equals(other.ingredient))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/MachineAddRecipeAction.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/MachineAddRecipeAction.java deleted file mode 100644 index 4866974..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/MachineAddRecipeAction.java +++ /dev/null @@ -1,100 +0,0 @@ -package minetweaker.mods.ic2; - -import ic2.api.recipe.IMachineRecipeManager; -import java.util.Arrays; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * - * @author Stan Hebben - */ -public class MachineAddRecipeAction extends OneWayAction { - private final String name; - private final IMachineRecipeManager machine; - private final ItemStack[] output; - private final IC2RecipeInput input; - private final NBTTagCompound tag; - - public MachineAddRecipeAction(String name, IMachineRecipeManager machine, ItemStack[] output, NBTTagCompound tag, IC2RecipeInput input) { - this.name = name; - this.machine = machine; - this.output = output; - this.input = input; - this.tag = tag; - } - - @Override - public void apply() { - try { - machine.addRecipe(input, tag, output); - } catch (RuntimeException ex) { - MineTweakerAPI.logError(ex.getMessage()); - } - } - - @Override - public String describe() { - if (output.length == 1) { - return "Adding " + name + " recipe for " + output[0].getDisplayName(); - } else { - StringBuilder result = new StringBuilder(); - result.append("Adding ").append(name).append(" recipe for "); - result.append("["); - for (int i = 0; i < output.length; i++) { - if (i == 0) { - result.append(", "); - } else { - result.append(output[i].getDisplayName()); - } - } - result.append("]"); - return result.toString(); - } - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0); - hash = 47 * hash + (this.machine != null ? this.machine.hashCode() : 0); - hash = 47 * hash + Arrays.deepHashCode(this.output); - hash = 47 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 47 * hash + (this.tag != null ? this.tag.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final MachineAddRecipeAction other = (MachineAddRecipeAction) obj; - if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { - return false; - } - if (this.machine != other.machine && (this.machine == null || !this.machine.equals(other.machine))) { - return false; - } - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.tag != other.tag && (this.tag == null || !this.tag.equals(other.tag))) { - return false; - } - return true; - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/IngredientExpansion.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/IngredientExpansion.java deleted file mode 100644 index 864766a..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/IngredientExpansion.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.expand; - -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemCondition; -import minetweaker.api.item.IItemStack; -import minetweaker.api.item.IItemTransformer; -import minetweaker.api.player.IPlayer; -import stanhebben.zenscript.annotations.ZenExpansion; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenExpansion("minetweaker.item.IIngredient") -@ModOnly("IC2") -public class IngredientExpansion { - @ZenMethod - public static IIngredient onlyIC2ChargeAtLeast(IIngredient ingredient, final int charge) { - return ingredient.only(new IItemCondition() { - @Override - public boolean matches(IItemStack stack) { - return ItemExpansion.getIC2Charge(stack) >= charge; - } - }); - } - - @ZenMethod - public static IIngredient onlyIC2ChargeAtMost(IIngredient ingredient, final int charge) { - return ingredient.only(new IItemCondition() { - @Override - public boolean matches(IItemStack stack) { - return ItemExpansion.getIC2Charge(stack) <= charge; - } - }); - } - - @ZenMethod - public static IIngredient transformIC2Discharge(IIngredient ingredient, final int amount) { - return ingredient.transform(new IItemTransformer() { - @Override - public IItemStack transform(IItemStack item, IPlayer byPlayer) { - return ItemExpansion.ic2Discharge(item, amount, 0).withAmount(item.getAmount() + 1); - } - }); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/ItemExpansion.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/ItemExpansion.java deleted file mode 100644 index 5c14bff..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/expand/ItemExpansion.java +++ /dev/null @@ -1,141 +0,0 @@ -package minetweaker.mods.ic2.expand; - -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import minetweaker.annotations.ModOnly; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import minetweaker.api.item.IItemStack; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import stanhebben.zenscript.annotations.Optional; -import stanhebben.zenscript.annotations.ZenExpansion; -import stanhebben.zenscript.annotations.ZenGetter; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenExpansion("minecraft.item.IItemStack") -@ModOnly("IC2") -public class ItemExpansion { - /** - * Gets the charge level of this item. - * - * @param stack target - * @return charge level - */ - @ZenGetter("ic2getCharge") - public static int getIC2Charge(IItemStack stack) { - return ElectricItem.manager.getCharge(getItemStack(stack)); - } - - /** - * Gets the tier level of this item. - * - * @param stack target - * @return tier level - */ - @ZenGetter("ic2tier") - public static int getIC2Tier(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - return ((IElectricItem) iStack.getItem()).getTier(iStack); - } else { - return 0; - } - } - - /** - * Gets the transfer limit of the specified stack. - * - * @param stack target - * @return - */ - @ZenGetter("ic2transferLimit") - public static int getIC2TransferLimit(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - return ((IElectricItem) iStack.getItem()).getTransferLimit(iStack); - } else { - return 0; - } - } - - /** - * Gets the fully charged IC2 item. - * - * @param stack target - * @return charged item - */ - @ZenGetter("ic2charged") - public static IItemStack getIC2Charged(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - IElectricItem eItem = (IElectricItem) iStack.getItem(); - Item item = eItem.getChargedItem(iStack); - ItemStack stack2 = new ItemStack(item, 1, 0); - ElectricItem.manager.charge(stack2, eItem.getMaxCharge(stack2), eItem.getTier(stack2), true, false); - return getIItemStack(stack2); - } else { - return null; - } - } - - /** - * Gets the fully discharged IC2 item. - * - * @param stack target - * @return discharged item - */ - @ZenGetter("ic2discharged") - public static IItemStack getIC2Discharged(IItemStack stack) { - ItemStack iStack = getItemStack(stack); - if (iStack.getItem() instanceof IElectricItem) { - IElectricItem eItem = (IElectricItem) iStack.getItem(); - Item item = eItem.getEmptyItem(iStack); - return getItemStack(item, 1, 0); - } else { - return null; - } - } - - /** - * Charges the item with the specified amount and returns the charged item. - * - * @param stack target - * @param amount charge amount - * @param tier charge tier - * @return charged item - */ - @ZenMethod("ic2charge") - public static IItemStack ic2Charge(IItemStack stack, int amount, @Optional int tier) { - if (tier == 0) { - tier = getIC2Tier(stack); - } - - ItemStack iStack = getItemStack(stack).copy(); - ElectricItem.manager.charge(iStack, amount, tier, true, false); - return getIItemStack(iStack); - } - - /** - * Discharges the item with the specified amount and returns the discharged item. - * - * @param stack target - * @param amount discharge amount - * @param tier charge tier - * @return discharged item - */ - @ZenMethod("ic2discharge") - public static IItemStack ic2Discharge(IItemStack stack, int amount, @Optional int tier) { - if (tier == 0) { - tier = getIC2Tier(stack); - } - - ItemStack iStack = getItemStack(stack).copy(); - ElectricItem.manager.discharge(iStack, amount, tier, true, false); - return getIItemStack(iStack); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Canner.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Canner.java deleted file mode 100644 index 6c698be..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Canner.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeInputFluidContainer; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.mods.ic2.IC2RecipeInput; -import net.minecraftforge.fluids.FluidStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.Canner") -@ModOnly("IC2") -public class Canner { - @ZenMethod - public static void addBottleRecipe(IItemStack output, IIngredient container, IIngredient fill) { - MineTweakerAPI.apply(new AddBottleIngredientAction(container, fill, output)); - } - - @ZenMethod - public static void addBottleRecipe(IItemStack output, IIngredient container, ILiquidStack liquid) { - MineTweakerAPI.apply(new AddBottleLiquidAction(container, liquid, output)); - } - - @ZenMethod - public static void addEnrichRecipe(ILiquidStack output, ILiquidStack input, IIngredient additive) { - MineTweakerAPI.apply(new AddEnrichIngredientAction(input, additive, output)); - } - - @ZenMethod - public static void addEnrichRecipe(ILiquidStack output, ILiquidStack input, ILiquidStack additive) { - MineTweakerAPI.apply(new AddEnrichLiquidAction(input, additive, output)); - } - - private static class AddBottleIngredientAction extends OneWayAction { - private final IIngredient container; - private final IIngredient fill; - private final IItemStack output; - - public AddBottleIngredientAction(IIngredient container, IIngredient fill, IItemStack output) { - this.container = container; - this.fill = fill; - this.output = output; - } - - @Override - public void apply() { - Recipes.cannerBottle.addRecipe( - new IC2RecipeInput(container), - new IC2RecipeInput(fill), - getItemStack(output)); - } - - @Override - public String describe() { - return "Adding canner bottle recipe " + container + " + " + fill + " => " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 67 * hash + (this.container != null ? this.container.hashCode() : 0); - hash = 67 * hash + (this.fill != null ? this.fill.hashCode() : 0); - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBottleIngredientAction other = (AddBottleIngredientAction) obj; - if (this.container != other.container && (this.container == null || !this.container.equals(other.container))) { - return false; - } - if (this.fill != other.fill && (this.fill == null || !this.fill.equals(other.fill))) { - return false; - } - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - return true; - } - } - - private static class AddBottleLiquidAction extends OneWayAction { - private final IIngredient container; - private final ILiquidStack fill; - private final IItemStack output; - - public AddBottleLiquidAction(IIngredient container, ILiquidStack fill, IItemStack output) { - this.container = container; - this.fill = fill; - this.output = output; - } - - @Override - public void apply() { - Recipes.cannerBottle.addRecipe( - new IC2RecipeInput(container), - new RecipeInputFluidContainer( - ((FluidStack) fill.getInternal()).getFluid(), - fill.getAmount()), - getItemStack(output)); - } - - @Override - public String describe() { - return "Adding cannor bottle recipe " + container + " + " + fill + " => " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddEnrichIngredientAction extends OneWayAction { - private final ILiquidStack input; - private final IIngredient additive; - private final ILiquidStack output; - - public AddEnrichIngredientAction(ILiquidStack input, IIngredient additive, ILiquidStack output) { - this.input = input; - this.additive = additive; - this.output = output; - } - - @Override - public void apply() { - Recipes.cannerEnrich.addRecipe((FluidStack) input.getInternal(), new IC2RecipeInput(additive), (FluidStack) output.getInternal()); - } - - @Override - public String describe() { - return "Adding canner enrich recipe " + input + " + " + additive + " => " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 47 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 47 * hash + (this.additive != null ? this.additive.hashCode() : 0); - hash = 47 * hash + (this.output != null ? this.output.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddEnrichIngredientAction other = (AddEnrichIngredientAction) obj; - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.additive != other.additive && (this.additive == null || !this.additive.equals(other.additive))) { - return false; - } - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - return true; - } - } - - private static class AddEnrichLiquidAction extends OneWayAction { - private final ILiquidStack input; - private final ILiquidStack additive; - private final ILiquidStack output; - - public AddEnrichLiquidAction(ILiquidStack input, ILiquidStack additive, ILiquidStack output) { - this.input = input; - this.additive = additive; - this.output = output; - } - - @Override - public void apply() { - Recipes.cannerEnrich.addRecipe( - (FluidStack) input.getInternal(), new RecipeInputFluidContainer( - ((FluidStack) additive.getInternal()).getFluid(), - additive.getAmount()), - (FluidStack) output.getInternal()); - } - - @Override - public String describe() { - return "Adding canner enrich recipe " + input + " + " + additive + " => " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 19 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 19 * hash + (this.additive != null ? this.additive.hashCode() : 0); - hash = 19 * hash + (this.output != null ? this.output.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddEnrichLiquidAction other = (AddEnrichLiquidAction) obj; - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.additive != other.additive && (this.additive == null || !this.additive.equals(other.additive))) { - return false; - } - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java deleted file mode 100644 index 24bd1a6..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Compressor.java +++ /dev/null @@ -1,69 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 compressor recipes. Recipes can be added but not - * removed, due to IC2 API restrictions. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.Compressor") -@ModOnly("IC2") -public class Compressor { - /** - * Adds a new recipe to the compressor. - * - * The recipe input can be any pattern, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - */ - @ZenMethod - public static void addRecipe( - @NotNull IItemStack output, - @NotNull IIngredient ingredient) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "compressor", - Recipes.compressor, - getItemStacks(output), - null, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack getOutput( - @NotNull IItemStack input) { - RecipeOutput output = Recipes.compressor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) { - System.out.println("No output"); - return null; - } - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java deleted file mode 100644 index f83590a..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Extractor.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 Extractor recipes. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.Extractor") -@ModOnly("IC2") -public class Extractor { - /** - * Adds a new recipe to the extractor. - * - * The recipe input can be any pattern, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - */ - @ZenMethod - public static void addRecipe( - @NotNull IItemStack output, - @NotNull IIngredient ingredient) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "extractor", - Recipes.extractor, - getItemStacks(output), - null, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack getOutput( - @NotNull IItemStack input) { - RecipeOutput output = Recipes.extractor.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java deleted file mode 100644 index d985d16..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Macerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 macerator recipes. Recipes can be added but not - * removed, due to IC2 API restrictions. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.Macerator") -@ModOnly("IC2") -public class Macerator { - /** - * Adds a new recipe to the macerator. - * - * The recipe input can be any pattern, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - */ - @ZenMethod - public static void addRecipe( - @NotNull IItemStack output, - @NotNull IIngredient ingredient) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "macerator", - Recipes.macerator, - getItemStacks(output), - null, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack getOutput( - @NotNull IItemStack input) { - RecipeOutput output = Recipes.macerator.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MatterAmplifier.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MatterAmplifier.java deleted file mode 100644 index 1a63967..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MatterAmplifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.MatterAmplifier") -@ModOnly("IC2") -public class MatterAmplifier { - private MatterAmplifier() {} - - @ZenMethod - public static void setAmplifier(IIngredient item, int amplifier) { - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("amplification", amplifier); - MineTweakerAPI.apply(new MachineAddRecipeAction("matter amplifier", Recipes.matterAmplifier, new ItemStack[0], data, new IC2RecipeInput(item))); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java deleted file mode 100644 index 774f081..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/MetalFormer.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.MetalFormer") -@ModOnly("IC2") -public class MetalFormer { - /** - * Adds an extruding recipe to the metal former. - * - * @param output output item - * @param input input item - */ - @ZenMethod - public static void addExtrudingRecipe(IItemStack output, IIngredient input) { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "metal former - extruding", - Recipes.metalformerExtruding, - getItemStacks(output), - null, - new IC2RecipeInput(input))); - } - - /** - * Gets the extruding output for the given input. - * - * @param input input item - * @return output item, or null - */ - @ZenMethod - public static IItemStack getExtrudingOutput(IItemStack input) { - RecipeOutput output = Recipes.metalformerExtruding.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } - - /** - * Adds a rolling recipe to the metal former. - * - * @param output output item - * @param input input item - */ - @ZenMethod - public static void addRollingRecipe(IItemStack output, IIngredient input) { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "metal former - rolling", - Recipes.metalformerRolling, - getItemStacks(output), - null, - new IC2RecipeInput(input))); - } - - /** - * Gets the extruding output for the given input. - * - * @param input input item - * @return output item, or null - */ - @ZenMethod - public static IItemStack getRollingOutput(IItemStack input) { - RecipeOutput output = Recipes.metalformerRolling.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } - /** - * Adds a extruding recipe to the metal former. - * - * @param output output item - * @param input input item - */ - @ZenMethod - public static void addCuttingRecipe(IItemStack output, IIngredient input) { - MineTweakerAPI.apply(new MachineAddRecipeAction( - "metal former - cutting", - Recipes.metalformerCutting, - getItemStacks(output), - null, - new IC2RecipeInput(input))); - } - - /** - * Gets the cutting output for the given input. - * - * @param input input item - * @return output item, or null - */ - @ZenMethod - public static IItemStack getCuttingOutput(IItemStack input) { - RecipeOutput output = Recipes.metalformerCutting.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStack(output.items.get(0)); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/OreWasher.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/OreWasher.java deleted file mode 100644 index a0af2f9..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/OreWasher.java +++ /dev/null @@ -1,43 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStacks; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import net.minecraft.nbt.NBTTagCompound; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.OreWasher") -@ModOnly("IC2") -public class OreWasher { - @ZenMethod - public static void addRecipe(IItemStack[] output, IIngredient input, int millibuckets) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("amount", millibuckets); - MineTweakerAPI.apply(new MachineAddRecipeAction( - "ore washer", - Recipes.oreWashing, - getItemStacks(output), - nbt, - new IC2RecipeInput(input))); - } - - @ZenMethod - public static IItemStack[] getOutput(IItemStack input) { - RecipeOutput output = Recipes.oreWashing.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStacks(output.items); - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Recycler.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Recycler.java deleted file mode 100644 index d7d1d29..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/Recycler.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import minetweaker.mods.ic2.IC2RecipeInput; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.Recycler") -@ModOnly("IC2") -public class Recycler { - @ZenMethod - public static void addBlacklist(IIngredient ingredient) { - MineTweakerAPI.apply(new AddBlacklistAction(ingredient)); - } - - @ZenMethod - public static boolean isBlacklisted(IItemStack item) { - return Recipes.recyclerBlacklist.contains(getItemStack(item)); - } - - private static class AddBlacklistAction extends OneWayAction { - private IIngredient ingredient; - - public AddBlacklistAction(IIngredient ingredient) { - this.ingredient = ingredient; - } - - @Override - public void apply() { - Recipes.recyclerBlacklist.add(new IC2RecipeInput(ingredient)); - } - - @Override - public String describe() { - return "Adding " + ingredient + " to the recycler blacklist"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 29 * hash + (this.ingredient != null ? this.ingredient.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddBlacklistAction other = (AddBlacklistAction) obj; - if (this.ingredient != other.ingredient && (this.ingredient == null || !this.ingredient.equals(other.ingredient))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ScrapBox.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ScrapBox.java deleted file mode 100644 index 943ff5c..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ScrapBox.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.WeightedItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.ScrapBox") -@ModOnly("IC2") -public class ScrapBox { - /** - * Adds an item drop. - * - * Reference scrap box chance values: - * - * 0.1: Diamond - * 0.5: Cake, Gold Helmet, Iron Ore, Gold Ore - * 1.0: Wooden tools, Soul Sand, Sign, Leather, Feather, Bone - * 1.5: Apple, Bread - * 2.0: Netherrack, Rotten Flesh - * 3.0: Grass, Gravel - * 4.0: Stick - * 5.0: Dirt, Wooden Hoe - * - * @param stack weighted item stack to add - */ - @ZenMethod - public static void addDrop(WeightedItemStack stack) { - MineTweakerAPI.apply(new AddDropAction(stack)); - } - - private static class AddDropAction extends OneWayAction { - private final WeightedItemStack stack; - - public AddDropAction(WeightedItemStack stack) { - this.stack = stack; - } - - @Override - public void apply() { - Recipes.scrapboxDrops.addDrop(getItemStack(stack.getStack()), stack.getChance()); - } - - @Override - public String describe() { - return "Adding scrapbox drop " + stack.getStack(); - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 71 * hash + (this.stack != null ? this.stack.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddDropAction other = (AddDropAction) obj; - if (this.stack != other.stack && (this.stack == null || !this.stack.equals(other.stack))) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java deleted file mode 100644 index c1bfe9f..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/SemiFluidGenerator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.liquid.ILiquidStack; -import net.minecraftforge.fluids.FluidRegistry; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * - * @author Stan - */ -@ZenClass("mods.ic2.SemiFluidGenerator") -@ModOnly("IC2") -public class SemiFluidGenerator { - @ZenMethod - public static void addFluid(ILiquidStack liquidPerTick, int energyPerTick) { - MineTweakerAPI.apply(new AddFluidAction(liquidPerTick.getName(), liquidPerTick.getAmount(), energyPerTick)); - } - - @ZenMethod - public static boolean accepts(ILiquidStack liquid) { - return Recipes.semiFluidGenerator.acceptsFluid(FluidRegistry.getFluid(liquid.getName())); - } - - private static class AddFluidAction extends OneWayAction { - private final String name; - private final int liquidPerTick; - private final int energyPerTick; - - public AddFluidAction(String name, int liquidPerTick, int energyPerTick) { - this.name = name; - this.liquidPerTick = liquidPerTick; - this.energyPerTick = energyPerTick; - } - - @Override - public void apply() { - Recipes.semiFluidGenerator.addFluid(name, liquidPerTick, energyPerTick); - } - - @Override - public String describe() { - return "Adding liquid " + name + " as semifluid fuel"; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0); - hash = 47 * hash + this.liquidPerTick; - hash = 47 * hash + this.energyPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidAction other = (AddFluidAction) obj; - if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { - return false; - } - if (this.liquidPerTick != other.liquidPerTick) { - return false; - } - if (this.energyPerTick != other.energyPerTick) { - return false; - } - return true; - } - } -} diff --git a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ThermalCentrifuge.java b/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ThermalCentrifuge.java deleted file mode 100644 index 9d7accf..0000000 --- a/MineTweaker3-MC172-Mod-IC2/src/main/java/minetweaker/mods/ic2/machines/ThermalCentrifuge.java +++ /dev/null @@ -1,81 +0,0 @@ -package minetweaker.mods.ic2.machines; - -import ic2.api.recipe.RecipeOutput; -import ic2.api.recipe.Recipes; -import minetweaker.MineTweakerAPI; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getIItemStacks; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; -import net.minecraft.nbt.NBTTagCompound; -import minetweaker.mods.ic2.IC2RecipeInput; -import minetweaker.mods.ic2.MachineAddRecipeAction; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -/** - * Provides access to the IC2 compressor recipes. Recipes can be added but not - * removed, due to IC2 API restrictions. - * - * @author Stan Hebben - */ -@ZenClass("mods.ic2.ThermalCentrifuge") -@ModOnly("IC2") -public class ThermalCentrifuge { - /** - * Adds a new recipe to the centrifuge. - * - * The recipe input can be any ingredient, as long as the stack size is determined. - * The output is an array of item stacks. - * - * @param output recipe outputs - * @param ingredient recipe input - * @param minHeat minimum centrifuge heat level - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IIngredient ingredient, int minHeat) { - if (ingredient.getAmount() < 0) { - MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known"); - } else { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("minHeat", minHeat); - MineTweakerAPI.apply(new MachineAddRecipeAction( - "thermal centrifuge", - Recipes.centrifuge, - getItemStacks(output), - tag, - new IC2RecipeInput(ingredient))); - } - } - - /** - * Adds a new recipe to the centrifuge. - * - * The recipe input can be any ingredient, as long as the stack size is determined. - * The output can be any item stack. - * - * @param output recipe output - * @param ingredient recipe input - * @param minHeat minimum centrifuge heat level - */ - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient ingredient, int minHeat) { - addRecipe(new IItemStack[] { output }, ingredient, minHeat); - } - - /** - * Determines the recipe output for the given input. Will return the output - * of a single item, even if the stack contains multiple items. - * - * @param input recipe input - * @return recipe output - */ - @ZenMethod - public static IItemStack[] getOutput(IItemStack input) { - RecipeOutput output = Recipes.centrifuge.getOutputFor(getItemStack(input), false); - if (output == null || output.items.isEmpty()) return null; - return getIItemStacks(output.items); - } -} diff --git a/MineTweaker3-MC172-Mod-NEI/build.gradle b/MineTweaker3-MC172-Mod-NEI/build.gradle deleted file mode 100644 index b5ef46a..0000000 --- a/MineTweaker3-MC172-Mod-NEI/build.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import minetweaker.tasks.RegisterZenClassesTask; - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - -apply plugin: 'forge' - -minecraft { - version = forgeVersion172 -} - -version = "1.0" -archivesBaseName = project.projectDir.name - -dependencies { - compile project(':ZenScript') - compile project(':MineTweaker3-API') - compile project(':MineTweaker3-MC172-Main') - compile files('libs/NotEnoughItems-1.7.2-1.0.1-dev.jar') -} - -task makeRegistry(type: RegisterZenClassesTask) { - inputDir = file('build/classes/main') - outputDir = file('build/classes/main') - className = 'minetweaker.mods.nei.ClassRegistry' -} - -tasks.jar.dependsOn(makeRegistry) diff --git a/MineTweaker3-MC172-Mod-NEI/libs/NotEnoughItems-1.7.2-1.0.1-dev.jar b/MineTweaker3-MC172-Mod-NEI/libs/NotEnoughItems-1.7.2-1.0.1-dev.jar deleted file mode 100644 index 1e55129..0000000 Binary files a/MineTweaker3-MC172-Mod-NEI/libs/NotEnoughItems-1.7.2-1.0.1-dev.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-NEI/libs/NotEnoughItems-1.7.2-1.0.1-src.jar b/MineTweaker3-MC172-Mod-NEI/libs/NotEnoughItems-1.7.2-1.0.1-src.jar deleted file mode 100644 index 2e79644..0000000 Binary files a/MineTweaker3-MC172-Mod-NEI/libs/NotEnoughItems-1.7.2-1.0.1-src.jar and /dev/null differ diff --git a/MineTweaker3-MC172-Mod-NEI/src/main/java/minetweaker/mods/nei/NEI.java b/MineTweaker3-MC172-Mod-NEI/src/main/java/minetweaker/mods/nei/NEI.java deleted file mode 100644 index ed53bca..0000000 --- a/MineTweaker3-MC172-Mod-NEI/src/main/java/minetweaker/mods/nei/NEI.java +++ /dev/null @@ -1,165 +0,0 @@ -package minetweaker.mods.nei; - -import codechicken.nei.api.API; -import stanhebben.zenscript.annotations.NotNull; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; -import minetweaker.IUndoableAction; -import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; -import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; -import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; -import net.minecraft.item.ItemStack; - -/** - * MineTweaker NEI support. - * - * Enables hiding NEI items as well as adding new item stacks. These item stacks - * can then show a custom message or contain NBT data. Can be used to show - * a custom message or lore with certain items, or to provide spawnable items - * with specific NBT tags. - * - * @author Stan Hebben - */ -@ZenClass("mods.nei.NEI") -@ModOnly("NotEnoughItems") -public class NEI { - /** - * Hides a specific item in NEI. Will take into account metadata values, if - * any. - * - * @param item item to be hidden - */ - @ZenMethod - public static void hide(@NotNull IItemStack item) { - MineTweakerAPI.apply(new NEIHideItemAction(getItemStack(item))); - } - - /** - * Adds a NEI entry. The item stack can contain damage values and NBT tags. - * - * @param stack item stack to be added - */ - @ZenMethod - public static void addEntry(@NotNull IItemStack stack) { - MineTweakerAPI.apply(new NEIAddEntryAction(getItemStack(stack))); - } - - /** - * Overrides a name in NEI. Note that this will not change the original - * display name, but it will change the way it is displayed in NEI. - * - * @param item item - * @param name item name - */ - @ZenMethod - public static void overrideName(@NotNull IItemStack item, @NotNull String name) { - MineTweakerAPI.apply(new NEIOverrideNameAction(getItemStack(item), name)); - } - - // ############################# - // ### Private inner classes ### - // ############################# - - private static class NEIAddEntryAction implements IUndoableAction { - private final ItemStack item; - - public NEIAddEntryAction(ItemStack item) { - this.item = item; - } - - @Override - public void apply() { - API.addItemListEntry(item); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - API.hideItem(item); - } - - @Override - public String describe() { - return "Adding " + item.getDisplayName() + " as NEI entry"; - } - - @Override - public String describeUndo() { - return "Removing " + item.getDisplayName() + " as NEI entry"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class NEIHideItemAction implements IUndoableAction { - private final ItemStack stack; - - public NEIHideItemAction(ItemStack stack) { - this.stack = stack; - } - - @Override - public void apply() { - API.hideItem(stack); - } - - @Override - public boolean canUndo() { - return true; - } - - @Override - public void undo() { - API.addItemListEntry(stack); - } - - @Override - public String describe() { - return "Hiding " + stack.getUnlocalizedName() + " in NEI"; - } - - @Override - public String describeUndo() { - return "Displaying " + stack.getUnlocalizedName() + " in NEI"; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class NEIOverrideNameAction extends OneWayAction { - private final ItemStack item; - private final String name; - - public NEIOverrideNameAction(ItemStack item, String name) { - this.item = item; - this.name = name; - } - - @Override - public void apply() { - API.setOverrideName(item, name); - } - - @Override - public String describe() { - return "Overriding NEI item name of " + item.getUnlocalizedName() + " to " + name; - } - - @Override - public Object getOverrideKey() { - return item; - } - } -} diff --git a/MineTweaker3-MC18-Main/build.gradle b/MineTweaker3-MC18-Main/build.gradle index df1cb15..9e271c0 100644 --- a/MineTweaker3-MC18-Main/build.gradle +++ b/MineTweaker3-MC18-Main/build.gradle @@ -1,32 +1,30 @@ -/* -// For those who want the bleeding edge +import minetweaker.tasks.RegisterZenClassesTask; + buildscript { repositories { - jcenter() + mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } -apply plugin: 'net.minecraftforge.gradle.forge' -*/ -// for people who want stable -plugins { - id "net.minecraftforge.gradle.forge" version "2.0.1" -} +apply plugin: 'forge' -version = "1.0" -group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "modid" +version = "1.8-" + ext.mineTweakerVersion +archivesBaseName = project.projectDir.name minecraft { - version = "1.8-11.14.3.1506" - runDir = "run" + version = forgeVersion18 + runDir = "eclipse" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. @@ -34,33 +32,21 @@ minecraft { // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_20141130" - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } dependencies { - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" - - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, - // except that these dependencies get remapped to your current MCP mappings - //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' - //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // for more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html - + compile project(':ZenScript') + compile project(':MineTweaker3-API') } +task makeRegistry(type: RegisterZenClassesTask) { + inputDir = file('build/classes/main') + outputDir = file('build/classes/main') + className = 'minetweaker.mc18.MineTweakerRegistry' +} + +tasks.jar.dependsOn(makeRegistry) + processResources { // this will ensure that this task is redone when the versions change. diff --git a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/ForgeEventHandler.java b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/ForgeEventHandler.java index 11874be..8b37cd8 100644 --- a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/ForgeEventHandler.java +++ b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/ForgeEventHandler.java @@ -28,8 +28,9 @@ public class ForgeEventHandler { minetweaker.api.event.PlayerInteractEvent event = new minetweaker.api.event.PlayerInteractEvent( MineTweakerMC.getIPlayer(ev.entityPlayer), MineTweakerMC.getDimension(ev.world), - ev.pos.getX(), ev.pos.getY(), ev.pos.getZ() - ); + ev.pos == null ? 0 : ev.pos.getX(), + ev.pos == null ? 0 : ev.pos.getY(), + ev.pos == null ? 0 : ev.pos.getZ()); MineTweakerImplementationAPI.events.publishPlayerInteract(event); } diff --git a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MCPlatformFunctions.java b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MCPlatformFunctions.java index ff857c4..46c953b 100644 --- a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MCPlatformFunctions.java +++ b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MCPlatformFunctions.java @@ -10,6 +10,7 @@ import static minetweaker.mc18.MineTweakerMod.NETWORK; import minetweaker.IPlatformFunctions; import minetweaker.api.chat.IChatMessage; import minetweaker.api.item.IItemDefinition; +import minetweaker.mc18.brackets.ItemBracketHandler; import minetweaker.mc18.chat.MCChatMessage; import minetweaker.mc18.item.MCItemDefinition; import minetweaker.mc18.network.MineTweakerLoadScriptsPacket; @@ -40,7 +41,7 @@ public class MCPlatformFunctions implements IPlatformFunctions { Item item = Item.getItemById(id); if (item == null) return null; - String sid = (String) Item.itemRegistry.getNameForObject(item); + String sid = ItemBracketHandler.getStringFromItem(item); return new MCItemDefinition(sid, item); } } diff --git a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MineTweakerMod.java b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MineTweakerMod.java index f2e20e3..2cbb73b 100644 --- a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MineTweakerMod.java +++ b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/MineTweakerMod.java @@ -153,6 +153,7 @@ public class MineTweakerMod { public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { // starts before loading worlds // perfect place to start MineTweaker! + ItemBracketHandler.rebuildItemRegistry(); if (MineTweakerPlatformUtils.isClient()) { MineTweakerAPI.client = new MCClient(); diff --git a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/brackets/ItemBracketHandler.java b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/brackets/ItemBracketHandler.java index 6e4b031..39b5f8f 100644 --- a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/brackets/ItemBracketHandler.java +++ b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/brackets/ItemBracketHandler.java @@ -8,9 +8,7 @@ package minetweaker.mc18.brackets; import static minetweaker.api.minecraft.MineTweakerMC.getIItemStackWildcardSize; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Set; import minetweaker.IBracketHandler; @@ -19,6 +17,8 @@ import minetweaker.annotations.BracketHandler; import minetweaker.api.item.IItemStack; import minetweaker.api.item.IngredientAny; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; import stanhebben.zenscript.ZenTokener; import stanhebben.zenscript.compiler.IEnvironmentGlobal; @@ -32,23 +32,31 @@ import stanhebben.zenscript.type.ZenType; import stanhebben.zenscript.type.natives.IJavaMethod; import stanhebben.zenscript.util.ZenPosition; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + /** * * @author Stan */ @BracketHandler(priority = 100) public class ItemBracketHandler implements IBracketHandler { - private static final Map itemNames; - - static { - itemNames = new HashMap(); - for (String itemName : (Set) Item.itemRegistry.getKeys()) { + private static final BiMap itemNames = HashBiMap.create(); + + @SuppressWarnings("unchecked") + public static void rebuildItemRegistry() { + itemNames.clear(); + for (ResourceLocation itemRes : (Set) Item.itemRegistry.getKeys()) { + String itemName = itemRes.getResourceDomain() + ":" + itemRes.getResourcePath(); itemNames.put(itemName.replace(" ", ""), (Item) Item.itemRegistry.getObject(itemName)); System.out.println(itemName + " : " + (Item) Item.itemRegistry.getObject(itemName)); - } } + public static String getStringFromItem(Item item) { + return itemNames.inverse().get(item); + } + public static IItemStack getItem(String name, int meta) { // Item item = (Item) Item.itemRegistry.getObject(name); Item item = itemNames.get(name); @@ -76,7 +84,7 @@ public class ItemBracketHandler implements IBracketHandler { if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) { return symbolAny; } - + // detect special cases: // item: at the start means item-specific syntax // :xxx with xxx an integer means sub-item syntax diff --git a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/game/MCGame.java b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/game/MCGame.java index ae134fa..992f8aa 100644 --- a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/game/MCGame.java +++ b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/game/MCGame.java @@ -30,6 +30,7 @@ import minetweaker.mc18.util.MineTweakerPlatformUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -52,8 +53,9 @@ public class MCGame implements IGame { @Override public List getItems() { List result = new ArrayList(); - for (String item : (Set) Item.itemRegistry.getKeys()) { - result.add(new MCItemDefinition(item, (Item) Item.itemRegistry.getObject(item))); + for (ResourceLocation res: (Set) Item.itemRegistry.getKeys()) { + + result.add(new MCItemDefinition(res.getResourceDomain() + ":" + res.getResourcePath(), (Item) Item.itemRegistry.getObject(res))); } return result; } diff --git a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/item/MCItemStack.java b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/item/MCItemStack.java index 69d337b..7a9021a 100644 --- a/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/item/MCItemStack.java +++ b/MineTweaker3-MC18-Main/src/main/java/minetweaker/mc18/item/MCItemStack.java @@ -31,6 +31,7 @@ import minetweaker.mc18.actions.SetBlockHardnessAction; import minetweaker.mc18.actions.SetStackSizeAction; import minetweaker.mc18.actions.SetTranslationAction; import minetweaker.mc18.block.MCItemBlock; +import minetweaker.mc18.brackets.ItemBracketHandler; import minetweaker.mc18.data.NBTConverter; import minetweaker.mc18.liquid.MCLiquidStack; import minetweaker.util.ArrayUtil; @@ -85,7 +86,7 @@ public class MCItemStack implements IItemStack { @Override public IItemDefinition getDefinition() { - return new MCItemDefinition((String) Item.itemRegistry.getNameForObject(stack.getItem()), stack.getItem()); + return new MCItemDefinition(ItemBracketHandler.getStringFromItem(stack.getItem()), stack.getItem()); } @Override @@ -370,7 +371,7 @@ public class MCItemStack implements IItemStack { public String toString() { StringBuilder result = new StringBuilder(); result.append('<'); - result.append(Item.itemRegistry.getNameForObject(stack.getItem())); + result.append(ItemBracketHandler.getStringFromItem(stack.getItem())); if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { result.append(":*"); diff --git a/MineTweaker3-Web/index.html b/MineTweaker3-Web/index.html index 702deb1..f3f4ddc 100644 --- a/MineTweaker3-Web/index.html +++ b/MineTweaker3-Web/index.html @@ -90,20 +90,24 @@
-
-

Wiki

-

Follow the instructions and tutorials here.

-

Wiki »

-

Downloads

Installation: it's a forge mod. Make sure you have Forge installed and put it in your mods folder. No configuration needed, just follow the wiki tutorials to start scripting!

-

3.0.9C for Minecraft 1.6.4

-

3.0.9C for Minecraft 1.7.2

-

3.0.9C for Minecraft 1.7.10

+

3.0.10 for Minecraft 1.7.10

Other downloads | Changelog

+

Mod integration

+

Make your MineTweaker setup much more potent by using these MineTweaker addons!

+

ModTweaker

+

GregTech: GregTech Addon

+

BuildCraft: Buildcraft Compat

+
+
+

Wiki

+

Follow the instructions and tutorials here.

+

Wiki »

+

Forums

Have questions? Having difficulties with the scripts? Want to discuss how you're using MineTweaker? We have a forum now!

No registration required, just start posting!

diff --git a/build.gradle b/build.gradle index fdea957..e0a5c33 100644 --- a/build.gradle +++ b/build.gradle @@ -8,19 +8,12 @@ subprojects { } task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') { - gradleVersion = '1.11' + gradleVersion = '2.6' } subprojects.each { subproject -> evaluationDependsOn( subproject.path ) } -task setupDecompWorkspaceAll(dependsOn: - projects164.collect { ':' + it + ":setupDecompWorkspace" } - + projects172.collect { ':' + it + ":setupDecompWorkspace" } - + projects1710.collect { ':' + it + ":setupDecompWorkspace" }) {} - -task setupDecompWorkspace17X(dependsOn: - projects172.collect { ':' + it + ":setupDecompWorkspace" } - + projects1710.collect { ':' + it + ":setupDecompWorkspace" }) {} +task setupDecompWorkspaceAll(dependsOn: projects1710.collect { ':' + it + ":setupDecompWorkspace" } + projects18.collect { ':' + it + ':setupDecompWorkspace'}) {} task assembleMC1710(type: Jar, dependsOn: [\ ':ZenScript:build', @@ -36,30 +29,16 @@ task assembleMC1710(type: Jar, dependsOn: [\ } } -task assembleMC172(type: Jar, dependsOn: [\ +task assembleMC18(type: Jar, dependsOn: [\ ':ZenScript:build', ':MineTweaker3-API:build'] - + projects172.collect { ':' + it + ":build" }) { - archiveName="MineTweaker3-1.7.2-${mineTweakerVersion}.jar" + + projects18.collect { ':' + it + ":build" }) { + archiveName="MineTweaker3-1.8-${mineTweakerVersion}.jar" from zipTree(project(":ZenScript").jar.archivePath) from zipTree(project(':MineTweaker3-API').jar.archivePath) - for (p in projects172) { - from zipTree(project(p).jar.archivePath) - } -} - -task assembleMC164(type: Jar, dependsOn: [\ - ':ZenScript:build', - ':MineTweaker3-API:build'] - + projects164.collect { ':' + it + ":build" }) { - archiveName="MineTweaker3-1.6.4-${mineTweakerVersion}.jar" - - from zipTree(project(":ZenScript").jar.archivePath) - from zipTree(project(':MineTweaker3-API').jar.archivePath) - - for (p in projects164) { + for (p in projects18) { from zipTree(project(p).jar.archivePath) } } @@ -75,26 +54,15 @@ task assembleDevBase1710(type: Jar, dependsOn: [ from project(':MineTweaker3-MC1710-Main').sourceSets.main.output } -task assembleDevBase172(type: Jar, dependsOn: [ +task assembleDevBase18(type: Jar, dependsOn: [ ':ZenScript:build', ':MineTweaker3-API:build', - ':MineTweaker3-MC172-Main:build']) { - archiveName="MineTweaker3-Dev-1.7.2-${mineTweakerVersion}.jar" + ':MineTweaker3-MC18-Main:build']) { + archiveName="MineTweaker3-Dev-1.8-${mineTweakerVersion}.jar" from project(':ZenScript').sourceSets.main.output from project(':MineTweaker3-API').sourceSets.main.output - from project(':MineTweaker3-MC172-Main').sourceSets.main.output -} - -task assembleDevBase164(type: Jar, dependsOn: [ - ':ZenScript:build', - ':MineTweaker3-API:build', - ':MineTweaker3-MC164-Main:build']) { - archiveName="MineTweaker3-Dev-1.6.4-${mineTweakerVersion}.jar" - - from project(':ZenScript').sourceSets.main.output - from project(':MineTweaker3-API').sourceSets.main.output - from project(':MineTweaker3-MC164-Main').sourceSets.main.output + from project(':MineTweaker3-MC18-Main').sourceSets.main.output } task assembleDevFull1710(type: Jar, dependsOn: [ @@ -111,67 +79,51 @@ task assembleDevFull1710(type: Jar, dependsOn: [ } } -task assembleDevFull172(type: Jar, dependsOn: [ +task assembleDevFull18(type: Jar, dependsOn: [ ':ZenScript:build', ':MineTweaker3-API:build'] - + projects172.collect { ':' + it + ":build" }) { - archiveName="MineTweaker3-Dev-Full-1.7.2-${mineTweakerVersion}.jar" + + projects18.collect { ':' + it + ":build" }) { + archiveName="MineTweaker3-Dev-Full-1.8-${mineTweakerVersion}.jar" from project(':ZenScript').sourceSets.main.output from project(':MineTweaker3-API').sourceSets.main.output - for (p in projects172) { - from project(p).sourceSets.main.output - } -} - -task assembleDevFull164(type: Jar, dependsOn: [ - ':ZenScript:build', - ':MineTweaker3-API:build'] - + projects164.collect { ':' + it + ":build" }) { - archiveName="MineTweaker3-Dev-Full-1.6.4-${mineTweakerVersion}.jar" - - from project(':ZenScript').sourceSets.main.output - from project(':MineTweaker3-API').sourceSets.main.output - - for (p in projects164) { + for (p in projects18) { from project(p).sourceSets.main.output } } task assembleAll(dependsOn: [ - assembleMC164, - assembleMC172, assembleMC1710, - assembleDevBase164, - assembleDevBase172, + assembleMC18, assembleDevBase1710, - assembleDevFull164, - assembleDevFull172, - assembleDevFull1710]) { + assembleDevBase18, + assembleDevFull1710, + assembleDevFull18]) { + } -task zendoc164(type: Javadoc) { +task zendoc1710(type: Javadoc) { source = files([ 'MineTweaker3-API/src/main/java', - 'MineTweaker3-MC164-Main/src/main/java'] - + projects164.collect { it + '/src/main/java' }) + 'MineTweaker3-MC1710-Main/src/main/java'] + + projects1710.collect { it + '/src/main/java' }) - destinationDir = file("build/zendoc164") + destinationDir = file("build/zendoc1710") options.docletpath = [file('buildSrc/build/libs/buildSrc.jar')].asList() options.doclet = 'stanhebben.zenscript.docs.ZenScriptDoclet' def classpathList = [ project(":ZenScript").jar.archivePath, - project(':MineTweaker3-MC164-Main').jar.archivePath + project(':MineTweaker3-MC1710-Main').jar.archivePath ] - for (p in projects164) { + for (p in projects1710) { for (file in project(':' + p).configurations.compile) { classpathList += file } } options.classpath = classpathList.asList() - options.addStringOption("baseurl", "/doc/mc164/") + options.addStringOption("baseurl", "/doc/mc1710/") } diff --git a/configuration.gradle b/configuration.gradle index d682dff..4dc5838 100644 --- a/configuration.gradle +++ b/configuration.gradle @@ -1,37 +1,12 @@ +import javax.tools.ToolProvider + // ####################### // ### Global settings ### // ####################### -ext.mineTweakerVersion = "3.0.9D_alpha" +ext.mineTweakerVersion = "3.0.10" ext.mineTweakerDebug = "false" -ext.javaToolsJar = new File("C:/Program Files/Java/jdk1.8.0_45/lib/tools.jar") - -// ###################### -// ### 1.6.4 settings ### -// ###################### - -ext.forgeVersion164 = "1.6.4-9.11.1.964" -ext.projects164 = [ - 'MineTweaker3-MC164-Main', - 'MineTweaker3-MC164-Mod-IC2', - 'MineTweaker3-MC164-Mod-NEI', - 'MineTweaker3-MC164-Mod-MFR', - 'MineTweaker3-MC164-Mod-GregTech', - 'MineTweaker3-MC164-Mod-Buildcraft' -] - -// ###################### -// ### 1.7.2 settings ### -// ###################### - -ext.forgeVersion172 = "1.7.2-10.12.2.1121" -ext.projects172 = [ - 'MineTweaker3-MC172-Main', - 'MineTweaker3-MC172-Mod-IC2', - 'MineTweaker3-MC172-Mod-NEI', - 'MineTweaker3-MC172-Mod-GregTech', - 'MineTweaker3-MC172-Mod-Buildcraft' -] +ext.javaToolsJar = ((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs() // ####################### // ### 1.7.10 settings ### @@ -43,7 +18,14 @@ ext.projects1710 = [ 'MineTweaker3-MC1710-Mod-IC2', 'MineTweaker3-MC1710-Mod-NEI', 'MineTweaker3-MC1710-Mod-MFR', - 'MineTweaker3-MC1710-Mod-GregTech', 'MineTweaker3-MC1710-Mod-Buildcraft' - //'MineTweaker3-MC1710-Mod-Buildcraft61' +] + +// #################### +// ### 1.8 settings ### +// #################### + +ext.forgeVersion18 = "1.8-11.14.3.1450" +ext.projects18 = [ + 'MineTweaker3-MC18-Main' ] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..fd7e590 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MineTweaker3-MC164-Main/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 52% rename from MineTweaker3-MC164-Main/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties index d9425c6..7b67cf9 100644 --- a/MineTweaker3-MC164-Main/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Oct 29 18:00:54 CDT 2013 +#Sat Sep 05 17:00:16 CEST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/readme.md b/readme.md index 1781511..4ace9a8 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,8 @@ The MineTweaker 3 source is setup as a multi-project Gradle project: ### Developing and running MineTweaker from source -Configuration settings are stored in configuration.gradle . *Make sure to configure the tools.jar directory in that file! Nothing will compile without it.* +Configuration settings are stored in configuration.gradle . *If buildSrc fails to compile you might have to edit the ++`javaToolsJar` location in `configuration.gradle`* In order to use the project, you have to execute the setupDecompWorkspaceAll (or use setupDecomWorkspace17X if you have errors on the 1.6.4 forge patches). It will prepare all the subprojects for you. After that, you can simply run minecraft with the runClient task in MineTweaker3-XYZ-Main project, which will run MineTweaker (without mod support). Likewise, you can use the runClient task on any of its mod support library subprojects, which will run MineTweaker with only the mod support for that specific mod.