Decreased amount of block updates significantly
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
**Features**
|
||||
- Re-added Controllers exploding when two of them are connected to the same network
|
||||
- Limited some blocks to only have a direction on the x-axis
|
||||
- Decreased amount of block updates significantly
|
||||
|
||||
### 0.8.5
|
||||
**Bugfixes**
|
||||
|
@@ -11,11 +11,6 @@ public interface INetworkNode {
|
||||
*/
|
||||
void updateNode();
|
||||
|
||||
/**
|
||||
* @return If this node can send a connectivity update
|
||||
*/
|
||||
boolean canSendConnectivityUpdate();
|
||||
|
||||
/**
|
||||
* @return The energy usage of this node
|
||||
*/
|
||||
|
@@ -35,7 +35,7 @@ public class BlockCable extends BlockNode {
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer.Builder(this)
|
||||
return createBlockStateBuilder()
|
||||
.add(NORTH)
|
||||
.add(EAST)
|
||||
.add(SOUTH)
|
||||
@@ -47,7 +47,8 @@ public class BlockCable extends BlockNode {
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return state.withProperty(NORTH, hasConnectionWith(world, pos.north()))
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(NORTH, hasConnectionWith(world, pos.north()))
|
||||
.withProperty(EAST, hasConnectionWith(world, pos.east()))
|
||||
.withProperty(SOUTH, hasConnectionWith(world, pos.south()))
|
||||
.withProperty(WEST, hasConnectionWith(world, pos.west()))
|
||||
|
@@ -35,4 +35,8 @@ public class BlockCrafter extends BlockNode {
|
||||
public EnumDirectionType getDirectionType() {
|
||||
return EnumDirectionType.ANY;
|
||||
}
|
||||
|
||||
public boolean canRetrieveConnectivityUpdate() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -30,4 +30,8 @@ public class BlockCraftingMonitor extends BlockNode {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canRetrieveConnectivityUpdate() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -70,4 +70,8 @@ public class BlockGrid extends BlockNode {
|
||||
public Item createItem() {
|
||||
return new ItemBlockBase(this, true);
|
||||
}
|
||||
|
||||
public boolean canRetrieveConnectivityUpdate() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -25,9 +25,19 @@ public abstract class BlockNode extends BlockBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canRetrieveConnectivityUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer.Builder createBlockStateBuilder() {
|
||||
return super.createBlockStateBuilder().add(CONNECTED);
|
||||
BlockStateContainer.Builder builder = super.createBlockStateBuilder();
|
||||
|
||||
if (canRetrieveConnectivityUpdate()) {
|
||||
builder.add(CONNECTED);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,8 +47,11 @@ public abstract class BlockNode extends BlockBase {
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(CONNECTED, ((TileNode) world.getTileEntity(pos)).isConnected());
|
||||
if (canRetrieveConnectivityUpdate()) {
|
||||
return super.getActualState(state, world, pos).withProperty(CONNECTED, ((TileNode) world.getTileEntity(pos)).isConnected());
|
||||
}
|
||||
|
||||
return super.getActualState(state, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -35,4 +35,8 @@ public class BlockRelay extends BlockNode {
|
||||
public EnumDirectionType getDirectionType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canRetrieveConnectivityUpdate() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,8 @@ public class BlockStorage extends BlockNode {
|
||||
|
||||
public BlockStorage() {
|
||||
super("storage");
|
||||
|
||||
setHardness(2.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -30,4 +30,8 @@ public class BlockWirelessTransmitter extends BlockNode {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canRetrieveConnectivityUpdate() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ package refinedstorage.proxy;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -102,11 +101,6 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.UPGRADE, ItemUpgrade.TYPE_STACK, new ModelResourceLocation("refinedstorage:stack_upgrade", "inventory"));
|
||||
|
||||
// Blocks
|
||||
ModelLoader.setCustomStateMapper(RefinedStorageBlocks.STORAGE, (new StateMap.Builder())
|
||||
.ignore(RefinedStorageBlocks.STORAGE.CONNECTED)
|
||||
.build()
|
||||
);
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CABLE), 0, new ModelResourceLocation("refinedstorage:cable", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.NORMAL.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.GRID), EnumGridType.CRAFTING.getId(), new ModelResourceLocation("refinedstorage:grid", "inventory"));
|
||||
|
@@ -14,11 +14,6 @@ public class TileCable extends TileNode {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSendConnectivityUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Container> getContainer() {
|
||||
return null;
|
||||
|
@@ -1,11 +1,13 @@
|
||||
package refinedstorage.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import refinedstorage.RefinedStorageUtils;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.INetworkNode;
|
||||
import refinedstorage.block.BlockNode;
|
||||
import refinedstorage.tile.config.IRedstoneModeConfig;
|
||||
import refinedstorage.tile.config.RedstoneMode;
|
||||
|
||||
@@ -28,9 +30,10 @@ public abstract class TileNode extends TileBase implements INetworkNode, ISynchr
|
||||
return isConnected() && canUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSendConnectivityUpdate() {
|
||||
return true;
|
||||
private boolean canRetrieveConnectivityUpdate() {
|
||||
Block block = getBlockType();
|
||||
|
||||
return block instanceof BlockNode ? ((BlockNode) block).canRetrieveConnectivityUpdate() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +45,7 @@ public abstract class TileNode extends TileBase implements INetworkNode, ISynchr
|
||||
onConnectionChange(network, update);
|
||||
}
|
||||
|
||||
if (active != isActive() && canSendConnectivityUpdate()) {
|
||||
if (active != isActive() && canRetrieveConnectivityUpdate()) {
|
||||
RefinedStorageUtils.updateBlock(worldObj, pos);
|
||||
|
||||
active = isActive();
|
||||
@@ -144,7 +147,9 @@ public abstract class TileNode extends TileBase implements INetworkNode, ISynchr
|
||||
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
|
||||
super.writeUpdate(tag);
|
||||
|
||||
tag.setBoolean(NBT_CONNECTED, isActive());
|
||||
if (canRetrieveConnectivityUpdate()) {
|
||||
tag.setBoolean(NBT_CONNECTED, isActive());
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
@@ -152,6 +157,8 @@ public abstract class TileNode extends TileBase implements INetworkNode, ISynchr
|
||||
public void readUpdate(NBTTagCompound tag) {
|
||||
super.readUpdate(tag);
|
||||
|
||||
connected = tag.getBoolean(NBT_CONNECTED);
|
||||
if (canRetrieveConnectivityUpdate()) {
|
||||
connected = tag.getBoolean(NBT_CONNECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"powered": {
|
||||
"true": {
|
||||
"textures": {
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
|
@@ -12,11 +12,8 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
"normal": {
|
||||
"model": "cube_all"
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,12 +15,6 @@
|
||||
"transform": "forge:default-block"
|
||||
}
|
||||
],
|
||||
"connected": {
|
||||
"true": {
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"working": {
|
||||
"true": {
|
||||
"textures": {
|
||||
|
Reference in New Issue
Block a user