Removed several unchecked casts.
This commit is contained in:
@@ -47,5 +47,5 @@ public interface IAECluster {
|
|||||||
*/
|
*/
|
||||||
boolean isDestroyed();
|
boolean isDestroyed();
|
||||||
|
|
||||||
Iterator<IGridHost> getTiles();
|
Iterator<? extends IGridHost> getTiles();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class CraftingCPUCalculator extends MBCalculator<CraftingTileEntity, Craf
|
|||||||
|
|
||||||
c.done();
|
c.done();
|
||||||
|
|
||||||
final Iterator<IGridHost> i = c.getTiles();
|
final Iterator<CraftingTileEntity> i = c.getTiles();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
final IGridHost gh = i.next();
|
final IGridHost gh = i.next();
|
||||||
final IGridNode n = gh.getGridNode(AEPartLocation.INTERNAL);
|
final IGridNode n = gh.getGridNode(AEPartLocation.INTERNAL);
|
||||||
|
|||||||
@@ -185,8 +185,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<IGridHost> getTiles() {
|
public Iterator<CraftingTileEntity> getTiles() {
|
||||||
return (Iterator) this.tiles.iterator();
|
return this.tiles.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addTile(final CraftingTileEntity te) {
|
void addTile(final CraftingTileEntity te) {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import appeng.api.events.LocatableEventAnnounce;
|
|||||||
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
||||||
import appeng.api.exceptions.FailedConnectionException;
|
import appeng.api.exceptions.FailedConnectionException;
|
||||||
import appeng.api.features.ILocatable;
|
import appeng.api.features.ILocatable;
|
||||||
import appeng.api.networking.IGridHost;
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -238,7 +237,7 @@ public class QuantumCluster implements ILocatable, IAECluster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<IGridHost> getTiles() {
|
public Iterator<QuantumBridgeTileEntity> getTiles() {
|
||||||
return new ChainedIterator<>(this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3],
|
return new ChainedIterator<>(this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3],
|
||||||
this.getRing()[4], this.getRing()[5], this.getRing()[6], this.getRing()[7], this.center);
|
this.getRing()[4], this.getRing()[5], this.getRing()[6], this.getRing()[7], this.center);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.util.List;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.networking.IGridHost;
|
|
||||||
import appeng.me.cluster.IAECluster;
|
import appeng.me.cluster.IAECluster;
|
||||||
import appeng.me.cluster.MBCalculator;
|
import appeng.me.cluster.MBCalculator;
|
||||||
import appeng.tile.spatial.SpatialPylonTileEntity;
|
import appeng.tile.spatial.SpatialPylonTileEntity;
|
||||||
@@ -88,8 +87,8 @@ public class SpatialPylonCluster implements IAECluster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<IGridHost> getTiles() {
|
public Iterator<SpatialPylonTileEntity> getTiles() {
|
||||||
return (Iterator) this.getLine().iterator();
|
return this.getLine().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int tileCount() {
|
public int tileCount() {
|
||||||
|
|||||||
@@ -41,11 +41,10 @@ public class AENetworkProxyMultiblock extends AENetworkProxy implements IGridMul
|
|||||||
if (this.getCluster() == null) {
|
if (this.getCluster() == null) {
|
||||||
return new ChainedIterator<>();
|
return new ChainedIterator<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProxyNodeIterator(this.getCluster().getTiles());
|
return new ProxyNodeIterator(this.getCluster().getTiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IAECluster getCluster() {
|
private IAECluster getCluster() {
|
||||||
return ((IAEMultiBlock) this.getMachine()).getCluster();
|
return ((IAEMultiBlock<?>) this.getMachine()).getCluster();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,17 @@
|
|||||||
|
|
||||||
package appeng.tile.crafting;
|
package appeng.tile.crafting;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -35,15 +38,12 @@ import net.minecraftforge.client.model.data.IModelData;
|
|||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.implementations.IPowerChannelState;
|
import appeng.api.implementations.IPowerChannelState;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.IGridHost;
|
|
||||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventory;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AEPartLocation;
|
|
||||||
import appeng.api.util.WorldCoord;
|
|
||||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||||
import appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
|
import appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
|
||||||
import appeng.core.Api;
|
import appeng.core.Api;
|
||||||
@@ -90,7 +90,7 @@ public class CraftingTileEntity extends AENetworkTileEntity
|
|||||||
@Override
|
@Override
|
||||||
public boolean canBeRotated() {
|
public boolean canBeRotated() {
|
||||||
return true;// return BlockCraftingUnit.checkType( world.getBlockMetadata( xCoord, yCoord,
|
return true;// return BlockCraftingUnit.checkType( world.getBlockMetadata( xCoord, yCoord,
|
||||||
// zCoord ),
|
// zCoord ),
|
||||||
// BlockCraftingUnit.BASE_MONITOR );
|
// BlockCraftingUnit.BASE_MONITOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,21 +250,18 @@ public class CraftingTileEntity extends AENetworkTileEntity
|
|||||||
this.cluster.cancel();
|
this.cluster.cancel();
|
||||||
final IMEInventory<IAEItemStack> inv = this.cluster.getInventory();
|
final IMEInventory<IAEItemStack> inv = this.cluster.getInventory();
|
||||||
|
|
||||||
final LinkedList<WorldCoord> places = new LinkedList<>();
|
final LinkedList<BlockPos> places = new LinkedList<>();
|
||||||
|
|
||||||
final Iterator<IGridHost> i = this.cluster.getTiles();
|
final Iterator<CraftingTileEntity> i = this.cluster.getTiles();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
final IGridHost h = i.next();
|
final CraftingTileEntity h = i.next();
|
||||||
if (h == this) {
|
if (h == this) {
|
||||||
places.add(new WorldCoord(this));
|
places.add(pos);
|
||||||
} else {
|
} else {
|
||||||
final TileEntity te = (TileEntity) h;
|
for (Direction d : Direction.values()) {
|
||||||
|
BlockPos p = h.pos.offset(d);
|
||||||
for (final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS) {
|
if (this.world.isAirBlock(p)) {
|
||||||
final WorldCoord wc = new WorldCoord(te);
|
places.add(p);
|
||||||
wc.add(d, 1);
|
|
||||||
if (this.world.isAirBlock(wc.getPos())) {
|
|
||||||
places.add(wc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,10 +285,10 @@ public class CraftingTileEntity extends AENetworkTileEntity
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldCoord wc = places.poll();
|
final BlockPos pos = places.poll();
|
||||||
places.add(wc);
|
places.add(pos);
|
||||||
|
|
||||||
Platform.spawnDrops(this.world, wc.getPos(), Collections.singletonList(g.createItemStack()));
|
Platform.spawnDrops(this.world, pos, Collections.singletonList(g.createItemStack()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ import appeng.api.networking.IGridNode;
|
|||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
|
||||||
public final class ProxyNodeIterator implements Iterator<IGridNode> {
|
public final class ProxyNodeIterator implements Iterator<IGridNode> {
|
||||||
private final Iterator<IGridHost> hosts;
|
private final Iterator<? extends IGridHost> hosts;
|
||||||
|
|
||||||
public ProxyNodeIterator(final Iterator<IGridHost> hosts) {
|
public ProxyNodeIterator(final Iterator<? extends IGridHost> hosts) {
|
||||||
this.hosts = hosts;
|
this.hosts = hosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user