From 76719d65a90d98e228a914774d3b11ed9f01ac8e Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Mon, 4 Sep 2023 03:05:22 +0100 Subject: Clean-up v2 (#729) * Remove test items from NEI with no texture * Add number formatting to hand pumps * Remove heavy plates (no recipes & completely unused). * Remove helium generator (no texture, no recipe) * Remove fire pit and fire starter (no use, no recipe, no textures) * Remove giant chicken and associated unused stuff, has no texture and is unobtainable. Used to be relevant but isn't anymore. * Remove villagers with silly trades like 1 motor + 1 hull = 1 hull. Why? * Remove trade bench, no recipe, missing textures. Unused. * Remove farm processors, no texture, no recipe. Unused. * Remove MAX tier components, these exist in GT now, have no recipe here and are unused. * Hide untextured light block from NEI * Update buildscript * Remove unused backpacks, no recipe and contains dupe bugs. Bad. * Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. * Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. part 2 * Remove dragon catcher (what?), no texture, no recipe, unused. * Remove empty item, does nothing, has no recipe, no idea why it is here. * Empty item v2 removal * Revert "Empty item v2 removal" This reverts commit 75bcd3ccfaf55bbfe2c12b2e4167d5c37636030d. * Revert "Remove empty item, does nothing, has no recipe, no idea why it is here." This reverts commit e41a9f484392776331c58530ab1faa5ef978ef36. * Remove debug square. No recipe, unused. * Number formatting overflow covers * Remove JVM garbage collection block. Unused, no recipe. * Remove nanotubes, no recipe for them. Unused. * Remove "git" item, doesn't seem to work. Has no recipe. * Remove uncraftable food with awful textures. * Remove "bat king" mob, unused content. Does not spawn. * Remove uncraftable doors with bad textures. Unused content. * Remove uncraftable, unlocalised redstone stuff that crashes game when placed. * Remove weird spawner item. No recipe, does not exist in world. * Remove sunnarium bit, no recipe, no usage. * Remove unused modularity table and some misc uncraftable, unused items. * Remove Interconnecting Storage Crate, no recipe, unused. * Delete worse debug power gen, this already exists as part of GT. Unneeded duplication. * Delete unused placeholder circuit * Delete uncraftable generator hatches. * Spotless * Remove XP tank thing, unused and uncraftable. * Remove null item, this fluid registry only seemed to register one null fluid. All others exist? * Remove EU -> RF battery. Unused in GTNH. * Remove some shelf nonsense, why is this in this mod? * Remove some weird random tools. These have no realistic usage in GTNH. * Remove firemaker. Useless in GTNH. * Removed helium blob. Deprecated item, not used anymore, uncraftable. * spotlessApply (#730) Co-authored-by: GitHub GTNH Actions <> * Stop modulators generating unused blocks with no textures * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove some weird methods and uncraftable mining parts, probably part of deprecated multiblock. * spotlessApply (#732) Co-authored-by: GitHub GTNH Actions <> * Remove gem shards, unused. * Remove unused atoms * Remove unused gum * Remove unused elements/materials * Bye bye * Remove some unused reflection stuff * Remove control cores, obsolete now. * Remove mob killing thing with no texture and no recipe. * Remove uncraftable covers * Remove pizza gloves * Net and rope removal, unused * Remove force crop * Removal of some old event stuff * Remove unused nuclear chem items * Remove player safe, mostly because of the horrible event code that was intercepting every block break. I can't see any real usage of this via discord. * Remove Force material and associated other nonsense. Also remove some nuclear chem stuff. * Remove force for realsies * Skookum Chooker purge. * Remove some enderio compat, these plates/dusts are added via GT5 anyway now. This is obsolete. * spotlessApply (#733) Co-authored-by: GitHub GTNH Actions <> * Unused textures * Bump dep * Revert "Remove force for realsies" This reverts commit 0d288912a99f9dabce56d2a2623d4d3510f4804e. * Revert "Remove Force material and associated other nonsense. Also remove some nuclear chem stuff." This reverts commit 3455e6e916defe1f2aef923be6f9696a6cf3095b. * Remove nuclear items that are unused * spotlessApply (#734) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Connor Colenso Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../gtPlusPlus/plugin/agrichem/Core_Agrichem.java | 4 - .../plugin/agrichem/fluids/FluidLoader.java | 19 -- .../plugin/villagers/Core_VillagerAdditions.java | 113 ---------- .../plugin/villagers/VillagerObject.java | 41 ---- .../gtPlusPlus/plugin/villagers/VillagerUtils.java | 19 -- .../villagers/block/BlockGenericSpawner.java | 58 ----- .../villagers/tile/MobSpawnerCustomLogic.java | 68 ------ .../villagers/tile/TileEntityGenericSpawner.java | 233 --------------------- .../plugin/villagers/trade/TradeHandlerBanker.java | 25 --- .../plugin/villagers/trade/TradeHandlerBase.java | 24 --- .../villagers/trade/TradeHandlerTechnician.java | 25 --- .../plugin/villagers/trade/TradeHandlerTrader.java | 52 ----- 12 files changed, 681 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/VillagerObject.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/VillagerUtils.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/block/BlockGenericSpawner.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java delete mode 100644 src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java (limited to 'src/main/java/gtPlusPlus/plugin') diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java index 42f3587b0d..0c3d7d2867 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java @@ -2,7 +2,6 @@ package gtPlusPlus.plugin.agrichem; import gtPlusPlus.api.interfaces.IPlugin; import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; -import gtPlusPlus.plugin.agrichem.fluids.FluidLoader; import gtPlusPlus.plugin.manager.Core_Manager; // Called by Core_Manager#veryEarlyInit @@ -19,10 +18,7 @@ public class Core_Agrichem implements IPlugin { @Override public boolean preInit() { - mInstance.log("Generating Fluids"); - FluidLoader.generate(); AgrichemFluids.init(); - mInstance.log("Generating Items"); return true; } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java b/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java deleted file mode 100644 index f8982ffbad..0000000000 --- a/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java +++ /dev/null @@ -1,19 +0,0 @@ -package gtPlusPlus.plugin.agrichem.fluids; - -import gtPlusPlus.core.fluids.FluidFactory; - -public class FluidLoader { - - private static final int ID_DIRTY_WATER = 50; - private static final int ID_RAW_SEWERAGE = 51; - private static final int ID_GUANO = 52; - private static final int ID_POOPJUICE = 53; - - public static void generate() { - - FluidFactory.generate(ID_DIRTY_WATER, "dirtywater", new short[] { 25, 25, 180 }); - FluidFactory.generate(ID_RAW_SEWERAGE, "sewerage", new short[] { 100, 45, 25 }); - FluidFactory.generate(ID_GUANO, "guano", new short[] { 175, 175, 180 }); - FluidFactory.generate(ID_POOPJUICE, "poo", new short[] { 75, 45, 10 }); - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java b/src/main/java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java deleted file mode 100644 index 1ea7bc02ba..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java +++ /dev/null @@ -1,113 +0,0 @@ -package gtPlusPlus.plugin.villagers; - -import static gtPlusPlus.plugin.villagers.VillagerUtils.mVillagerMap; - -import java.util.HashMap; - -import net.minecraft.util.ResourceLocation; - -import cpw.mods.fml.common.registry.VillagerRegistry; -import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; -import gtPlusPlus.api.interfaces.IPlugin; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.plugin.manager.Core_Manager; -import gtPlusPlus.plugin.villagers.trade.TradeHandlerBanker; -import gtPlusPlus.plugin.villagers.trade.TradeHandlerTechnician; -import gtPlusPlus.plugin.villagers.trade.TradeHandlerTrader; - -// Called by Core_Manager#veryEarlyInit -@SuppressWarnings("unused") -public class Core_VillagerAdditions implements IPlugin { - - public static final Core_VillagerAdditions mInstance; - private static boolean shouldLoad = false; - - public static final HashMap mVillagerSkins = new HashMap<>(); - public static final AutoMap> mVillagerTrades = new AutoMap<>(); - - static { - mInstance = new Core_VillagerAdditions(); - Core_Manager.registerPlugin(mInstance); - mInstance.log("Preparing " + mInstance.getPluginName() + " for use."); - } - - @Override - public boolean preInit() { - if ( - /* CORE.ConfigSwitches.enableSulfuricAcidFix || */ CORE.DEVENV) { - shouldLoad = true; - } - if (shouldLoad) { - // Register Custom Villager Entity - VillagerUtils.registerNewVillager(0, "Banker", "Banker", "Banker", "banker", new TradeHandlerBanker()); - VillagerUtils.registerNewVillager( - 1, - "Technician", - "Technician", - "Technician", - "technician", - new TradeHandlerTechnician()); - VillagerUtils.registerNewVillager(2, "Trader", "Trader", "Trader", "trader", new TradeHandlerTrader()); - - if (mVillagerMap.size() > 0) { - for (VillagerObject g : mVillagerMap.values()) { - if (g != null && g.mID >= 0) { - VillagerRegistry.instance().registerVillagerId(7735 + g.mID); - log("Registered a Custom Villager with ID of " + g.mID + "."); - // Utils.createNewMobSpawner(10+g.mID, EntityBaseVillager.class); - if (mVillagerSkins.get(g.mID) != null) { - VillagerRegistry.instance().registerVillagerSkin(7735 + g.mID, mVillagerSkins.get(g.mID)); - log("Registered a Custom Skin for Villager with ID of " + g.mID + "."); - } - } - } - } - - // Register all Villager ID's and their Custom Trades. - if (mVillagerTrades.size() > 0) { - for (Pair g : mVillagerTrades) { - if (g != null && g.getKey() != null) { - if (g.getValue() != null) { - VillagerRegistry.instance().registerVillageTradeHandler(g.getKey(), g.getValue()); - log("Registered a Custom Trade for Villager with ID of " + g.getKey() + "."); - } - } - } - } - return true; - } - return false; - } - - @Override - public boolean init() { - return shouldLoad; - } - - @Override - public boolean postInit() { - return shouldLoad; - } - - @Override - public boolean serverStart() { - return shouldLoad; - } - - @Override - public boolean serverStop() { - return shouldLoad; - } - - @Override - public String getPluginName() { - return "GT++ Enhanced Villagers"; - } - - @Override - public String getPluginAbbreviation() { - return "Bank"; - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/VillagerObject.java b/src/main/java/gtPlusPlus/plugin/villagers/VillagerObject.java deleted file mode 100644 index 6a39fb0166..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/VillagerObject.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.plugin.villagers; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.util.ResourceLocation; - -import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; -import gtPlusPlus.api.objects.data.Pair; - -public class VillagerObject { - - public final int mID; - public final String mName; - public final IVillageTradeHandler mCustomTrade; - - public VillagerObject(int aID, String aName, Object aProfession, Object aCareer, Object aSkin, - IVillageTradeHandler aCustomTrade) { - - mID = aID; - mName = aName; - mCustomTrade = aCustomTrade; - - // Register Custom Trade to Registry. - if (aCustomTrade != null) { - Core_VillagerAdditions.mVillagerTrades - .put(new Pair(7735 + aID, aCustomTrade)); - } - // Register Skin to Registry. - if (aSkin != null) { - - if (aSkin instanceof String) { - String s = (String) aSkin; - aSkin = new ResourceLocation(GTPlusPlus.ID + ":" + "textures/entity/villager/" + s + ".png"); - } - if (aSkin instanceof ResourceLocation) { - Core_VillagerAdditions.mVillagerSkins.put(aID, (ResourceLocation) aSkin); - } - } - VillagerUtils.registerNewVillager(aID, this); - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/VillagerUtils.java b/src/main/java/gtPlusPlus/plugin/villagers/VillagerUtils.java deleted file mode 100644 index 9ca9377865..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/VillagerUtils.java +++ /dev/null @@ -1,19 +0,0 @@ -package gtPlusPlus.plugin.villagers; - -import java.util.HashMap; - -import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; - -public class VillagerUtils { - - public static final HashMap mVillagerMap = new HashMap(); - - public static void registerNewVillager(int aID, String aName, Object aProfession, Object aCareer, Object aSkin, - IVillageTradeHandler aCustomTrade) { - registerNewVillager(aID, new VillagerObject(aID, aName, aProfession, aCareer, aSkin, aCustomTrade)); - } - - public static void registerNewVillager(int aID, VillagerObject aVillager) { - mVillagerMap.put(aID, aVillager); - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/block/BlockGenericSpawner.java b/src/main/java/gtPlusPlus/plugin/villagers/block/BlockGenericSpawner.java deleted file mode 100644 index a620ed590b..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/block/BlockGenericSpawner.java +++ /dev/null @@ -1,58 +0,0 @@ -package gtPlusPlus.plugin.villagers.block; - -import static gtPlusPlus.core.lib.CORE.RANDOM; - -import java.util.List; - -import net.minecraft.block.BlockMobSpawner; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.item.base.itemblock.ItemBlockSpawner; -import gtPlusPlus.plugin.villagers.Core_VillagerAdditions; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; - -public class BlockGenericSpawner extends BlockMobSpawner { - - public BlockGenericSpawner() { - this.disableStats(); - this.setHardness(5.0F); - this.setStepSound(soundTypeMetal); - this.setBlockName("blockMobSpawnerEx"); - this.setBlockTextureName("mob_spawner"); - this.setResistance(2000.0F); - GameRegistry.registerBlock(this, ItemBlockSpawner.class, "blockMobSpawnerEx"); - Core_VillagerAdditions.mInstance.log("Registered Custom Spawner Block."); - } - - /** - * Returns a new instance of a block's tile entity class. Called on placing the block. - */ - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileEntityGenericSpawner(meta); - } - - @Override - public int getExpDrop(IBlockAccess world, int metadata, int fortune) { - return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { - for (int i = 0; i < Math.max(1, TileEntityGenericSpawner.mSpawners.size()); ++i) { - p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); - } - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java b/src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java deleted file mode 100644 index 967bc73bd0..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java +++ /dev/null @@ -1,68 +0,0 @@ -package gtPlusPlus.plugin.villagers.tile; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.MobSpawnerBaseLogic; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; -import gtPlusPlus.core.block.ModBlocks; - -public class MobSpawnerCustomLogic extends MobSpawnerBaseLogic { - - private TileEntityGenericSpawner mTile; - - public MobSpawnerCustomLogic(TileEntityGenericSpawner tile) { - if (tile != null) { - mTile = tile; - } - - if (TileEntityGenericSpawner.mSpawners.get(mTile.getID()) != null) { - Class c = TileEntityGenericSpawner.mSpawners.get(mTile.getID()); - EntityRegistration x = EntityRegistry.instance().lookupModSpawn(c, false); - if (x != null) { - this.setEntityName(x.getEntityName()); - } - } - } - - @Override - public void func_98267_a(int eventID) { - if (mTile != null) mTile.getWorldObj() - .addBlockEvent(mTile.xCoord, mTile.yCoord, mTile.zCoord, ModBlocks.blockCustomMobSpawner, eventID, 0); - } - - @Override - public World getSpawnerWorld() { - if (mTile != null) return mTile.getWorldObj(); - return null; - } - - @Override - public int getSpawnerX() { - if (mTile != null) return mTile.xCoord; - return 0; - } - - @Override - public int getSpawnerY() { - if (mTile != null) return mTile.yCoord; - return 0; - } - - @Override - public int getSpawnerZ() { - if (mTile != null) return mTile.zCoord; - return 0; - } - - @Override - public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart p_98277_1_) { - super.setRandomEntity(p_98277_1_); - if (mTile != null) { - if (this.getSpawnerWorld() != null) { - this.getSpawnerWorld().markBlockForUpdate(mTile.xCoord, mTile.yCoord, mTile.zCoord); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java b/src/main/java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java deleted file mode 100644 index 451a4aefe5..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java +++ /dev/null @@ -1,233 +0,0 @@ -package gtPlusPlus.plugin.villagers.tile; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.MobSpawnerBaseLogic; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityMobSpawner; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class TileEntityGenericSpawner extends TileEntityMobSpawner { - - /* - * Static Variables - */ - - /** A HashMap storing string names of classes mapping to the actual java.lang.Class type. */ - private static Map nameToClassMap_Ex = new HashMap(); - /** A HashMap storing the classes and mapping to the string names (reverse of nameToClassMap). */ - private static Map classToNameMap_Ex = new HashMap(); - - /** - * The Mob Spawner Map - */ - public static HashMap> mSpawners = new HashMap>(); - - /** - * Registers a New Mob Spawner Type - * - * @param aID - the Spawner type ID - * @param aEntity - the Entity which you'd like to spawn - */ - public static boolean registerNewMobSpawner(int aID, Class aEntity) { - int registered = mSpawners.size(); - Logger.INFO("Currently " + registered + " spawners are registered."); - if (!mSpawners.containsKey(aID) && !mSpawners.containsValue(aEntity)) { - mSpawners.put(aID, aEntity); - } - return mSpawners.size() > registered; - } - - /* - * Instance Variables - */ - - /** - * The {@link Entity} type which spawns. - */ - protected int mID; - - private final Class mSpawnType; - private MobSpawnerCustomLogic spawnerLogic; - - /* - * Constructors - */ - - /** - * Constructs a new Spawner, based on an existing type registered. - * - * @param aID - The ID in the {@link mSpawners} map. - */ - public TileEntityGenericSpawner(int aID) { - mID = aID; - if (mSpawners.get(aID) != null) { - mSpawnType = mSpawners.get(aID); - } else { - mSpawnType = null; - } - - // Last thing to Init - generateLogicObject(); - } - - /** - * Constructs a new Spawner, then registers it. - * - * @param aID - The ID to be used in the {@link mSpawners} map. - * @param aEntity - The {@link Entity} type which will be spawned. - */ - public TileEntityGenericSpawner(int aID, Entity aEntity) { - mID = aID; - if (aEntity != null) { - mSpawnType = aEntity.getClass(); - if (mSpawners.containsKey(aID)) { - registerNewMobSpawner(aID, mSpawnType); - } - } else { - mSpawnType = null; - } - - // Last thing to Init - generateLogicObject(); - } - - public final MobSpawnerCustomLogic getLogic() { - if (spawnerLogic == null || spawnerLogic.getSpawnerWorld() == null) { - generateLogicObject(); - } - return spawnerLogic; - } - - private final void generateLogicObject() { - spawnerLogic = new MobSpawnerCustomLogic(this); - } - - public int getID() { - return this.mID; - } - - @Override - public void readFromNBT(NBTTagCompound p_145839_1_) { - if (hasInternalFieldBeenSet()) { - this.getLogic().readFromNBT(p_145839_1_); - this.xCoord = p_145839_1_.getInteger("x"); - this.yCoord = p_145839_1_.getInteger("y"); - this.zCoord = p_145839_1_.getInteger("z"); - this.mID = p_145839_1_.getInteger("mID"); - } - } - - @Override - public void writeToNBT(NBTTagCompound p_145841_1_) { - if (hasInternalFieldBeenSet()) { - String s = (String) classToNameMap_Ex.get(this.getClass()); - if (s == null) { - for (Object g : classToNameMap_Ex.values()) { - if (g instanceof String) { - Logger.INFO("Found Translation for " + ((Class) nameToClassMap_Ex.get(g)).getName() + ": " + g); - } - } - - // throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!"); - s = mSpawners.containsKey(this.mID) ? mSpawners.get(this.mID).getSimpleName() : "bad.class.name"; - p_145841_1_.setString("id", s); - Logger.WARNING(this.getClass() + " is missing a mapping! This is a bug! Used key: " + s); - p_145841_1_.setInteger("x", this.xCoord); - p_145841_1_.setInteger("y", this.yCoord); - p_145841_1_.setInteger("z", this.zCoord); - p_145841_1_.setInteger("mID", this.mID); - } else { - Logger.INFO(this.getClass() + " is not missing a mapping! Used key: " + s); - p_145841_1_.setString("id", s); - p_145841_1_.setInteger("x", this.xCoord); - p_145841_1_.setInteger("y", this.yCoord); - p_145841_1_.setInteger("z", this.zCoord); - p_145841_1_.setInteger("mID", this.mID); - } - this.getLogic().writeToNBT(p_145841_1_); - } - } - - @Override - public void updateEntity() { - if (Utils.isServer()) { - mTicks++; - if (hasInternalFieldBeenSet()) { - this.getLogic().updateSpawner(); - } - } - } - - private boolean isReady = false; - private long mTicks = 0; - - private boolean hasInternalFieldBeenSet() { - if (isReady && mTicks % 200 != 0) { - return true; - } else { - - if (Utils.isServer()) { - try { - Map a1 = (Map) ReflectionUtils.getField(TileEntity.class, "nameToClassMap").get(this); - Map a2 = (Map) ReflectionUtils.getField(TileEntity.class, "classToNameMap").get(this); - if (a1 != null) { - if (nameToClassMap_Ex == null) { - nameToClassMap_Ex = a1; - } - if (nameToClassMap_Ex != null) { - if (nameToClassMap_Ex.size() != a1.size()) { - nameToClassMap_Ex = a1; - } - } - } - if (a2 != null) { - if (classToNameMap_Ex == null) { - classToNameMap_Ex = a2; - } - if (classToNameMap_Ex != null) { - if (classToNameMap_Ex.size() != a2.size()) { - classToNameMap_Ex = a2; - } - } - if (nameToClassMap_Ex != null && classToNameMap_Ex != null) { - // Logger.INFO("nameToClassMap_Ex has a size of "+nameToClassMap_Ex.size()+"."); - // Logger.INFO("a1 has a size of "+a1.size()+"."); - // Logger.INFO("classToNameMap_Ex has a size of "+classToNameMap_Ex.size()+"."); - // Logger.INFO("a2 has a size of "+a2.size()+"."); - isReady = true; - return true; - } - } - - /* - * Field mInternalLogicField = ReflectionUtils.getField(getClass(), "field_145882_a"); if - * (mInternalLogicField != null) { MobSpawnerBaseLogic a = (MobSpawnerBaseLogic) - * mInternalLogicField.get(this); if (a != null) { ReflectionUtils.setField(this, "field_145882_a", - * getLogic()); if (a.equals(getLogic())) { isReady = true; return true; } } } - */ - } catch (IllegalArgumentException | IllegalAccessException e) {} - } - return false; - } - } - - /** - * Called when a client event is received with the event number and argument, see World.sendClientEvent - */ - @Override - public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { - return this.spawnerLogic.setDelayToMin(p_145842_1_) ? true : super.receiveClientEvent(p_145842_1_, p_145842_2_); - } - - @Override - public MobSpawnerBaseLogic func_145881_a() { - return this.spawnerLogic; - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java deleted file mode 100644 index 3ad3cdd7eb..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.plugin.villagers.trade; - -import java.util.Random; - -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.village.MerchantRecipe; -import net.minecraft.village.MerchantRecipeList; - -import gtPlusPlus.core.recipe.common.CI; - -public class TradeHandlerBanker extends TradeHandlerBase { - - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - // if (villager.getProfession() == 7735) { - recipeList.add(new MerchantRecipe(CI.electricMotor_LV, CI.electricPiston_LV, CI.robotArm_LV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_MV, CI.electricPiston_MV, CI.robotArm_MV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_HV, CI.electricPiston_HV, CI.robotArm_HV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_EV, CI.electricPiston_EV, CI.robotArm_EV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_IV, CI.electricPiston_IV, CI.robotArm_IV)); - // Collections.shuffle(recipeList); - // } - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java deleted file mode 100644 index fa95404f49..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. All rights reserved. This program and the accompanying materials are made - * available under the terms of the GNU Lesser Public License v3 which accompanies this distribution, and is available - * at http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: SirSengir (original work), CovertJaguar, Player, Binnie, - * MysteriousAges - ******************************************************************************/ -package gtPlusPlus.plugin.villagers.trade; - -import java.util.Random; - -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.village.MerchantRecipeList; - -import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; - -public abstract class TradeHandlerBase implements IVillageTradeHandler { - - @SuppressWarnings("unchecked") - @Override - public abstract void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, - Random random); -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java deleted file mode 100644 index 1b67e2b478..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.plugin.villagers.trade; - -import java.util.Random; - -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.village.MerchantRecipe; -import net.minecraft.village.MerchantRecipeList; - -import gtPlusPlus.core.recipe.common.CI; - -public class TradeHandlerTechnician extends TradeHandlerBase { - - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - // if (villager.getProfession() == 7737) { - recipeList.add(new MerchantRecipe(CI.machineHull_LV, CI.electricMotor_LV, CI.machineHull_LV)); - recipeList.add(new MerchantRecipe(CI.machineHull_MV, CI.electricMotor_MV, CI.machineHull_MV)); - recipeList.add(new MerchantRecipe(CI.machineHull_HV, CI.electricMotor_HV, CI.machineHull_HV)); - recipeList.add(new MerchantRecipe(CI.machineHull_EV, CI.electricMotor_EV, CI.machineHull_EV)); - recipeList.add(new MerchantRecipe(CI.machineHull_IV, CI.electricMotor_IV, CI.machineHull_IV)); - // Collections.shuffle(recipeList); - // } - } -} diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java deleted file mode 100644 index 4b0e99471a..0000000000 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.plugin.villagers.trade; - -import java.util.Collections; -import java.util.Random; - -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.village.MerchantRecipe; -import net.minecraft.village.MerchantRecipeList; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class TradeHandlerTrader extends TradeHandlerBase { - - public TradeHandlerTrader() { - Logger.INFO("Created Trade Manager for 'Trader' villager profession type."); - } - - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - ItemStack Ore1 = null, Ore2 = null; - if (Ore1 == null) { - Ore1 = ELEMENT.getInstance().SILICON.getOre(1); - } - if (Ore2 == null) { - Ore2 = ELEMENT.getInstance().ALUMINIUM.getOre(1); - } - if (Ore1 == null) { - Ore1 = ELEMENT.getInstance().GOLD.getOre(1); - } - if (Ore2 == null) { - Ore2 = ELEMENT.getInstance().LEAD.getOre(1); - } - recipeList.add( - new MerchantRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("logWood", 32), - ELEMENT.getInstance().IRON.getOre(1))); - recipeList.add( - new MerchantRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 32), - ELEMENT.getInstance().COPPER.getOre(1))); - recipeList.add( - new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.obsidian, 6), ELEMENT.getInstance().TIN.getOre(1))); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.glowstone, 32), Ore1)); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.piston, 32), Ore2)); - Collections.shuffle(recipeList); - } -} -- cgit