mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
708bbb5512 | ||
|
|
981305290a | ||
|
|
b6284e20dc | ||
|
|
2026024920 |
No files matched your search
+13
-1
@@ -14,8 +14,13 @@ import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal
|
||||
public class BuildingSchematic {
|
||||
|
||||
public final String name;
|
||||
public final int buildingType = DemonBuilding.BUILDING_HOUSE;
|
||||
public final List<BlockSet> blockList = new ArrayList<>();
|
||||
// Set by GSON when reading structure schematics, do not remove
|
||||
public int doorX = 0;
|
||||
public int doorZ = 0;
|
||||
public int doorY = 0;
|
||||
public int buildingTier = 0;
|
||||
public int buildingType = DemonBuilding.BUILDING_HOUSE;
|
||||
|
||||
public BuildingSchematic() {
|
||||
this("");
|
||||
@@ -60,6 +65,13 @@ public class BuildingSchematic {
|
||||
return holder;
|
||||
}
|
||||
|
||||
public Int3 getGridSpotOfDoor() {
|
||||
int gridX = (int) ((doorX + 2 * Math.signum(doorX)) / 5);
|
||||
int gridZ = (int) ((doorZ + 2 * Math.signum(doorZ)) / 5);
|
||||
|
||||
return new Int3(gridX, doorY, gridZ);
|
||||
}
|
||||
|
||||
public List<Int3> getGriddedPositions(ForgeDirection dir) {
|
||||
List<Int3> positionList = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ public class DemonBuilding {
|
||||
public DemonBuilding(BuildingSchematic schematic) {
|
||||
this.schematic = schematic;
|
||||
this.buildingType = schematic.buildingType;
|
||||
this.buildingTier = 0;
|
||||
this.buildingTier = schematic.buildingTier;
|
||||
this.area = this.createGSHForSchematic(schematic);
|
||||
this.doorGridSpace = new Int3(0, 0, 0);
|
||||
this.doorGridSpace = schematic.getGridSpotOfDoor();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -67,18 +67,10 @@ public class DemonBuilding {
|
||||
int z = doorSpace.z();
|
||||
|
||||
switch (sideOfRoad) {
|
||||
case SOUTH:
|
||||
z++;
|
||||
break;
|
||||
case EAST:
|
||||
x++;
|
||||
break;
|
||||
case WEST:
|
||||
x--;
|
||||
break;
|
||||
default:
|
||||
z--;
|
||||
break;
|
||||
case SOUTH -> z++;
|
||||
case EAST -> x++;
|
||||
case WEST -> x--;
|
||||
default -> z--;
|
||||
}
|
||||
|
||||
return new Int3(x, yLevel, z);
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
|
||||
public class Int3Adapter extends TypeAdapter<Int3> {
|
||||
|
||||
@Override
|
||||
public Int3 read(JsonReader reader) throws IOException {
|
||||
int x = 0, y = 0, z = 0;
|
||||
|
||||
reader.beginObject();
|
||||
while (reader.hasNext()) {
|
||||
switch (reader.nextName()) {
|
||||
case "xCoord" -> x = reader.nextInt();
|
||||
case "yCoord" -> y = reader.nextInt();
|
||||
case "zCoord" -> z = reader.nextInt();
|
||||
default -> reader.skipValue();
|
||||
}
|
||||
}
|
||||
reader.endObject();
|
||||
|
||||
return new Int3(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonWriter writer, Int3 int3) throws IOException {
|
||||
writer.beginObject();
|
||||
writer.name("xCoord").value(int3.x());
|
||||
writer.name("yCoord").value(int3.y());
|
||||
writer.name("zCoord").value(int3.z());
|
||||
writer.endObject();
|
||||
}
|
||||
}
|
||||
+14
-18
@@ -945,23 +945,19 @@ public class TEDemonPortal extends TileEntity {
|
||||
}
|
||||
|
||||
public void rightClickBlock(EntityPlayer player, int side) {
|
||||
// if (worldObj.isRemote)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// this.initialize();
|
||||
//
|
||||
// if (ForgeDirection.getOrientation(side) == ForgeDirection.UP)
|
||||
// {
|
||||
// this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0);
|
||||
// } else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
// {
|
||||
// this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0);
|
||||
// } else
|
||||
// {
|
||||
// this.createRandomRoad();
|
||||
// }
|
||||
if (worldObj.isRemote || !player.capabilities.isCreativeMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.initialize();
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP) {
|
||||
this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0);
|
||||
} else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0);
|
||||
} else {
|
||||
this.createRandomRoad();
|
||||
}
|
||||
}
|
||||
|
||||
public int createRandomBuilding(int type, int tier) {
|
||||
@@ -1281,7 +1277,7 @@ public class TEDemonPortal extends TileEntity {
|
||||
|
||||
public static void loadBuildingList() {
|
||||
String folder = "config/BloodMagic/schematics";
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(Int3.class, new Int3Adapter()).create();
|
||||
|
||||
File file = new File(folder);
|
||||
File[] files = file.listFiles();
|
||||
|
||||
@@ -103,7 +103,6 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
int z = posZ + k;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (BoundPickaxe.checkPermissions(world, x, y, z, block, meta, player)) continue;
|
||||
|
||||
if (block == null || block.getBlockHardness(world, x, y, z) == -1
|
||||
|| !world.canMineBlock(player, x, y, z)) {
|
||||
@@ -111,7 +110,8 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
||||
}
|
||||
|
||||
// getStrVsBlock
|
||||
if (func_150893_a(item, block) <= 1f && !(block instanceof BlockLeavesBase)) {
|
||||
if ((func_150893_a(item, block) <= 1f && !(block instanceof BlockLeavesBase))
|
||||
|| BoundPickaxe.checkPermissions(world, x, y, z, block, meta, player)) {
|
||||
continue;
|
||||
}
|
||||
if (silkTouch && block.canSilkHarvest(world, player, x, y, z, meta)) {
|
||||
|
||||
@@ -111,7 +111,6 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
int z = posZ + k;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (checkPermissions(world, x, y, z, block, meta, player)) continue;
|
||||
|
||||
if (block == null || block.getBlockHardness(world, x, y, z) == -1
|
||||
|| !world.canMineBlock(player, x, y, z)) {
|
||||
@@ -119,7 +118,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
||||
}
|
||||
|
||||
// getStrVsBlock
|
||||
if (func_150893_a(item, block) <= 1f) {
|
||||
if (func_150893_a(item, block) <= 1f || checkPermissions(world, x, y, z, block, meta, player)) {
|
||||
continue;
|
||||
}
|
||||
if (silkTouch && block.canSilkHarvest(world, player, x, y, z, meta)) {
|
||||
|
||||
@@ -114,7 +114,8 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
||||
}
|
||||
|
||||
// getStrVsBlock
|
||||
if (func_150893_a(item, block) <= 1f) {
|
||||
if (func_150893_a(item, block) <= 1f
|
||||
|| BoundPickaxe.checkPermissions(world, x, y, z, block, meta, player)) {
|
||||
continue;
|
||||
}
|
||||
if (silkTouch && block.canSilkHarvest(world, player, x, y, z, meta)) {
|
||||
|
||||
@@ -206,7 +206,7 @@ public class RitualEffectMagnetic extends RitualEffect {
|
||||
public int getRadiusForReagents(boolean hasTerrae, boolean hasOrbisTerrae) {
|
||||
if (hasTerrae) {
|
||||
if (hasOrbisTerrae) {
|
||||
return 31;
|
||||
return 34;
|
||||
} else {
|
||||
return 7;
|
||||
}
|
||||
|
||||
+2
-3
@@ -62,9 +62,8 @@ public class DigAreaEffect implements IDigAreaEffect {
|
||||
|
||||
float localHardness = block.getBlockHardness(world, x, y, z);
|
||||
|
||||
if (localHardness - this.getHardnessDifference() > blockHardness
|
||||
|| BoundPickaxe.checkPermissions(world, x, y, z, block, meta, player)
|
||||
|| localHardness < 0) {
|
||||
if (localHardness < 0 || localHardness - this.getHardnessDifference() > blockHardness
|
||||
|| BoundPickaxe.checkPermissions(world, x, y, z, block, meta, player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
consumptionMultiplier = 0;
|
||||
efficiencyMultiplier = 0;
|
||||
capacityMultiplier = 1;
|
||||
orbCapacityMultiplier = 1;
|
||||
isUpgraded = false;
|
||||
upgradeLevel = 0;
|
||||
isResultBlock = false;
|
||||
|
||||
@@ -14,7 +14,9 @@ import com.google.gson.GsonBuilder;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.BuildingSchematic;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.Int3Adapter;
|
||||
|
||||
public class TESchematicSaver extends TileEntity {
|
||||
|
||||
@@ -42,7 +44,7 @@ public class TESchematicSaver extends TileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(Int3.class, new Int3Adapter()).create();
|
||||
String json = gson.toJson(schematic);
|
||||
try (Writer writer = new FileWriter("config/BloodMagic/schematics/" + new Random().nextInt() + ".json")) {
|
||||
writer.write(json);
|
||||
|
||||
Reference in new issue
Block a user