feat: basic node synergy
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Timo Ley 2023-01-21 22:58:54 +01:00
parent 6ffec2106c
commit eb7c01ad7b
9 changed files with 109 additions and 1 deletions

7
LICENSE Normal file
View File

@ -0,0 +1,7 @@
Copyright 2023 Timo Ley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -79,6 +79,8 @@ public class AuraCore {
ConfigBlocks.blockCrystal.setTickRandomly(true);
Recipes.initRecipes();
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
thaumcraft.common.config.Config.genStructure = false;
thaumcraft.common.config.Config.genAura = false;
}
@Mod.EventHandler

View File

@ -10,10 +10,12 @@ public class Config {
private static Configuration config = new Configuration(new File(Loader.instance().getConfigDir(), "AuraCore.cfg"));
public static int nodeRarity = 23;
public static int specialNodeRarity = 75;
public static int newNodeRarity = 20;
public static boolean replaceSilverwood = true;
public static boolean knowAllAspects = true;
public static boolean replaceAspects = true;
public static boolean legacyAspects = false;
public static boolean generateEldritchRing = true;
public static boolean noScanning() {
return knowAllAspects;
@ -23,10 +25,12 @@ public class Config {
config.load();
nodeRarity = config.get("worldgen", "nodeRarity", nodeRarity).getInt(nodeRarity);
specialNodeRarity = config.get("worldgen", "specialNodeRarity", specialNodeRarity).getInt(specialNodeRarity);
newNodeRarity = config.getInt("newNodeRarity", "worldgen", newNodeRarity, -1, Integer.MAX_VALUE, "Rarity of TC4 nodes generating instead of TC3 nodes (-1 to disable TC4 nodes)");
replaceSilverwood = config.getBoolean("replaceSilverwood", "worldgen", replaceSilverwood, "Replace Silverwood trees with TC3 Silverwood");
knowAllAspects = config.getBoolean("knowAllAspects", "research", knowAllAspects, "Know all Aspects from beginning");
replaceAspects = config.getBoolean("replaceAspects", "client", replaceAspects, "Replace some aspect textures");
legacyAspects = config.getBoolean("legacyAspects", "aspects", legacyAspects, "Use TC3 item aspects");
generateEldritchRing = config.getBoolean("generateEldritchRing", "worldgen", generateEldritchRing, "Generate Eldritch Ring structures");
config.save();
}

View File

@ -33,6 +33,7 @@ public class AuraManagerClient {
public boolean lock;
public byte type;
public int dimension;
public boolean isVirtual;
public NodeStats(AuraPacket packet, int dimension) {
key = packet.key;
@ -46,6 +47,7 @@ public class AuraManagerClient {
lock = packet.lock;
type = packet.type;
this.dimension = dimension;
this.isVirtual = packet.virtual;
}
}

View File

@ -56,6 +56,7 @@ public class RenderEventHandler {
int limit = 0;
Collection<NodeStats> col = AuraManagerClient.auraClientList.values();
for (NodeStats l : col) {
if (l.isVirtual) continue;
float px = (float) l.x;
float py = (float) l.y;
float pz = (float) l.z;

View File

@ -0,0 +1,65 @@
package dev.tilera.auracore.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import dev.tilera.auracore.api.EnumNodeType;
import dev.tilera.auracore.aura.AuraManager;
import net.minecraft.nbt.NBTTagCompound;
import thaumcraft.api.TileThaumcraft;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.nodes.NodeType;
import thaumcraft.common.tiles.TileNode;
@Mixin(TileNode.class)
public abstract class MixinTileNode extends TileThaumcraft {
@Shadow(remap = false)
private NodeType nodeType;
@Shadow(remap = false)
AspectList aspectsBase;
int virtualNodeID = -1;
@Inject(method = "writeCustomNBT", at = @At("HEAD"), remap = false)
public void onNBTWrite(NBTTagCompound nbt, CallbackInfo ci) {
nbt.setInteger("virtualNodeID", this.virtualNodeID);
}
@Inject(method = "readCustomNBT", at = @At("HEAD"), remap = false)
public void onNBTRead(NBTTagCompound nbt, CallbackInfo ci) {
if (nbt.hasKey("virtualNodeID")) {
this.virtualNodeID = nbt.getInteger("virtualNodeID");
}
}
@Inject(method = "updateEntity", at = @At("HEAD"))
public void onTick(CallbackInfo ci) {
if (virtualNodeID == -1) {
this.createVirtualNode();
}
}
private void createVirtualNode() {
EnumNodeType type = convertNodeType(nodeType);
virtualNodeID = AuraManager.registerAuraNode(this.worldObj, (short)aspectsBase.visSize(), type, this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, true);
}
private static EnumNodeType convertNodeType(NodeType type) {
switch (type) {
case TAINTED:
case DARK:
return EnumNodeType.DARK;
case PURE:
return EnumNodeType.PURE;
case HUNGRY:
case UNSTABLE:
return EnumNodeType.UNSTABLE;
default:
return EnumNodeType.NORMAL;
}
}
}

View File

@ -16,6 +16,7 @@ public class AuraPacket implements IMessage {
public int flux;
public boolean lock;
public byte type;
public boolean virtual;
public AuraPacket() {}
@ -30,6 +31,7 @@ public class AuraPacket implements IMessage {
this.flux = node.flux.visSize();
this.lock = node.locked;
this.type = (byte) node.type.ordinal();
this.virtual = node.isVirtual;
}
@Override
@ -44,6 +46,7 @@ public class AuraPacket implements IMessage {
this.flux = buf.readInt();
this.lock = buf.readBoolean();
this.type = buf.readByte();
this.virtual = buf.readBoolean();
}
@Override
@ -58,6 +61,7 @@ public class AuraPacket implements IMessage {
buf.writeInt(flux);
buf.writeBoolean(lock);
buf.writeByte(type);
buf.writeBoolean(virtual);
}
}

View File

@ -18,8 +18,11 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
import thaumcraft.common.lib.world.WorldGenEldritchRing;
import thaumcraft.common.lib.world.WorldGenHilltopStones;
import thaumcraft.common.lib.world.WorldGenMound;
import thaumcraft.common.lib.world.dim.MazeThread;
public class WorldGenerator implements IWorldGenerator {
@ -65,6 +68,21 @@ public class WorldGenerator implements IWorldGenerator {
int value = random.nextInt(200) + 400;
AuraManager.registerAuraNode(world, (short)value, EnumNodeType.DARK, world.provider.dimensionId, randPosX2 + 9, randPosY + 8, randPosZ2 + 9);
}
} else if (Config.generateEldritchRing && random.nextInt(66) == 0) {
WorldGenEldritchRing stonering = new WorldGenEldritchRing();
randPosY += 8;
int w = 11 + random.nextInt(6) * 2;
int h = 11 + random.nextInt(6) * 2;
stonering.chunkX = chunkX;
stonering.chunkZ = chunkZ;
stonering.width = w;
stonering.height = h;
if (stonering.generate(world, random, randPosX2, randPosY, randPosZ2)) {
auraGen = true;
ThaumcraftWorldGenerator.createRandomNodeAt(world, randPosX2, randPosY + 2, randPosZ2, random, false, true, false);
Thread t = new Thread(new MazeThread(chunkX, chunkZ, w, h, random.nextLong()));
t.start();
}
} else {
WorldGenHilltopStones hilltopStones = new WorldGenHilltopStones();
if (random.nextInt(3) == 0 && !AuraManager.specificAuraTypeNearby(world.provider.dimensionId, randPosX2, randPosY += 9, randPosZ2, EnumNodeType.UNSTABLE, 250) && hilltopStones.generate(world, random, randPosX2, randPosY, randPosZ2)) {
@ -162,7 +180,11 @@ public class WorldGenerator implements IWorldGenerator {
}
}
}
AuraManager.registerAuraNode(world, (short)value, type, world.provider.dimensionId, x, y, z);
if (Config.newNodeRarity > 0 && random.nextInt(Config.newNodeRarity) == 0) {
ThaumcraftWorldGenerator.createRandomNodeAt(world, x, y, z, random, false, false, false);
} else {
AuraManager.registerAuraNode(world, (short)value, type, world.provider.dimensionId, x, y, z);
}
return true;
}
return false;

View File

@ -13,6 +13,7 @@
"MixinTileJarFillable",
"MixinTileAlembic",
"MixinTileResearchTable",
"MixinTileNode",
"MixinBlockCustomPlant",
"MixinBlockCustomOre",
"MixinBlockTable",