diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-09-04 03:05:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-04 03:05:22 +0100 |
| commit | 76719d65a90d98e228a914774d3b11ed9f01ac8e (patch) | |
| tree | ce0d35f954e441e9cc4aa95aa347073728e6f4ee /src/main/java/gtPlusPlus/plugin/villagers/tile | |
| parent | 0393b582eb3edcb5c575330804b6747577a55e27 (diff) | |
| download | GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.gz GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.bz2 GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.zip | |
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 <colen@CONNORSPC>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/plugin/villagers/tile')
| -rw-r--r-- | src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java | 68 | ||||
| -rw-r--r-- | src/main/java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java | 233 |
2 files changed, 0 insertions, 301 deletions
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<Entity> 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<Object, Object>(); - /** A HashMap storing the classes and mapping to the string names (reverse of nameToClassMap). */ - private static Map<?, ?> classToNameMap_Ex = new HashMap<Object, Object>(); - - /** - * The Mob Spawner Map - */ - public static HashMap<Integer, Class<Entity>> mSpawners = new HashMap<Integer, Class<Entity>>(); - - /** - * 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<Entity> 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; - } -} |
