aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-06-23 17:08:28 +0200
committerbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-06-23 17:08:28 +0200
commit0afcd6ff4c62200307c409dd62b768c3015ead1d (patch)
tree617bdadac1ab6da04d8d96c64356ddc64758a3cc
parent1959a09715b671073379f63e34c2df391635278d (diff)
downloadGT5-Unofficial-0afcd6ff4c62200307c409dd62b768c3015ead1d.tar.gz
GT5-Unofficial-0afcd6ff4c62200307c409dd62b768c3015ead1d.tar.bz2
GT5-Unofficial-0afcd6ff4c62200307c409dd62b768c3015ead1d.zip
Added Build Support for MetaBlocks
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java10
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java5
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java25
3 files changed, 34 insertions, 6 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java
new file mode 100644
index 0000000000..2c783ef268
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomMetaBlock.java
@@ -0,0 +1,10 @@
+package com.github.technus.tectech.mechanics.structure;
+
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+
+public interface ICustomMetaBlock {
+ default void setBlock(World world, int x, int y, int z, int meta){
+ world.setBlock(x, y, z, (Block)this, meta, 2);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java
index 7195563d19..9e680b877e 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java
@@ -237,7 +237,10 @@ public class Structure {
break;
default: //check for block
if ((pointer = block - '0') >= 0) {
- world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2);
+ if (blockType[pointer] instanceof ICustomMetaBlock)
+ ((ICustomMetaBlock)blockType[pointer]).setBlock(world,xyz[0], xyz[1], xyz[2], blockMeta[pointer]);
+ else
+ world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2);
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java
index 04e79ea33b..10779659dc 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java
@@ -293,7 +293,10 @@ public class StructureUtility {
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
+ if (defaultBlock instanceof ICustomMetaBlock)
+ ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta);
+ else
+ world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@@ -326,7 +329,10 @@ public class StructureUtility {
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
+ if (defaultBlock instanceof ICustomMetaBlock)
+ ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta);
+ else
+ world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@@ -351,7 +357,10 @@ public class StructureUtility {
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
+ if (defaultBlock instanceof ICustomMetaBlock)
+ ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta);
+ else
+ world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@@ -384,7 +393,10 @@ public class StructureUtility {
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
+ if (defaultBlock instanceof ICustomMetaBlock)
+ ((ICustomMetaBlock)defaultBlock).setBlock(world, x, y, z, defaultMeta);
+ else
+ world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
return true;
}
@@ -468,7 +480,10 @@ public class StructureUtility {
@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2);
+ if (placeCasing instanceof ICustomMetaBlock)
+ ((ICustomMetaBlock)placeCasing).setBlock(world, x, y, z, placeCasingMeta);
+ else
+ world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2);
return true;
}
};