More general improvements
This commit is contained in:
@@ -21,7 +21,7 @@ import refinedstorage.item.ItemBlockBase;
|
||||
import refinedstorage.tile.TileBase;
|
||||
|
||||
public abstract class BlockBase extends Block {
|
||||
public static final PropertyDirection DIRECTION = PropertyDirection.create("direction");
|
||||
private static final PropertyDirection DIRECTION = PropertyDirection.create("direction");
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -147,7 +147,7 @@ public abstract class BlockBase extends Block {
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
public EnumPlacementType getPlacementType() {
|
||||
protected EnumPlacementType getPlacementType() {
|
||||
return EnumPlacementType.HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ import refinedstorage.tile.TileCable;
|
||||
public class BlockCable extends BlockNode {
|
||||
private static final AxisAlignedBB CABLE_AABB = new AxisAlignedBB(4 * (1F / 16F), 4 * (1F / 16F), 4 * (1F / 16F), 1 - 4 * (1F / 16F), 1 - 4 * (1F / 16F), 1 - 4 * (1F / 16F));
|
||||
|
||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool DOWN = PropertyBool.create("down");
|
||||
private static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
private static final PropertyBool EAST = PropertyBool.create("east");
|
||||
private static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
private static final PropertyBool WEST = PropertyBool.create("west");
|
||||
private static final PropertyBool UP = PropertyBool.create("up");
|
||||
private static final PropertyBool DOWN = PropertyBool.create("down");
|
||||
|
||||
public BlockCable(String name) {
|
||||
super(name);
|
||||
@@ -91,7 +91,7 @@ public class BlockCable extends BlockNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlacementType getPlacementType() {
|
||||
protected EnumPlacementType getPlacementType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ import java.util.List;
|
||||
|
||||
public class BlockController extends BlockBase {
|
||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumControllerType.class);
|
||||
public static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 7);
|
||||
|
||||
private static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 7);
|
||||
|
||||
public BlockController() {
|
||||
super("controller");
|
||||
|
||||
@@ -18,9 +18,9 @@ import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileDetector;
|
||||
|
||||
public class BlockDetector extends BlockNode {
|
||||
public static final AxisAlignedBB AABB_DETECTOR = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 4D / 16D, 1.0D);
|
||||
private static final AxisAlignedBB AABB_DETECTOR = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 4D / 16D, 1.0D);
|
||||
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
private static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
public BlockDetector() {
|
||||
super("detector");
|
||||
|
||||
@@ -16,7 +16,7 @@ import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileDiskDrive;
|
||||
|
||||
public class BlockDiskDrive extends BlockNode {
|
||||
public static final PropertyInteger STORED = PropertyInteger.create("stored", 0, 7);
|
||||
private static final PropertyInteger STORED = PropertyInteger.create("stored", 0, 7);
|
||||
|
||||
public BlockDiskDrive() {
|
||||
super("disk_drive");
|
||||
|
||||
@@ -15,7 +15,7 @@ import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.tile.TileNode;
|
||||
|
||||
public abstract class BlockNode extends BlockBase {
|
||||
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
||||
private static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
||||
|
||||
public BlockNode(String name) {
|
||||
super(name);
|
||||
|
||||
@@ -17,9 +17,9 @@ import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileSolderer;
|
||||
|
||||
public class BlockSolderer extends BlockNode {
|
||||
public static final AxisAlignedBB AABB_SOLDERER = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 14D / 16D, 1.0D);
|
||||
private static final AxisAlignedBB AABB_SOLDERER = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 14D / 16D, 1.0D);
|
||||
|
||||
public static final PropertyBool WORKING = PropertyBool.create("working");
|
||||
private static final PropertyBool WORKING = PropertyBool.create("working");
|
||||
|
||||
public BlockSolderer() {
|
||||
super("solderer");
|
||||
|
||||
@@ -14,7 +14,7 @@ public enum EnumPlacementType {
|
||||
EnumFacing.WEST
|
||||
);
|
||||
|
||||
public final EnumFacing[] allowed;
|
||||
final EnumFacing[] allowed;
|
||||
|
||||
EnumPlacementType(EnumFacing... allowed) {
|
||||
this.allowed = allowed;
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class ContainerBase extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack mergeItemStackToSpecimen(ItemStack stack, int begin, int end) {
|
||||
protected ItemStack mergeItemStackToSpecimen(ItemStack stack, int begin, int end) {
|
||||
for (int i = begin; i < end; ++i) {
|
||||
if (CompareUtils.compareStackNoQuantity(getSlot(i).getStack(), stack)) {
|
||||
return null;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package refinedstorage.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
public class ContainerDummy extends Container {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public abstract class GuiBase extends GuiContainer {
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
|
||||
sideButtons.stream().filter(b -> b.getId() == button.id).findFirst().ifPresent(s -> s.actionPerformed());
|
||||
sideButtons.stream().filter(b -> b.getId() == button.id).findFirst().ifPresent(SideButton::actionPerformed);
|
||||
}
|
||||
|
||||
public GuiButton addButton(int x, int y, int w, int h) {
|
||||
|
||||
@@ -104,7 +104,7 @@ public class GuiController extends GuiBase {
|
||||
}
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
private int getOffset() {
|
||||
return (int) Math.ceil(getScrollbar().getCurrentScroll() / 59f * (float) getRows());
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
}
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
private int getOffset() {
|
||||
return (int) Math.ceil(getScrollbar().getCurrentScroll() / 89f * (float) getRows());
|
||||
}
|
||||
|
||||
|
||||
@@ -391,9 +391,9 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
@Override
|
||||
public void sendStorageToClient() {
|
||||
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream().filter(player -> isWatchingGrid(player)).forEach(player -> {
|
||||
sendStorageToClient(player);
|
||||
});
|
||||
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream()
|
||||
.filter(this::isWatchingGrid)
|
||||
.forEach(this::sendStorageToClient);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -403,9 +403,9 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
@Override
|
||||
public void sendStorageDeltaToClient(ItemStack stack, int delta) {
|
||||
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream().filter(player -> isWatchingGrid(player)).forEach(player -> {
|
||||
RefinedStorage.INSTANCE.network.sendTo(new MessageGridDelta(this, stack, delta), player);
|
||||
});
|
||||
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream()
|
||||
.filter(this::isWatchingGrid)
|
||||
.forEach(player -> RefinedStorage.INSTANCE.network.sendTo(new MessageGridDelta(this, stack, delta), player));
|
||||
}
|
||||
|
||||
private boolean isWatchingGrid(EntityPlayer player) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class DrawerStorage extends ExternalStorage {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean isVoidable() {
|
||||
private boolean isVoidable() {
|
||||
return drawer instanceof IVoidable && ((IVoidable) drawer).isVoid();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,18 +25,18 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileExternalStorage extends TileNode implements IStorageProvider, IStorageGui, IComparable, IFilterable, IPrioritizable {
|
||||
public static final TileDataParameter PRIORITY = IPrioritizable.createParameter();
|
||||
public static final TileDataParameter COMPARE = IComparable.createParameter();
|
||||
public static final TileDataParameter MODE = IFilterable.createParameter();
|
||||
public static final TileDataParameter<Integer> PRIORITY = IPrioritizable.createParameter();
|
||||
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
||||
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
|
||||
|
||||
public static final TileDataParameter STORED = TileDataManager.createParameter(DataSerializers.VARINT, new ITileDataProducer<Integer, TileExternalStorage>() {
|
||||
public static final TileDataParameter<Integer> STORED = TileDataManager.createParameter(DataSerializers.VARINT, new ITileDataProducer<Integer, TileExternalStorage>() {
|
||||
@Override
|
||||
public Integer getValue(TileExternalStorage tile) {
|
||||
return tile.getStored();
|
||||
}
|
||||
});
|
||||
|
||||
public static final TileDataParameter CAPACITY = TileDataManager.createParameter(DataSerializers.VARINT, new ITileDataProducer<Integer, TileExternalStorage>() {
|
||||
public static final TileDataParameter<Integer> CAPACITY = TileDataManager.createParameter(DataSerializers.VARINT, new ITileDataProducer<Integer, TileExternalStorage>() {
|
||||
@Override
|
||||
public Integer getValue(TileExternalStorage tile) {
|
||||
return tile.getCapacity();
|
||||
|
||||
Reference in New Issue
Block a user