Little bit of cleanup ~

This commit is contained in:
Ellpeck 2017-02-04 16:48:22 +01:00
parent d5c430fcdc
commit f2c74521b1
9 changed files with 20 additions and 27 deletions

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.crafting; package de.ellpeck.actuallyadditions.mod.crafting;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;

View file

@ -34,9 +34,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class WorldData extends WorldSavedData{ public class WorldData extends WorldSavedData{
public static final String DATA_TAG = ModUtil.MOD_ID+"data"; public static final String DATA_TAG = ModUtil.MOD_ID+"data";
private static WorldData data;
//TODO Remove this as well //TODO Remove this as well
public static List<File> legacyLoadWorlds = new ArrayList<File>(); public static List<File> legacyLoadWorlds = new ArrayList<File>();
private static WorldData data;
public final ConcurrentSet<Network> laserRelayNetworks = new ConcurrentSet<Network>(); public final ConcurrentSet<Network> laserRelayNetworks = new ConcurrentSet<Network>();
public final ConcurrentHashMap<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<UUID, PlayerSave>(); public final ConcurrentHashMap<UUID, PlayerSave> playerSaveData = new ConcurrentHashMap<UUID, PlayerSave>();
@ -106,6 +106,16 @@ public class WorldData extends WorldSavedData{
return get(world, false); return get(world, false);
} }
//TODO Remove old loading mechanic after a while because it's legacy
public static void loadLegacy(World world){
if(!world.isRemote && world instanceof WorldServer){
int dim = world.provider.getDimension();
ISaveHandler handler = new WorldSpecificSaveHandler((WorldServer)world, world.getSaveHandler());
File dataFile = handler.getMapFileFromName(DATA_TAG+dim);
legacyLoadWorlds.add(dataFile);
}
}
//TODO Remove merging once removing old save handler //TODO Remove merging once removing old save handler
private void readFromNBT(NBTTagCompound compound, boolean merge){ private void readFromNBT(NBTTagCompound compound, boolean merge){
//Laser World Data //Laser World Data
@ -165,14 +175,4 @@ public class WorldData extends WorldSavedData{
return compound; return compound;
} }
//TODO Remove old loading mechanic after a while because it's legacy
public static void loadLegacy(World world){
if(!world.isRemote && world instanceof WorldServer){
int dim = world.provider.getDimension();
ISaveHandler handler = new WorldSpecificSaveHandler((WorldServer)world, world.getSaveHandler());
File dataFile = handler.getMapFileFromName(DATA_TAG+dim);
legacyLoadWorlds.add(dataFile);
}
}
} }

View file

