Add constructor destructor model, fix issue with setting storage on client

This commit is contained in:
Raoul Van den Berge
2016-07-10 21:48:32 +02:00
parent a57e9e8e9b
commit f9c4eb4def
14 changed files with 1352 additions and 36 deletions

View File

@@ -43,7 +43,7 @@ public abstract class NBTStorage implements IStorage {
/**
* @param tag The NBT tag we are reading from and writing the amount stored to, has to be initialized with {@link NBTStorage#createNBT()} if it doesn't exist yet
* @param capacity The capacity of this storage, -1 for infinite capacity
* @param tile A {@link TileEntity} that the NBT storage is in, will be marked dirty when storage changes
* @param tile A {@link TileEntity} that the NBT storage is in, will be marked dirty when the storage changes
*/
public NBTStorage(NBTTagCompound tag, int capacity, @Nullable TileEntity tile) {
this.tag = tag;

View File

@@ -12,7 +12,7 @@ import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageGui;
import refinedstorage.tile.TileConstructor;
public class BlockConstructor extends BlockNode {
public class BlockConstructor extends BlockCable {
public BlockConstructor() {
super("constructor");
}

View File

@@ -12,7 +12,7 @@ import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageGui;
import refinedstorage.tile.TileDestructor;
public class BlockDestructor extends BlockNode {
public class BlockDestructor extends BlockCable {
public BlockDestructor() {
super("destructor");
}

View File

@@ -6,6 +6,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
@@ -56,16 +58,21 @@ public class TileDiskDrive extends TileNode implements IStorageProvider, IStorag
protected void onContentsChanged(int slot) {
super.onContentsChanged(slot);
ItemStack disk = getStackInSlot(slot);
/**
* Can't use {@link net.minecraft.world.World#isRemote} here because when {@link TileDiskDrive#readFromNBT(NBTTagCompound)} is called there is no world set yet.
*/
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
ItemStack disk = getStackInSlot(slot);
if (disk == null) {
storages[slot] = null;
} else {
storages[slot] = new Storage(disk);
}
if (disk == null) {
storages[slot] = null;
} else {
storages[slot] = new Storage(disk);
}
if (network != null) {
network.getStorage().rebuild();
if (network != null) {
network.getStorage().rebuild();
}
}
}

View File

@@ -1,38 +1,80 @@
{
"forge_marker": 1,
"defaults": {
"model": "orientable",
"textures": {
"side": "refinedstorage:blocks/side",
"top": "refinedstorage:blocks/side",
"front": "refinedstorage:blocks/constructor"
}
"all": "refinedstorage:blocks/cable",
"particle": "refinedstorage:blocks/cable"
},
"model": "refinedstorage:cable_core",
"uvlock": true
},
"variants": {
"inventory": [
{
"y": 0,
"model": "refinedstorage:constructor_destructor",
"transform": "forge:default-block"
}
],
"direction": {
"north": {
"y": 0
"submodel": "refinedstorage:constructor_destructor_north"
},
"east": {
"y": 90
"submodel": "refinedstorage:constructor_destructor_east"
},
"south": {
"y": 180
"submodel": "refinedstorage:constructor_destructor_south"
},
"west": {
"y": 270
"submodel": "refinedstorage:constructor_destructor_west"
},
"up": {
"x": 270
"submodel": "refinedstorage:constructor_destructor_up"
},
"down": {
"x": 90
"submodel": "refinedstorage:constructor_destructor_down"
}
},
"north": {
"true": {
"submodel": "refinedstorage:cable_north"
},
"false": {
}
},
"east": {
"true": {
"submodel": "refinedstorage:cable_east"
},
"false": {
}
},
"south": {
"true": {
"submodel": "refinedstorage:cable_south"
},
"false": {
}
},
"west": {
"true": {
"submodel": "refinedstorage:cable_west"
},
"false": {
}
},
"up": {
"true": {
"submodel": "refinedstorage:cable_up"
},
"false": {
}
},
"down": {
"true": {
"submodel": "refinedstorage:cable_down"
},
"false": {
}
}
}

View File

@@ -1,38 +1,80 @@
{
"forge_marker": 1,
"defaults": {
"model": "orientable",
"textures": {
"side": "refinedstorage:blocks/side",
"top": "refinedstorage:blocks/side",
"front": "refinedstorage:blocks/destructor"
}
"all": "refinedstorage:blocks/cable",
"particle": "refinedstorage:blocks/cable"
},
"model": "refinedstorage:cable_core",
"uvlock": true
},
"variants": {
"inventory": [
{
"y": 0,
"model": "refinedstorage:constructor_destructor",
"transform": "forge:default-block"
}
],
"direction": {
"north": {
"y": 0
"submodel": "refinedstorage:constructor_destructor_north"
},
"east": {
"y": 90
"submodel": "refinedstorage:constructor_destructor_east"
},
"south": {
"y": 180
"submodel": "refinedstorage:constructor_destructor_south"
},
"west": {
"y": 270
"submodel": "refinedstorage:constructor_destructor_west"
},
"up": {
"x": 270
"submodel": "refinedstorage:constructor_destructor_up"
},
"down": {
"x": 90
"submodel": "refinedstorage:constructor_destructor_down"
}
},
"north": {
"true": {
"submodel": "refinedstorage:cable_north"
},
"false": {
}
},
"east": {
"true": {
"submodel": "refinedstorage:cable_east"
},
"false": {
}
},
"south": {
"true": {
"submodel": "refinedstorage:cable_south"
},
"false": {
}
},
"west": {
"true": {
"submodel": "refinedstorage:cable_west"
},
"false": {
}
},
"up": {
"true": {
"submodel": "refinedstorage:cable_up"
},
"false": {
}
},
"down": {
"true": {
"submodel": "refinedstorage:cable_down"
},
"false": {
}
}
}

View File

@@ -0,0 +1,350 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"elements": [
{
"name": "Line1",
"from": [
7.0,
7.0,
2.0
],
"to": [
9.0,
9.0,
6.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
0.0,
0.0
],
"to": [
16.0,
16.0,
2.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
},
{
"name": "Core",
"from": [
6.0,
6.0,
6.0
],
"to": [
10.0,
10.0,
10.0
],
"faces": {
"north": {
"texture": "#all",
"uv": [
4.0,
4.0,
8.0,
8.0
]
},
"east": {
"texture": "#all",
"uv": [
0.0,
4.0,
4.0,
8.0
]
},
"south": {
"texture": "#all",
"uv": [
12.0,
4.0,
16.0,
8.0
]
},
"west": {
"texture": "#all",
"uv": [
8.0,
4.0,
12.0,
8.0
]
},
"up": {
"texture": "#all",
"uv": [
8.0,
4.0,
4.0,
0.0
]
},
"down": {
"texture": "#all",
"uv": [
12.0,
0.0,
8.0,
4.0
]
}
}
},
{
"name": "East",
"from": [
10.0,
6.0,
6.0
],
"to": [
16.0,
10.0,
10.0
],
"faces": {
"north": {
"texture": "#all",
"uv": [
4.0,
4.0,
8.0,
8.0
]
},
"east": {
"texture": "#all",
"uv": [
0.0,
4.0,
4.0,
8.0
]
},
"south": {
"texture": "#all",
"uv": [
12.0,
4.0,
16.0,
8.0
]
},
"west": {
"texture": "#all",
"uv": [
8.0,
4.0,
12.0,
8.0
]
},
"up": {
"texture": "#all",
"uv": [
8.0,
4.0,
4.0,
0.0
]
},
"down": {
"texture": "#all",
"uv": [
12.0,
0.0,
8.0,
4.0
]
}
}
},
{
"name": "West",
"from": [
0.0,
6.0,
6.0
],
"to": [
6.0,
10.0,
10.0
],
"faces": {
"north": {
"texture": "#all",
"uv": [
4.0,
4.0,
8.0,
8.0
]
},
"east": {
"texture": "#all",
"uv": [
0.0,
4.0,
4.0,
8.0
]
},
"south": {
"texture": "#all",
"uv": [
12.0,
4.0,
16.0,
8.0
]
},
"west": {
"texture": "#all",
"uv": [
8.0,
4.0,
12.0,
8.0
]
},
"up": {
"texture": "#all",
"uv": [
8.0,
4.0,
4.0,
0.0
]
},
"down": {
"texture": "#all",
"uv": [
12.0,
0.0,
8.0,
4.0
]
}
}
}
]
}

View File

@@ -0,0 +1,145 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
},
"elements": [
{
"name": "Line1",
"from": [
7.0,
2.0,
7.0
],
"to": [
9.0,
6.0,
9.0
],
"faces": {
"north": {
"texture": "#ine",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#ine",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#ine",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#ine",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#ine",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#ine",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
0.0,
0.0
],
"to": [
16.0,
2.0,
16.0
],
"faces": {
"north": {
"texture": "#ine",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#ine",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#ine",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#ine",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#ine",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#ine",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
}
]
}

View File

@@ -0,0 +1,145 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
},
"elements": [
{
"name": "Line1",
"from": [
10.0,
7.0,
7.0
],
"to": [
14.0,
9.0,
9.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
14.0,
0.0,
0.0
],
"to": [
16.0,
16.0,
16.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
}
]
}

View File

@@ -0,0 +1,145 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
},
"elements": [
{
"name": "Line1",
"from": [
7.0,
7.0,
2.0
],
"to": [
9.0,
9.0,
6.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
0.0,
0.0
],
"to": [
16.0,
16.0,
2.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
}
]
}

View File

@@ -0,0 +1,145 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
},
"elements": [
{
"name": "Line1",
"from": [
7.0,
7.0,
10.0
],
"to": [
9.0,
9.0,
14.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
0.0,
14.0
],
"to": [
16.0,
16.0,
16.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
}
]
}

View File

@@ -0,0 +1,145 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
},
"elements": [
{
"name": "Line1",
"from": [
7.0,
10.0,
7.0
],
"to": [
9.0,
14.0,
9.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
14.0,
0.0
],
"to": [
16.0,
16.0,
16.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
}
]
}

View File

@@ -0,0 +1,145 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
},
"elements": [
{
"name": "Line1",
"from": [
2.0,
7.0,
7.0
],
"to": [
6.0,
9.0,
9.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
4.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
4.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
4.0,
2.0
]
}
}
},
{
"name": "Line2",
"from": [
0.0,
0.0,
0.0
],
"to": [
2.0,
16.0,
16.0
],
"faces": {
"north": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"east": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"south": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
10.0
]
},
"west": {
"texture": "#line",
"uv": [
0.0,
0.0,
2.0,
10.0
]
},
"up": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
},
"down": {
"texture": "#line",
"uv": [
0.0,
0.0,
10.0,
2.0
]
}
}
}
]
}