From 19b0cc7223bb57658416431a11ae69c58e0f7732 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 30 Oct 2016 19:30:19 +0100 Subject: [PATCH] Remove old temporary stuff --- .../api/laser/IConnectionPair.java | 4 - .../mod/event/CommonEvents.java | 29 ----- .../mod/misc/ConnectionPair.java | 15 --- .../mod/tile/TileEntityBase.java | 118 ++++++++---------- 4 files changed, 53 insertions(+), 113 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java index 2788b30f2..a465dbba8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java @@ -26,8 +26,4 @@ public interface IConnectionPair{ LaserType getType(); boolean contains(BlockPos pos); - - @Deprecated - //TODO Remove this once removing the temporary type fixer - void setType(LaserType type); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java index 67e6d2d71..cc74eeda5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java @@ -145,35 +145,6 @@ public class CommonEvents{ @SubscribeEvent public void onLoad(WorldEvent.Load event){ WorldData.load(event.getWorld()); - - //TODO Remove this eventually (part of the ConnectionPair system change) - if(!ConnectionPair.PAIRS_FOR_FIXING.isEmpty()){ - for(ConnectionPair pair : ConnectionPair.PAIRS_FOR_FIXING){ - TileEntity first = event.getWorld().getTileEntity(pair.getPositions()[0]); - TileEntity second = event.getWorld().getTileEntity(pair.getPositions()[1]); - - boolean fixed = false; - if(first instanceof TileEntityLaserRelay && second instanceof TileEntityLaserRelay){ - LaserType firstType = ((TileEntityLaserRelay)first).type; - LaserType secondType = ((TileEntityLaserRelay)second).type; - if(firstType == secondType){ - pair.setType(firstType); - fixed = true; - } - } - - if(!fixed){ - for(int i = 0; i < pair.getPositions().length; i++){ - if(ActuallyAdditionsAPI.connectionHandler.getNetworkFor(pair.getPositions()[i], event.getWorld()) != null){ - ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pair.getPositions()[i], event.getWorld()); - } - } - ModUtil.LOGGER.error("Had to remove a Laser Relay connection between "+pair.getPositions()[0]+" and "+pair.getPositions()[1]+" because it couldn't be adapted to the new system!"); - } - } - ModUtil.LOGGER.info("Adapted "+ConnectionPair.PAIRS_FOR_FIXING.size()+" Laser Relay Connections to the new system!"); - ConnectionPair.PAIRS_FOR_FIXING.clear(); - } } @SubscribeEvent diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/ConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/ConnectionPair.java index 1390b0ada..84fe2135c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/ConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/ConnectionPair.java @@ -15,15 +15,8 @@ import de.ellpeck.actuallyadditions.api.laser.LaserType; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; -import java.util.ArrayList; -import java.util.List; - public class ConnectionPair implements IConnectionPair{ - //TODO Remove eventually, just for making the implementation of LaserType work - //TODO Also remove those deprecated methods in the API - public static final List PAIRS_FOR_FIXING = new ArrayList(); - private final BlockPos[] positions = new BlockPos[2]; private boolean suppressConnectionRender; private LaserType type; @@ -54,9 +47,6 @@ public class ConnectionPair implements IConnectionPair{ if(typeStrg != null && !typeStrg.isEmpty()){ this.type = LaserType.valueOf(typeStrg); } - if(this.type == null){ - PAIRS_FOR_FIXING.add(this); - } } } @@ -75,11 +65,6 @@ public class ConnectionPair implements IConnectionPair{ return this.type; } - @Override - public void setType(LaserType type){ - this.type = type; - } - public boolean contains(BlockPos relay){ for(BlockPos position : this.positions){ if(position != null && position.equals(relay)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 7cb370d20..bb266505d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -52,88 +52,76 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ public static void init(){ ModUtil.LOGGER.info("Registering TileEntities..."); - //TODO Remove legacy names at some point - register(TileEntityCompost.class, "Compost"); - register(TileEntityFeeder.class, "Feeder"); - register(TileEntityGiantChest.class, "GiantChest"); - register(TileEntityGiantChestMedium.class, "GiantChestMedium"); - register(TileEntityGiantChestLarge.class, "GiantChestLarge"); - register(TileEntityGrinder.class, "Grinder"); - register(TileEntityFurnaceDouble.class, "FurnaceDouble"); - register(TileEntityInputter.class, "Inputter"); - register(TileEntityFishingNet.class, "FishingNet"); - register(TileEntityFurnaceSolar.class, "FurnaceSolar"); - register(TileEntityHeatCollector.class, "HeatCollector"); - register(TileEntityItemRepairer.class, "Repairer"); - register(TileEntityGreenhouseGlass.class, "GreenhouseGlass"); - register(TileEntityBreaker.class, "Breaker"); - register(TileEntityDropper.class, "Dropper"); - register(TileEntityInputterAdvanced.class, "InputterAdvanced"); - register(TileEntityPlacer.class, "Placer"); - register(TileEntityGrinderDouble.class, "GrinderDouble"); - register(TileEntityCanolaPress.class, "CanolaPress"); - register(TileEntityFermentingBarrel.class, "FermentingBarrel"); - register(TileEntityOilGenerator.class, "OilGenerator"); - register(TileEntityCoalGenerator.class, "CoalGenerator"); - register(TileEntityPhantomItemface.class, "PhantomItemface"); - register(TileEntityPhantomLiquiface.class, "PhantomLiquiface"); - register(TileEntityPhantomEnergyface.class, "PhantomEnergyface"); - register(TileEntityPlayerInterface.class, "PlayerInterface"); - register(TileEntityPhantomPlacer.class, "PhantomPlacer"); - register(TileEntityPhantomBreaker.class, "PhantomBreaker"); - register(TileEntityFluidCollector.class, "FluidCollector"); - register(TileEntityFluidPlacer.class, "FluidPlacer"); - register(TileEntityLavaFactoryController.class, "LavaFactoryController"); - register(TileEntityCoffeeMachine.class, "CoffeeMachine"); - register(TileEntityPhantomBooster.class, "PhantomBooster"); - register(TileEntityEnergizer.class, "Energizer"); - register(TileEntityEnervator.class, "Enervator"); - register(TileEntityXPSolidifier.class, "XPSolidifier"); - register(TileEntitySmileyCloud.class, "Cloud"); - register(TileEntityLeafGenerator.class, "LeafGenerator"); - register(TileEntityDirectionalBreaker.class, "DirectionalBreaker"); - register(TileEntityRangedCollector.class, "RangedCollector"); - register(TileEntityAtomicReconstructor.class, "AtomicReconstructor"); - register(TileEntityMiner.class, "Miner"); - register(TileEntityFireworkBox.class, "FireworkBox"); - register(TileEntityPhantomRedstoneface.class, "PhantomRedstoneface"); - register(TileEntityLaserRelayItem.class, "LaserRelayItem"); - register(TileEntityLaserRelayEnergy.class, "LaserRelay"); + register(TileEntityCompost.class); + register(TileEntityFeeder.class); + register(TileEntityGiantChest.class); + register(TileEntityGiantChestMedium.class); + register(TileEntityGiantChestLarge.class); + register(TileEntityGrinder.class); + register(TileEntityFurnaceDouble.class); + register(TileEntityInputter.class); + register(TileEntityFishingNet.class); + register(TileEntityFurnaceSolar.class); + register(TileEntityHeatCollector.class); + register(TileEntityItemRepairer.class); + register(TileEntityGreenhouseGlass.class); + register(TileEntityBreaker.class); + register(TileEntityDropper.class); + register(TileEntityInputterAdvanced.class); + register(TileEntityPlacer.class); + register(TileEntityGrinderDouble.class); + register(TileEntityCanolaPress.class); + register(TileEntityFermentingBarrel.class); + register(TileEntityOilGenerator.class); + register(TileEntityCoalGenerator.class); + register(TileEntityPhantomItemface.class); + register(TileEntityPhantomLiquiface.class); + register(TileEntityPhantomEnergyface.class); + register(TileEntityPlayerInterface.class); + register(TileEntityPhantomPlacer.class); + register(TileEntityPhantomBreaker.class); + register(TileEntityFluidCollector.class); + register(TileEntityFluidPlacer.class); + register(TileEntityLavaFactoryController.class); + register(TileEntityCoffeeMachine.class); + register(TileEntityPhantomBooster.class); + register(TileEntityEnergizer.class); + register(TileEntityEnervator.class); + register(TileEntityXPSolidifier.class); + register(TileEntitySmileyCloud.class); + register(TileEntityLeafGenerator.class); + register(TileEntityDirectionalBreaker.class); + register(TileEntityRangedCollector.class); + register(TileEntityAtomicReconstructor.class); + register(TileEntityMiner.class); + register(TileEntityFireworkBox.class); + register(TileEntityPhantomRedstoneface.class); + register(TileEntityLaserRelayItem.class); + register(TileEntityLaserRelayEnergy.class); register(TileEntityLaserRelayEnergyAdvanced.class); register(TileEntityLaserRelayEnergyExtreme.class); - register(TileEntityLaserRelayItemWhitelist.class, "LaserRelayItemWhitelist"); - register(TileEntityItemViewer.class, "ItemViewer"); - register(TileEntityBookletStand.class, "BookletStand"); - register(TileEntityDisplayStand.class, "DisplayStand"); - register(TileEntityShockSuppressor.class, "ShockSuppressor"); + register(TileEntityLaserRelayItemWhitelist.class); + register(TileEntityItemViewer.class); + register(TileEntityBookletStand.class); + register(TileEntityDisplayStand.class); + register(TileEntityShockSuppressor.class); register(TileEntityEmpowerer.class); register(TileEntityLaserRelayFluids.class); register(TileEntityDistributorItem.class); register(TileEntityBioReactor.class); } - private static void register(Class tileClass, String legacyName){ + private static void register(Class tileClass){ try{ //This is hacky and dirty but it works so whatever String name = ModUtil.MOD_ID+":"+tileClass.newInstance().name; - - if(legacyName != null && !legacyName.isEmpty()){ - String oldName = ModUtil.MOD_ID+":tileEntity"+legacyName; - GameRegistry.registerTileEntityWithAlternatives(tileClass, name, oldName); - } - else{ - GameRegistry.registerTileEntity(tileClass, name); - } + GameRegistry.registerTileEntity(tileClass, name); } catch(Exception e){ ModUtil.LOGGER.fatal("Registering a TileEntity failed!", e); } } - private static void register(Class tileClass){ - register(tileClass, null); - } - @Override public final NBTTagCompound writeToNBT(NBTTagCompound compound){ this.writeSyncableNBT(compound, NBTType.SAVE_TILE);