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