Fixed update issue with wireless charger

This commit is contained in:
CrazyPants committed 2014-09-06 21:40:52 +08:00
1 parent e7104981a4
commit 776e3a56d3
1 file changed
-101
@@ -77,9 +77,6 @@ public class WirelessChargerController {
private boolean chargeFromCapBank(EntityPlayer player, IWirelessCharger capBank) {
boolean res = capBank.chargeItems(player.inventory.armorInventory);
res |= capBank.chargeItems(player.inventory.mainInventory);
if(res) {
player.inventory.markDirty();
}
return res;
}
@@ -92,102 +89,4 @@ public class WirelessChargerController {
return res;
}
// public static final int CHUNK_RANGE = (RANGE/16 + (RANGE%16 == 0 ? 0 : 1));
//
// private Map<Integer, Map<ChunkCoordIntPair, List<TileCapacitorBank>>> perWorldChargers = new HashMap<Integer, Map<ChunkCoordIntPair,List<TileCapacitorBank>>>();
//
// private WirelessChargerController() {
// }
//
// public void registerCharger(TileCapacitorBank capBank) {
// if(capBank == null) {
// return;
// }
// Map<ChunkCoordIntPair, List<TileCapacitorBank>> chargers = getChargersForWorld(capBank.getWorld());
// List<ChunkCoordIntPair> coords = getChunksInRange(capBank.getLocation());
// for(ChunkCoordIntPair cc : coords) {
// addCharger(chargers, cc, capBank);
// }
//
// }
//
// public void dereigsterCharger(TileCapacitorBank capBank) {
// if(capBank == null) {
// return;
// }
// Map<ChunkCoordIntPair, List<TileCapacitorBank>> chargers = getChargersForWorld(capBank.getWorld());
// List<ChunkCoordIntPair> coords = getChunksInRange(capBank.getLocation());
// for(ChunkCoordIntPair cc : coords) {
// removeCharger(chargers, cc, capBank);
// }
// }
//
//
// @SubscribeEvent
// public void onPlayerTick(TickEvent.PlayerTickEvent event) {
// if(event.side == Side.CLIENT || event.phase != TickEvent.Phase.END) {
// return;
// }
//
// List<TileCapacitorBank> charges = getChargersInRange(event.player);
//
//
// }
//
// private List<TileCapacitorBank> getChargersInRange(EntityPlayer player) {
// Map<ChunkCoordIntPair, List<TileCapacitorBank>> worldCharges = getChargersForWorld(player.worldObj);
// if(worldCharges.isEmpty()) {
// return null;
// }
// BlockCoord bc = new BlockCoord((int)player.posX, 0, (int)player.posZ);
// List<ChunkCoordIntPair> chunks = getChunksInRange(bc);
//
// List<TileCapacitorBank> result = new ArrayList<TileCapacitorBank>();
//
// }
//
//
// private void removeCharger(Map<ChunkCoordIntPair, List<TileCapacitorBank>> chunkChargers, ChunkCoordIntPair cc, TileCapacitorBank capBank) {
// List<TileCapacitorBank> chargers = chunkChargers.get(cc);
// if(chargers == null) {
// return;
// }
// chargers.remove(capBank);
// if(chargers.size() == 0) {
// chunkChargers.remove(cc);
// }
// }
//
// private void addCharger(Map<ChunkCoordIntPair, List<TileCapacitorBank>> chunkChargers, ChunkCoordIntPair cc, TileCapacitorBank capBank) {
// List<TileCapacitorBank> chargers = chunkChargers.get(cc);
// if(chargers == null) {
// chargers = new ArrayList<TileCapacitorBank>();
// chunkChargers.put(cc, chargers);
// }
// chargers.add(capBank);
// }
//
// private List<ChunkCoordIntPair> getChunksInRange(BlockCoord coord) {
// int chunkX = coord.x >> 4;
// int chunkY = coord.y >> 4;
//
// List<ChunkCoordIntPair> res = new ArrayList<ChunkCoordIntPair>();
// for(int xOffset=-CHUNK_RANGE; xOffset <= CHUNK_RANGE; xOffset++) {
// for(int yOffset=-CHUNK_RANGE; yOffset <= CHUNK_RANGE; yOffset++) {
// res.add(new ChunkCoordIntPair(chunkX + xOffset, chunkY + yOffset));
// }
// }
// return res;
// }
//
// private Map<ChunkCoordIntPair, List<TileCapacitorBank>> getChargersForWorld(World world) {
// int id = world.provider.dimensionId;
// Map<ChunkCoordIntPair, List<TileCapacitorBank>> res = perWorldChargers.get(id);
// if(res == null) {
// res = new HashMap<ChunkCoordIntPair, List<TileCapacitorBank>>();
// perWorldChargers.put(id, res);
// }
// return res;
// }
}