Small improvements
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- Fixed External Storage disconnecting on world reload
|
||||
- Fixed External Storage not updating correctly
|
||||
- Fixed wireless signal starting from Controller instead of per Wireless Transmitter individually
|
||||
- Fixed Controller's redstone state not saving
|
||||
- Huge performance improvements to large storage networks
|
||||
|
||||
**Features**
|
||||
|
||||
@@ -56,7 +56,7 @@ public abstract class BlockBase extends Block {
|
||||
return createBlockStateBuilder().build();
|
||||
}
|
||||
|
||||
public Item createItemForBlock() {
|
||||
public Item createItem() {
|
||||
return new ItemBlockBase(this, false);
|
||||
}
|
||||
|
||||
@@ -73,11 +73,7 @@ public abstract class BlockBase extends Block {
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if (getDirectionType() != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileBase) {
|
||||
return state.withProperty(DIRECTION, ((TileBase) tile).getDirection());
|
||||
}
|
||||
return state.withProperty(DIRECTION, ((TileBase) world.getTileEntity(pos)).getDirection());
|
||||
}
|
||||
|
||||
return state;
|
||||
@@ -91,15 +87,13 @@ public abstract class BlockBase extends Block {
|
||||
@Override
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||
if (!world.isRemote && getDirectionType() != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
TileBase tile = (TileBase) world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileBase) {
|
||||
((TileBase) tile).setDirection(getDirectionType().getNext(((TileBase) tile).getDirection()));
|
||||
tile.setDirection(getDirectionType().getNext(tile.getDirection()));
|
||||
|
||||
RefinedStorageUtils.updateBlock(world, pos);
|
||||
RefinedStorageUtils.updateBlock(world, pos);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -110,17 +104,15 @@ public abstract class BlockBase extends Block {
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
|
||||
if (getDirectionType() != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
TileBase tile = (TileBase) world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileBase) {
|
||||
EnumFacing facing = getDirectionType().getFrom(pos, player);
|
||||
EnumFacing facing = getDirectionType().getFrom(pos, player);
|
||||
|
||||
if (player.isSneaking() && getDirectionType() == EnumDirectionType.ANY) {
|
||||
facing = facing.getOpposite();
|
||||
}
|
||||
|
||||
((TileBase) tile).setDirection(facing);
|
||||
if (player.isSneaking() && getDirectionType() == EnumDirectionType.ANY) {
|
||||
facing = facing.getOpposite();
|
||||
}
|
||||
|
||||
tile.setDirection(facing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BlockCable extends BlockNode {
|
||||
.withProperty(DOWN, hasConnectionWith(world, pos.down()));
|
||||
}
|
||||
|
||||
public static boolean hasConnectionWith(IBlockAccess world, BlockPos pos) {
|
||||
private boolean hasConnectionWith(IBlockAccess world, BlockPos pos) {
|
||||
return world.getBlockState(pos).getBlock() == RefinedStorageBlocks.CONTROLLER || world.getTileEntity(pos) instanceof INetworkNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class BlockController extends BlockBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createItemForBlock() {
|
||||
public Item createItem() {
|
||||
return new ItemBlockController();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class BlockGrid extends BlockNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createItemForBlock() {
|
||||
public Item createItem() {
|
||||
return new ItemBlockBase(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class BlockStorage extends BlockNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createItemForBlock() {
|
||||
public Item createItem() {
|
||||
return new ItemBlockStorage();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BasicItemHandler extends ItemStackHandler {
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
if (validators.length > 0) {
|
||||
for (IItemValidator validator : validators) {
|
||||
if (validator.valid(stack)) {
|
||||
if (validator.isValid(stack)) {
|
||||
return super.insertItem(slot, stack, simulate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class BasicItemValidator implements IItemValidator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(ItemStack stack) {
|
||||
public boolean isValid(ItemStack stack) {
|
||||
if (stack.getItem() == item) {
|
||||
if (damage != -1 && stack.getItemDamage() != damage) {
|
||||
return false;
|
||||
|
||||
@@ -3,5 +3,5 @@ package refinedstorage.inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemValidator {
|
||||
boolean valid(ItemStack stack);
|
||||
boolean isValid(ItemStack stack);
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ public class CommonProxy {
|
||||
|
||||
private void registerBlock(BlockBase block) {
|
||||
GameRegistry.<Block>register(block);
|
||||
GameRegistry.register(block.createItemForBlock());
|
||||
GameRegistry.register(block.createItem());
|
||||
}
|
||||
|
||||
private void registerItem(Item item) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import refinedstorage.item.ItemUpgrade;
|
||||
public class TileCrafter extends TileNode implements ICraftingPatternContainer {
|
||||
private BasicItemHandler patterns = new BasicItemHandler(9, this, new IItemValidator() {
|
||||
@Override
|
||||
public boolean valid(ItemStack stack) {
|
||||
public boolean isValid(ItemStack stack) {
|
||||
return stack.getItem() == RefinedStorageItems.PATTERN && ItemPattern.isValid(stack);
|
||||
}
|
||||
}) {
|
||||
|
||||
@@ -78,8 +78,7 @@ public class TileSolderer extends TileNode {
|
||||
|
||||
recipe = null;
|
||||
progress = 0;
|
||||
// Don't set working to false yet, wait till the next update because we may have
|
||||
// another stack waiting.
|
||||
// Don't set working to false yet, wait till the next update because we may have another stack waiting.
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user