mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Remove old temporary stuff
This commit is contained in:
parent
acebcb2fbd
commit
19b0cc7223
4 changed files with 53 additions and 113 deletions
|
@ -26,8 +26,4 @@ public interface IConnectionPair{
|
||||||
LaserType getType();
|
LaserType getType();
|
||||||
|
|
||||||
boolean contains(BlockPos pos);
|
boolean contains(BlockPos pos);
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
//TODO Remove this once removing the temporary type fixer
|
|
||||||
void setType(LaserType type);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,35 +145,6 @@ public class CommonEvents{
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLoad(WorldEvent.Load event){
|
public void onLoad(WorldEvent.Load event){
|
||||||
WorldData.load(event.getWorld());
|
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
|
@SubscribeEvent
|
||||||
|
|
|
@ -15,15 +15,8 @@ import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ConnectionPair implements IConnectionPair{
|
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<ConnectionPair> PAIRS_FOR_FIXING = new ArrayList<ConnectionPair>();
|
|
||||||
|
|
||||||
private final BlockPos[] positions = new BlockPos[2];
|
private final BlockPos[] positions = new BlockPos[2];
|
||||||
private boolean suppressConnectionRender;
|
private boolean suppressConnectionRender;
|
||||||
private LaserType type;
|
private LaserType type;
|
||||||
|
@ -54,9 +47,6 @@ public class ConnectionPair implements IConnectionPair{
|
||||||
if(typeStrg != null && !typeStrg.isEmpty()){
|
if(typeStrg != null && !typeStrg.isEmpty()){
|
||||||
this.type = LaserType.valueOf(typeStrg);
|
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;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setType(LaserType type){
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean contains(BlockPos relay){
|
public boolean contains(BlockPos relay){
|
||||||
for(BlockPos position : this.positions){
|
for(BlockPos position : this.positions){
|
||||||
if(position != null && position.equals(relay)){
|
if(position != null && position.equals(relay)){
|
||||||
|
|
|
@ -52,88 +52,76 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Registering TileEntities...");
|
ModUtil.LOGGER.info("Registering TileEntities...");
|
||||||
|
|
||||||
//TODO Remove legacy names at some point
|
register(TileEntityCompost.class);
|
||||||
register(TileEntityCompost.class, "Compost");
|
register(TileEntityFeeder.class);
|
||||||
register(TileEntityFeeder.class, "Feeder");
|
register(TileEntityGiantChest.class);
|
||||||
register(TileEntityGiantChest.class, "GiantChest");
|
register(TileEntityGiantChestMedium.class);
|
||||||
register(TileEntityGiantChestMedium.class, "GiantChestMedium");
|
register(TileEntityGiantChestLarge.class);
|
||||||
register(TileEntityGiantChestLarge.class, "GiantChestLarge");
|
register(TileEntityGrinder.class);
|
||||||
register(TileEntityGrinder.class, "Grinder");
|
register(TileEntityFurnaceDouble.class);
|
||||||
register(TileEntityFurnaceDouble.class, "FurnaceDouble");
|
register(TileEntityInputter.class);
|
||||||
register(TileEntityInputter.class, "Inputter");
|
register(TileEntityFishingNet.class);
|
||||||
register(TileEntityFishingNet.class, "FishingNet");
|
register(TileEntityFurnaceSolar.class);
|
||||||
register(TileEntityFurnaceSolar.class, "FurnaceSolar");
|
register(TileEntityHeatCollector.class);
|
||||||
register(TileEntityHeatCollector.class, "HeatCollector");
|
register(TileEntityItemRepairer.class);
|
||||||
register(TileEntityItemRepairer.class, "Repairer");
|
register(TileEntityGreenhouseGlass.class);
|
||||||
register(TileEntityGreenhouseGlass.class, "GreenhouseGlass");
|
register(TileEntityBreaker.class);
|
||||||
register(TileEntityBreaker.class, "Breaker");
|
register(TileEntityDropper.class);
|
||||||
register(TileEntityDropper.class, "Dropper");
|
register(TileEntityInputterAdvanced.class);
|
||||||
register(TileEntityInputterAdvanced.class, "InputterAdvanced");
|
register(TileEntityPlacer.class);
|
||||||
register(TileEntityPlacer.class, "Placer");
|
register(TileEntityGrinderDouble.class);
|
||||||
register(TileEntityGrinderDouble.class, "GrinderDouble");
|
register(TileEntityCanolaPress.class);
|
||||||
register(TileEntityCanolaPress.class, "CanolaPress");
|
register(TileEntityFermentingBarrel.class);
|
||||||
register(TileEntityFermentingBarrel.class, "FermentingBarrel");
|
register(TileEntityOilGenerator.class);
|
||||||
register(TileEntityOilGenerator.class, "OilGenerator");
|
register(TileEntityCoalGenerator.class);
|
||||||
register(TileEntityCoalGenerator.class, "CoalGenerator");
|
register(TileEntityPhantomItemface.class);
|
||||||
register(TileEntityPhantomItemface.class, "PhantomItemface");
|
register(TileEntityPhantomLiquiface.class);
|
||||||
register(TileEntityPhantomLiquiface.class, "PhantomLiquiface");
|
register(TileEntityPhantomEnergyface.class);
|
||||||
register(TileEntityPhantomEnergyface.class, "PhantomEnergyface");
|
register(TileEntityPlayerInterface.class);
|
||||||
register(TileEntityPlayerInterface.class, "PlayerInterface");
|
register(TileEntityPhantomPlacer.class);
|
||||||
register(TileEntityPhantomPlacer.class, "PhantomPlacer");
|
register(TileEntityPhantomBreaker.class);
|
||||||
register(TileEntityPhantomBreaker.class, "PhantomBreaker");
|
register(TileEntityFluidCollector.class);
|
||||||
register(TileEntityFluidCollector.class, "FluidCollector");
|
register(TileEntityFluidPlacer.class);
|
||||||
register(TileEntityFluidPlacer.class, "FluidPlacer");
|
register(TileEntityLavaFactoryController.class);
|
||||||
register(TileEntityLavaFactoryController.class, "LavaFactoryController");
|
register(TileEntityCoffeeMachine.class);
|
||||||
register(TileEntityCoffeeMachine.class, "CoffeeMachine");
|
register(TileEntityPhantomBooster.class);
|
||||||
register(TileEntityPhantomBooster.class, "PhantomBooster");
|
register(TileEntityEnergizer.class);
|
||||||
register(TileEntityEnergizer.class, "Energizer");
|
register(TileEntityEnervator.class);
|
||||||
register(TileEntityEnervator.class, "Enervator");
|
register(TileEntityXPSolidifier.class);
|
||||||
register(TileEntityXPSolidifier.class, "XPSolidifier");
|
register(TileEntitySmileyCloud.class);
|
||||||
register(TileEntitySmileyCloud.class, "Cloud");
|
register(TileEntityLeafGenerator.class);
|
||||||
register(TileEntityLeafGenerator.class, "LeafGenerator");
|
register(TileEntityDirectionalBreaker.class);
|
||||||
register(TileEntityDirectionalBreaker.class, "DirectionalBreaker");
|
register(TileEntityRangedCollector.class);
|
||||||
register(TileEntityRangedCollector.class, "RangedCollector");
|
register(TileEntityAtomicReconstructor.class);
|
||||||
register(TileEntityAtomicReconstructor.class, "AtomicReconstructor");
|
register(TileEntityMiner.class);
|
||||||
register(TileEntityMiner.class, "Miner");
|
register(TileEntityFireworkBox.class);
|
||||||
register(TileEntityFireworkBox.class, "FireworkBox");
|
register(TileEntityPhantomRedstoneface.class);
|
||||||
register(TileEntityPhantomRedstoneface.class, "PhantomRedstoneface");
|
register(TileEntityLaserRelayItem.class);
|
||||||
register(TileEntityLaserRelayItem.class, "LaserRelayItem");
|
register(TileEntityLaserRelayEnergy.class);
|
||||||
register(TileEntityLaserRelayEnergy.class, "LaserRelay");
|
|
||||||
register(TileEntityLaserRelayEnergyAdvanced.class);
|
register(TileEntityLaserRelayEnergyAdvanced.class);
|
||||||
register(TileEntityLaserRelayEnergyExtreme.class);
|
register(TileEntityLaserRelayEnergyExtreme.class);
|
||||||
register(TileEntityLaserRelayItemWhitelist.class, "LaserRelayItemWhitelist");
|
register(TileEntityLaserRelayItemWhitelist.class);
|
||||||
register(TileEntityItemViewer.class, "ItemViewer");
|
register(TileEntityItemViewer.class);
|
||||||
register(TileEntityBookletStand.class, "BookletStand");
|
register(TileEntityBookletStand.class);
|
||||||
register(TileEntityDisplayStand.class, "DisplayStand");
|
register(TileEntityDisplayStand.class);
|
||||||
register(TileEntityShockSuppressor.class, "ShockSuppressor");
|
register(TileEntityShockSuppressor.class);
|
||||||
register(TileEntityEmpowerer.class);
|
register(TileEntityEmpowerer.class);
|
||||||
register(TileEntityLaserRelayFluids.class);
|
register(TileEntityLaserRelayFluids.class);
|
||||||
register(TileEntityDistributorItem.class);
|
register(TileEntityDistributorItem.class);
|
||||||
register(TileEntityBioReactor.class);
|
register(TileEntityBioReactor.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(Class<? extends TileEntityBase> tileClass, String legacyName){
|
private static void register(Class<? extends TileEntityBase> tileClass){
|
||||||
try{
|
try{
|
||||||
//This is hacky and dirty but it works so whatever
|
//This is hacky and dirty but it works so whatever
|
||||||
String name = ModUtil.MOD_ID+":"+tileClass.newInstance().name;
|
String name = ModUtil.MOD_ID+":"+tileClass.newInstance().name;
|
||||||
|
GameRegistry.registerTileEntity(tileClass, name);
|
||||||
if(legacyName != null && !legacyName.isEmpty()){
|
|
||||||
String oldName = ModUtil.MOD_ID+":tileEntity"+legacyName;
|
|
||||||
GameRegistry.registerTileEntityWithAlternatives(tileClass, name, oldName);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
GameRegistry.registerTileEntity(tileClass, name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
ModUtil.LOGGER.fatal("Registering a TileEntity failed!", e);
|
ModUtil.LOGGER.fatal("Registering a TileEntity failed!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(Class<? extends TileEntityBase> tileClass){
|
|
||||||
register(tileClass, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final NBTTagCompound writeToNBT(NBTTagCompound compound){
|
public final NBTTagCompound writeToNBT(NBTTagCompound compound){
|
||||||
this.writeSyncableNBT(compound, NBTType.SAVE_TILE);
|
this.writeSyncableNBT(compound, NBTType.SAVE_TILE);
|
||||||
|
|
Loading…
Reference in a new issue