@ -51,7 +51,7 @@ public class ItemWorm extends ItemBase{
EntityWorm worm = new EntityWorm(world); EntityWorm worm = new EntityWorm(world);
worm.setPosition(pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5); worm.setPosition(pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5);
world.spawnEntity(worm); world.spawnEntity(worm);
if(!player.capabilities.isCreativeMode){ if(!player.capabilities.isCreativeMode){
player.setHeldItem(hand, StackUtil.addStackSize(stack, -1)); player.setHeldItem(hand, StackUtil.addStackSize(stack, -1));
} }

View file

@ -1,5 +1,5 @@
/* /*
* This file ("CrusherRecipeHandler.java") is part of the Actually Additions mod for Minecraft. * This file ("ReedFarmerBehavior.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
@ -14,11 +14,9 @@ import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockReed; import net.minecraft.block.BlockReed;
import net.minecraft.block.BlockSand;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;

View file

@ -17,8 +17,8 @@ public interface INumberReactor{
/** /**
* Called when a Number gets received after typing it in in the GUI * Called when a Number gets received after typing it in in the GUI
* *
* @param number The number that was sent * @param number The number that was sent
* @param id The ID (meaning the place in the GUI) of the number typed in * @param id The ID (meaning the place in the GUI) of the number typed in
* @param player The Player doing it * @param player The Player doing it
*/ */
void onNumberReceived(double number, int id, EntityPlayer player); void onNumberReceived(double number, int id, EntityPlayer player);

View file

@ -32,24 +32,20 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp
public static final int USE_PER_SHOT = 500; public static final int USE_PER_SHOT = 500;
public final CustomEnergyStorage storage = new CustomEnergyStorage(20000, 200, 0); public final CustomEnergyStorage storage = new CustomEnergyStorage(20000, 200, 0);
private int timeUntilNextFirework;
private int oldEnergy;
public int intValuePlay = 2; public int intValuePlay = 2;
public int chargeAmount = 2; public int chargeAmount = 2;
public int flightTime = 2; public int flightTime = 2;
public float trailOrFlickerChance = 0.65F; public float trailOrFlickerChance = 0.65F;
public float flickerChance = 0.25F; public float flickerChance = 0.25F;
public int colorAmount = 3; public int colorAmount = 3;
public float typeChance0 = 1F; public float typeChance0 = 1F;
public float typeChance1 = 0F; public float typeChance1 = 0F;
public float typeChance2 = 0F; public float typeChance2 = 0F;
public float typeChance3 = 0F; public float typeChance3 = 0F;
public float typeChance4 = 0F; public float typeChance4 = 0F;
public int areaOfEffect = 2; public int areaOfEffect = 2;
private int timeUntilNextFirework;
private int oldEnergy;
public TileEntityFireworkBox(){ public TileEntityFireworkBox(){
super("fireworkBox"); super("fireworkBox");

View file

@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor{ public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor{
public static final int OKAY_BUTTON_ID = 133; public static final int OKAY_BUTTON_ID = 133;
private final SlotlessableItemHandlerWrapper wrapper = new SlotlessableItemHandlerWrapper(this.slots, null);
public int sideToPut = -1; public int sideToPut = -1;
public int slotToPutStart; public int slotToPutStart;
public int slotToPutEnd; public int slotToPutEnd;
@ -50,7 +51,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
private int lastPullSide; private int lastPullSide;
private int lastPullStart; private int lastPullStart;
private int lastPullEnd; private int lastPullEnd;
private final SlotlessableItemHandlerWrapper wrapper = new SlotlessableItemHandlerWrapper(this.slots, null);
public TileEntityInputter(int slots, String name){ public TileEntityInputter(int slots, String name){
super(slots, name); super(slots, name);

View file

@ -33,10 +33,10 @@ import java.util.*;
public class TileEntityItemViewer extends TileEntityBase{ public class TileEntityItemViewer extends TileEntityBase{
protected final SlotlessableItemHandlerWrapper itemHandler;
public final List<GenericItemHandlerInfo> genericInfos = new ArrayList<GenericItemHandlerInfo>(); public final List<GenericItemHandlerInfo> genericInfos = new ArrayList<GenericItemHandlerInfo>();
public final Map<Integer, IItemHandlerInfo> itemHandlerInfos = new HashMap<Integer, IItemHandlerInfo>(); public final Map<Integer, IItemHandlerInfo> itemHandlerInfos = new HashMap<Integer, IItemHandlerInfo>();
public final List<SlotlessItemHandlerInfo> slotlessInfos = new ArrayList<SlotlessItemHandlerInfo>(); public final List<SlotlessItemHandlerInfo> slotlessInfos = new ArrayList<SlotlessItemHandlerInfo>();
protected final SlotlessableItemHandlerWrapper itemHandler;
public TileEntityLaserRelayItem connectedRelay; public TileEntityLaserRelayItem connectedRelay;
private int lastNetworkChangeAmount = -1; private int lastNetworkChangeAmount = -1;

View file

@ -1,5 +1,5 @@
/* /*
* This file ("SlotlessableItemHandler.java") is part of the Actually Additions mod for Minecraft. * This file ("SlotlessableItemHandlerWrapper.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense