Compare commits

...

24 commits

Author SHA1 Message Date
Timo Ley 011786e953 Merge remote-tracking branch 'refs/remotes/origin/master'
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2024-05-09 11:39:37 +02:00
Timo Ley f76723b551 chore: port to AnvilLib 2024-05-09 11:37:40 +02:00
Timo Ley b89da88a78 chore: 1.10 beta release
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
continuous-integration/drone Build is passing
2023-06-02 15:43:03 +00:00
Timo Ley 18365c9c85 feat: add vibes
All checks were successful
continuous-integration/drone/push Build is passing
2023-06-02 14:01:30 +02:00
Timo Ley d5e9580367 fix: add balanced shard crystal color 2023-05-28 22:45:18 +02:00
Timo Ley 61cd161d8e feat: add IWandableBlock 2023-05-28 22:45:01 +02:00
Timo Ley 34a38d2160 chore: bump version
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-05-25 22:02:44 +02:00
Timo Ley 3900b28745 fix: crystal count in canHarvest
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-25 22:02:14 +02:00
Timo Ley 725e524497 chore: bump version
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-05-25 21:47:15 +02:00
Timo Ley 78636b0f7f fix: addTaintToClosest
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-25 21:45:46 +02:00
Timo Ley 0349b88293 fix: set current stack to null when changing gui
All checks were successful
continuous-integration/drone/push Build is passing
fixes #7
2023-05-20 21:29:13 +02:00
Timo Ley 4a4798738e feat: add canHarvest to ICrystal
closes #6
2023-05-20 21:27:16 +02:00
Timo Ley 3db4a140e3 fix: generate Silverwood in classic worlds
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-24 17:08:54 +01:00
Timo Ley e5587ebd31 chore: bump version 2023-03-15 16:40:31 +01:00
Timo Ley 3005fdba58 fix: add auram aspect to essence
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-14 16:29:08 +01:00
Timo Ley 5f9630e891 chore: update capes code
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-28 19:18:59 +01:00
Timo Ley 16fea97234 fix: structure node bedrock bug
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-02-08 22:14:39 +01:00
Timo Ley 9db42fb0db fix: rare double aura in desert temples
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-02-08 16:53:36 +01:00
Timo Ley d9a56272f7 fix: structure nodes sometimes generate at bedrock
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-02-07 19:18:28 +01:00
Timo Ley 98b73ac9da fix: thaumonomicon page link
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-02-03 20:50:47 +01:00
Timo Ley 7b65a2a51a chore: revert auto version
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-02-01 16:42:17 +01:00
Timo Ley 39d0bcd8e0 chore: get version from tag
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is failing
2023-02-01 16:40:06 +01:00
Timo Ley 244ca15f40 fix: markDirty abstract method exception 2023-02-01 16:39:25 +01:00
Timo Ley a367fe8f6c fix: mixin remap
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-02-01 16:07:52 +01:00
29 changed files with 361 additions and 154 deletions

View file

@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = "1.8.2"
version = "1.10.0-beta-1"
group= "dev.tilera"
archivesBaseName = "auracore"
@ -37,11 +37,13 @@ minecraft {
}
repositories {
mavenLocal()
maven { url = "https://maven.tilera.xyz" }
maven { url = "https://jitpack.io" }
}
dependencies {
implementation "net.anvilcraft:anvillib-7:0.1.0:deobf"
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
annotationProcessor "com.github.tox1cozZ:mixin-booter-legacy:1.1.2:processor"

View file

@ -9,9 +9,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import dev.tilera.auracore.api.Aspects;
import dev.tilera.auracore.aura.AuraCalculationThread;
import dev.tilera.auracore.aura.AuraDeleteThread;
@ -21,15 +19,12 @@ import dev.tilera.auracore.aura.AuraWorldTicker;
import dev.tilera.auracore.client.GUITicker;
import dev.tilera.auracore.client.RenderEventHandler;
import dev.tilera.auracore.network.AuraDeletePacket;
import dev.tilera.auracore.network.AuraDeletePacketHandler;
import dev.tilera.auracore.network.AuraPacket;
import dev.tilera.auracore.network.AuraPacketHandler;
import dev.tilera.auracore.network.AuraTransferFXPacket;
import dev.tilera.auracore.network.AuraTransferFXPacketHandler;
import dev.tilera.auracore.network.NodeZapPacket;
import dev.tilera.auracore.network.NodeZapPacketHandler;
import dev.tilera.auracore.proxy.CommonProxy;
import dev.tilera.auracore.world.WorldGenerator;
import net.anvilcraft.anvillib.network.AnvilChannel;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import thaumcraft.api.ThaumcraftApi;
@ -38,10 +33,10 @@ import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
@Mod(modid = "auracore", name = "AuraCore", version = "{VERSION}", dependencies = "required-after:Thaumcraft;after:MagicBees")
@Mod(modid = "auracore", name = "AuraCore", version = "{VERSION}", dependencies = "required-after:anvillib;required-after:Thaumcraft;after:MagicBees")
public class AuraCore {
public static SimpleNetworkWrapper CHANNEL;
public static AnvilChannel CHANNEL;
@Mod.Instance("auracore")
public static AuraCore INSTANCE;
@SidedProxy(modId = "auracore", clientSide = "dev.tilera.auracore.proxy.ClientProxy", serverSide = "dev.tilera.auracore.proxy.CommonProxy")
@ -51,12 +46,11 @@ public class AuraCore {
public void preInit(FMLPreInitializationEvent e) {
Config.load();
Aspects.load();
CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel("auracore");
int pktID = 0;
AuraCore.CHANNEL.registerMessage(AuraPacketHandler.class, AuraPacket.class, pktID++, Side.CLIENT);
AuraCore.CHANNEL.registerMessage(AuraDeletePacketHandler.class, AuraDeletePacket.class, pktID++, Side.CLIENT);
AuraCore.CHANNEL.registerMessage(AuraTransferFXPacketHandler.class, AuraTransferFXPacket.class, pktID++, Side.CLIENT);
AuraCore.CHANNEL.registerMessage(NodeZapPacketHandler.class, NodeZapPacket.class, pktID++, Side.CLIENT);
CHANNEL = new AnvilChannel("auracore");
AuraCore.CHANNEL.register(AuraPacket.class);
AuraCore.CHANNEL.register(AuraDeletePacket.class);
AuraCore.CHANNEL.register(AuraTransferFXPacket.class);
AuraCore.CHANNEL.register(NodeZapPacket.class);
proxy.preInit();
MinecraftForge.EVENT_BUS.register(new EventHandler());
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
@ -76,6 +70,7 @@ public class AuraCore {
@Mod.EventHandler
public void init(FMLInitializationEvent ev) {
proxy.init();
ConfigBlocks.blockCrystal.setTickRandomly(true);
Recipes.initRecipes();
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);

View file

@ -47,6 +47,17 @@ public class EventHandler {
}
}
nodeNBT.setTag("flux", flux);
NBTTagList stasis = new NBTTagList();
if (node.stasis.size() > 0) {
for (Aspect tag : node.stasis.getAspects()) {
if (tag == null) continue;
NBTTagCompound f = new NBTTagCompound();
f.setString("id", tag.getTag());
f.setInteger("amount", node.stasis.getAmount(tag));
stasis.appendTag(f);
}
}
nodeNBT.setTag("stasis", stasis);
nodelist.appendTag(nodeNBT);
}
}
@ -83,6 +94,15 @@ public class EventHandler {
if (!flux.hasKey("id") || !flux.hasKey("amount")) continue;
node.flux.add(Aspect.getAspect(flux.getString("id")), flux.getInteger("amount"));
}
node.stasis = new AspectList();
if (nodeData.hasKey("stasis")) {
NBTTagList stasisTags = nodeData.getTagList("stasis", 10);
for (int j = 0; j < stasisTags.tagCount(); ++j) {
NBTTagCompound stasis = stasisTags.getCompoundTagAt(j);
if (!stasis.hasKey("id") || !stasis.hasKey("amount")) continue;
node.stasis.add(Aspect.getAspect(stasis.getString("id")), stasis.getInteger("amount"));
}
}
AuraManager.auraNodes.put(node.key, node);
AuraManager.addToAuraUpdateList(node);
AuraManager.generateNodeNeighbours(node);

View file

@ -1,19 +1,62 @@
package dev.tilera.auracore;
import java.util.HashSet;
import java.util.Set;
import dev.tilera.auracore.api.Aspects;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.config.ConfigResearch;
public class Recipes {
static Set<String> oldCrucibleRecipes = new HashSet<>();
public static void initRecipes() {
ConfigResearch.recipes.put("Clusters8", shapelessOreDictRecipe(new ItemStack(ConfigBlocks.blockCrystal, 1, 8), new Object[] { new ItemStack(ConfigItems.itemShard, 1, 7), new ItemStack(ConfigItems.itemShard, 1, 7), new ItemStack(ConfigItems.itemShard, 1, 7), new ItemStack(ConfigItems.itemShard, 1, 7), new ItemStack(ConfigItems.itemShard, 1, 7), new ItemStack(ConfigItems.itemShard, 1, 7) }));
ConfigResearch.recipes.put("Clusters10", shapelessOreDictRecipe(new ItemStack(ConfigBlocks.blockCrystal, 1, 10), new Object[] { new ItemStack(ConfigItems.itemShard, 1, 9), new ItemStack(ConfigItems.itemShard, 1, 9), new ItemStack(ConfigItems.itemShard, 1, 9), new ItemStack(ConfigItems.itemShard, 1, 9), new ItemStack(ConfigItems.itemShard, 1, 9), new ItemStack(ConfigItems.itemShard, 1, 9) }));
ConfigResearch.recipes.put("Clusters9", shapelessOreDictRecipe(new ItemStack(ConfigBlocks.blockCrystal, 1, 9), new Object[] { new ItemStack(ConfigItems.itemShard, 1, 0), new ItemStack(ConfigItems.itemShard, 1, 1), new ItemStack(ConfigItems.itemShard, 1, 2), new ItemStack(ConfigItems.itemShard, 1, 3), new ItemStack(ConfigItems.itemShard, 1, 7) }));
if (false) {
ThaumcraftApi.addCrucibleRecipe("ALUMENTUM", new ItemStack(ConfigItems.itemResource, 1, 0), 5, new AspectList().merge(Aspect.ENERGY, 6).merge(Aspect.FIRE, 6).merge(Aspects.DESTRUCTION, 3));
oldCrucibleRecipes.add("ALUMENTUM");
//ThaumcraftApi.addCrucibleRecipe("GUNPOWDER", new ItemStack(Items.gunpowder), 5, new AspectList().merge(Aspect.FIRE, 6).merge(Aspects.DESTRUCTION, 6));
ThaumcraftApi.addCrucibleRecipe("NITOR", new ItemStack(ConfigItems.itemResource, 1, 1), 5, new AspectList().merge(Aspect.ENERGY, 4).merge(Aspect.FIRE, 4).merge(Aspect.LIGHT, 6));
oldCrucibleRecipes.add("NITOR");
ThaumcraftApi.addCrucibleRecipe("THAUMIUM", new ItemStack(ConfigItems.itemResource, 1, 2), 5, new AspectList().merge(Aspect.METAL, 8).merge(Aspect.MAGIC, 4));
oldCrucibleRecipes.add("THAUMIUM");
ThaumcraftApi.addCrucibleRecipe("TALLOW", new ItemStack(ConfigItems.itemResource, 1, 4), 5, new AspectList().merge(Aspect.FLESH, 4));
oldCrucibleRecipes.add("TALLOW");
ThaumcraftApi.addCrucibleRecipe("TRANSGOLD", new ItemStack(Items.gold_nugget, 2, 0), 5, new AspectList().merge(Aspect.METAL, 2).merge(Aspects.VALUABLE, 1));
oldCrucibleRecipes.add("TRANSGOLD");
if (thaumcraft.common.config.Config.foundCopperIngot) {
ThaumcraftApi.addCrucibleRecipe("TRANSCOPPER", new ItemStack(ConfigItems.itemNugget, 3, 1), 5, new AspectList().merge(Aspect.METAL, 3).merge(Aspect.LIFE, 1));
oldCrucibleRecipes.add("TRANSCOPPER");
}
if (thaumcraft.common.config.Config.foundTinIngot) {
ThaumcraftApi.addCrucibleRecipe("TRANSTIN", new ItemStack(ConfigItems.itemNugget, 3, 2), 5, new AspectList().merge(Aspect.METAL, 3).merge(Aspect.CRYSTAL, 1));
oldCrucibleRecipes.add("TRANSTIN");
}
if (thaumcraft.common.config.Config.foundSilverIngot) {
ThaumcraftApi.addCrucibleRecipe("TRANSSILVER", new ItemStack(ConfigItems.itemNugget, 3, 3), 5, new AspectList().merge(Aspect.METAL, 3).merge(Aspect.EXCHANGE, 1));
oldCrucibleRecipes.add("TRANSSILVER");
}
if (thaumcraft.common.config.Config.foundLeadIngot) {
ThaumcraftApi.addCrucibleRecipe("TRANSLEAD", new ItemStack(ConfigItems.itemNugget, 3, 4), 5, new AspectList().merge(Aspect.METAL, 3).merge(Aspect.VOID, 1));
oldCrucibleRecipes.add("TRANSLEAD");
}
ThaumcraftApi.addCrucibleRecipe("TRANSIRON", new ItemStack(ConfigItems.itemNugget, 2, 0), 5, new AspectList().merge(Aspect.METAL, 2));
oldCrucibleRecipes.add("TRANSIRON");
ThaumcraftApi.getCraftingRecipes().removeIf((Object o) -> o instanceof thaumcraft.api.crafting.CrucibleRecipe && oldCrucibleRecipes.contains(((thaumcraft.api.crafting.CrucibleRecipe)o).key));
}
}
@SuppressWarnings({"unchecked"})

View file

@ -10,6 +10,7 @@ public class AuraNode implements Serializable {
public short baseLevel;
public short taint;
public AspectList flux = new AspectList();
public AspectList stasis = new AspectList();
public EnumNodeType type;
public int dimension;
public double xPos;

View file

@ -5,7 +5,7 @@ public class CrystalColors {
public static final int[] colors = new int[]{16777215, 16777086, 16727041, 37119, 40960, 15650047, 5592439, 11154172, 0xB0B0BC, 0x800080};
public static int getColorForShard(int meta) {
if (meta > 9 || meta < 0) {
if (meta > 9 || meta < 0 || meta == 6) {
return 0xFFFFFF;
} else if (meta > 6) {
return colors[meta];

View file

@ -27,4 +27,6 @@ public interface ICrystal {
*/
void harvestShard(EntityPlayer player);
boolean canHarvest(EntityPlayer player);
}

View file

@ -0,0 +1,25 @@
package dev.tilera.auracore.api;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public interface IWandableBlock {
/**
* Called by wands when interacting with the block
* @param world The World of the block
* @param stack The ItemStack of the wand
* @param impl The IWand implementation for the wand
* @param player The player
* @param x xCoord of the block
* @param y yCoord of the block
* @param z zCoord of the block
* @param side The side, which was activated
* @param md The metadata of the block
* @return true, if block was successfully wanded
*/
boolean onWandRightClick(World world, ItemStack stack, IWand impl, EntityPlayer player, int x, int y, int z, ForgeDirection side, int md);
}

View file

@ -8,11 +8,15 @@ public class ResearchPageCrucible extends ResearchPage {
public ResearchPageCrucible(CrucibleRecipe recipe) {
super("auracore.research_title.crucible");
this.recipe = recipe;
this.recipeOutput = recipe.recipeOutput.copy();
}
public ResearchPageCrucible(CrucibleRecipe[] recipes) {
super("auracore.research_title.crucible");
this.recipe = recipes;
if (recipes.length > 0) {
this.recipeOutput = recipes[0].recipeOutput.copy();
}
}
}

View file

@ -8,11 +8,15 @@ public class ResearchPageInfusion extends ResearchPage {
public ResearchPageInfusion(IInfusionRecipe recipe) {
super("auracore.research_title.infusion");
this.recipe = recipe;
this.recipeOutput = recipe.getRecipeOutput().copy();
}
public ResearchPageInfusion(IInfusionRecipe[] recipes) {
super("auracore.research_title.infusion");
this.recipe = recipes;
if (recipes.length > 0) {
this.recipeOutput = recipes[0].getRecipeOutput().copy();
}
}
}

View file

@ -1,17 +1,26 @@
package dev.tilera.auracore.api.research;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public abstract class ResearchTableExtension {
public WeakReference<IResearchTable> researchTable;
private Method markDirty;
public ResearchTableExtension(IResearchTable researchTable) {
this.researchTable = new WeakReference<>(researchTable);
Class<? extends ResearchTableExtension> impl = this.getClass();
try {
markDirty = impl.getDeclaredMethod("markDirty", new Class[0]);
} catch (Exception e) {
markDirty = null;
}
}
public World getWorld() {
@ -44,7 +53,17 @@ public abstract class ResearchTableExtension {
public abstract void onTick();
public abstract void markDirty();
public void extMarkDirty() {
if (this instanceof IInventory) {
((IInventory)this).markDirty();
} else if (markDirty != null) {
try {
markDirty.invoke(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public abstract boolean openGUI(EntityPlayer player);

View file

@ -3,8 +3,10 @@ package dev.tilera.auracore.aura;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
@ -228,6 +230,39 @@ public class AuraManager {
return closest;
}
public static int getClosestAuraWithinRange(World world, double x, double z, double range) {
int dim = world.provider.dimensionId;
int cx = MathHelper.floor_double((double)x) / 16;
int cz = MathHelper.floor_double((double)z) / 16;
if (world.isRemote) {
return -1;
}
int size = 5;
int closest = -1;
double clRange = Double.MAX_VALUE;
synchronized (saveLock) {
for (int xx = -size; xx <= size; ++xx) {
for (int zz = -size; zz <= size; ++zz) {
List<Integer> nc = nodeChunks.get(Arrays.asList(dim, cx + xx, cz + zz));
if (nc == null || nc.size() <= 0) continue;
for (Integer key : nc) {
try {
double zd;
double xd;
double distSq;
AuraNode node = AuraManager.copyNode(AuraManager.getNode(key));
if (node == null || node.locked || !Utils.isChunkLoaded(world, MathHelper.floor_double((double)node.xPos), MathHelper.floor_double((double)node.zPos)) || !(range * range >= (distSq = (xd = node.xPos - x) * xd + (zd = node.zPos - z) * zd)) || !(distSq < clRange)) continue;
closest = key;
clRange = distSq;
}
catch (Exception e) {}
}
}
}
}
return closest;
}
public static ArrayList<Integer> getAurasWithin(World world, double x, double y, double z) {
int dim = world.provider.dimensionId;
int cx = MathHelper.floor_double((double)x) / 16;
@ -791,12 +826,17 @@ public class AuraManager {
}
public static void queueNodeChanges(int key, int levelMod, int baseMod, boolean toggleLock, AspectList flx, float x, float y, float z) {
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, 0, toggleLock, flx, x, y, z);
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, 0, toggleLock, flx, null, x, y, z);
auraUpdateQueue.add(nc);
}
public static void queueNodeChanges(int key, int levelMod, int baseMod, int taint, boolean toggleLock, AspectList flx, float x, float y, float z) {
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, x, y, z);
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, null, x, y, z);
auraUpdateQueue.add(nc);
}
public static void queueNodeChanges(int key, int levelMod, int baseMod, int taint, boolean toggleLock, AspectList flx, AspectList stasis, float x, float y, float z) {
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, stasis, x, y, z);
auraUpdateQueue.add(nc);
}
@ -805,7 +845,32 @@ public class AuraManager {
if (key < 0) {
key = registerAuraNode(world, (short)(world.rand.nextInt(50) + 50), EnumNodeType.DARK, world.provider.dimensionId, x, y, z);
}
queueNodeChanges(key, 0, 0, taint, false, null, x, y, z);
queueNodeChanges(key, 0, 0, taint, false, null, 0, 0, 0);
}
public static void addGoodVibes(World world, int x, int y, int z, int amount) {
int key = getClosestAuraWithinRange(world, x, y, z, 64);
if (key < 0) return;
queueNodeChanges(key, 0, 0, 0, false, null, new AspectList().add(Aspect.MAGIC, amount), 0, 0, 0);
}
public static void addBadVibes(World world, int x, int y, int z, int amount) {
int key = getClosestAuraWithinRange(world, x, y, z, 64);
if (key < 0) return;
queueNodeChanges(key, 0, 0, 0, false, new AspectList().add(Aspect.TAINT, amount), null, 0, 0, 0);
}
public static void addBoost(World world, int x, int y, int z, int amount) {
int key = getClosestAuraWithinRange(world, x, y, z, 64);
if (key < 0) return;
queueNodeChanges(key, 0, 0, 0, false, null, new AspectList().add(Aspects.TIME, amount), 0, 0, 0);
}
public static int getBoost(World world, int x, int y, int z) {
int key = getClosestAuraWithinRange(world, x, y, z, 64);
if (key < 0) return 0;
AuraNode node = getNode(key);
return node.stasis.getAmount(Aspects.TIME);
}
public static AuraNode copyNode(AuraNode in) {
@ -821,6 +886,11 @@ public class AuraManager {
outflux.add(tag, in.flux.getAmount(tag));
}
out.flux = outflux;
AspectList outstasis = new AspectList();
for (Aspect tag : in.stasis.getAspects()) {
outstasis.add(tag, in.stasis.getAmount(tag));
}
out.stasis = outstasis;
out.dimension = in.dimension;
out.xPos = in.xPos;
out.yPos = in.yPos;
@ -841,6 +911,7 @@ public class AuraManager {
out.taint = in.taint;
out.type = in.type;
out.flux = in.flux;
out.stasis = in.stasis;
out.dimension = in.dimension;
out.xPos = in.xPos;
out.yPos = in.yPos;
@ -856,17 +927,19 @@ public class AuraManager {
int taintMod = 0;
boolean lock = false;
AspectList flux = null;
AspectList stasis = null;
float motionX;
float motionY;
float motionZ;
NodeChanges(int k, int l, int b, int t, boolean lo, AspectList ot, float x, float y, float z) {
NodeChanges(int k, int l, int b, int t, boolean lo, AspectList flux, AspectList stasis, float x, float y, float z) {
this.key = k;
this.levelMod = l;
this.baseMod = b;
this.taintMod = t;
this.lock = lo;
this.flux = ot;
this.flux = flux;
this.stasis = stasis;
this.motionX = x;
this.motionY = y;
this.motionZ = z;

View file

@ -74,6 +74,38 @@ public class AuraUpdateThread
}
}
}
if (nc.stasis != null) {
for (Aspect tag : nc.stasis.getAspects()) {
if (nc.stasis.getAmount(tag) > 0) {
node.stasis.add(tag, nc.stasis.getAmount(tag));
continue;
}
node.stasis.reduce(tag, -nc.stasis.getAmount(tag)); // TODO:WTF
}
}
if (node.stasis.size() > 0) {
ArrayList<Aspect> dt = new ArrayList<>();
ArrayList<Aspect> red = new ArrayList<>();
for (Aspect tag : node.stasis.getAspects()) {
if (node.stasis.getAmount(tag) <= 0) {
dt.add(tag);
continue;
}
if (node.stasis.getAmount(tag) <= 100)
continue;
red.add(tag);
}
if (red.size() > 0) {
for (Aspect tag : red) {
node.stasis.reduce(tag, node.stasis.getAmount(tag) - 100);
}
}
if (dt.size() > 0) {
for (Aspect tag : dt) {
node.stasis.remove(tag);
}
}
}
if (nc.motionX != 0.0f || nc.motionY != 0.0f || nc.motionZ != 0.0f) {
int cx = MathHelper.floor_double((double) node.xPos) / 16;
cz = MathHelper.floor_double((double) node.zPos) / 16;

View file

@ -30,6 +30,7 @@ class SlotWorkbenchWand extends Slot {
!this.workbench.getWorldObj().isRemote &&
this.inventory.getStackInSlot(this.getSlotIndex()) != null &&
this.inventory.getStackInSlot(this.getSlotIndex()).getItem() instanceof ItemWandCasting) {
player.inventory.setItemStack(null);
player.openGui(Thaumcraft.instance, 13, this.workbench.getWorldObj(), this.workbench.xCoord, this.workbench.yCoord, this.workbench.zCoord);
}
}

View file

@ -207,6 +207,7 @@ public class LegacyAspects {
int var7 = (Integer)var6.next();
ThaumcraftApi.registerObjectTag(new ItemStack(Items.potionitem, 1, var7), new AspectList(new ItemStack(Items.potionitem)));
}
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemWispEssence, 1, 0), (new AspectList()).add(Aspect.AURA, 2));
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemEssence), new AspectList().add(Aspect.VOID, 1).add(Aspect.CRYSTAL, 1));
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemNugget, 1, 31), new AspectList().add(Aspect.METAL, 12).add(Aspects.ROCK, 2).add(Aspects.VALUABLE, 8));
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigItems.itemNugget, 1, 16), new AspectList().add(Aspect.METAL, 12).add(Aspects.ROCK, 2));

View file

@ -35,7 +35,7 @@ public abstract class MixinThaumcraftWorldGenerator {
int z = chunkZ * 16 + random.nextInt(16);
int y = world.getHeightValue(x, z);
BiomeGenBase bio = world.getBiomeGenForCoords(x, z);
if (bio.equals(ThaumcraftWorldGenerator.biomeMagicalForest) || bio.equals(ThaumcraftWorldGenerator.biomeTaint) || !BiomeDictionary.isBiomeOfType(bio, Type.MAGICAL) && bio.biomeID != BiomeGenBase.forestHills.biomeID && bio.biomeID != BiomeGenBase.birchForestHills.biomeID) {
if (bio.equals(ThaumcraftWorldGenerator.biomeMagicalForest) || bio.equals(ThaumcraftWorldGenerator.biomeTaint) || !BiomeDictionary.isBiomeOfType(bio, Type.MAGICAL) && BiomeDictionary.isBiomeOfType(bio, Type.FOREST)) {
return false;
} else if (dev.tilera.auracore.Config.replaceSilverwood) {
boolean t = (new WorldGenSilverwoodTreesOld(false)).generate(world, random, x, y, z);

View file

@ -119,4 +119,10 @@ public abstract class MixinTileCrystal extends TileThaumcraft implements ICrysta
worldObj.spawnEntityInWorld(entity);
}
@Override
public boolean canHarvest(EntityPlayer player) {
int md = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
return md != 6 && md != 9 && crystals > 1;
}
}

View file

@ -70,7 +70,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
@Inject(method = "markDirty", at = @At("TAIL"))
public void onMarkDirty(CallbackInfo ci) {
if (extension != null) {
extension.markDirty();
extension.extMarkDirty();
}
}
@ -135,7 +135,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
}
}
@Inject(method = "getSizeInventory", at = @At("HEAD"), remap = false, cancellable = true)
@Inject(method = "getSizeInventory", at = @At("HEAD"), cancellable = true)
public void onGetInventorySize(CallbackInfoReturnable<Integer> ci) {
if (extension instanceof IInventory) {
IInventory ext = (IInventory) extension;
@ -143,7 +143,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
}
}
@Inject(method = "getStackInSlot", at = @At("HEAD"), remap = false, cancellable = true)
@Inject(method = "getStackInSlot", at = @At("HEAD"), cancellable = true)
public void onGetStackInSlot(int slot, CallbackInfoReturnable<ItemStack> ci) {
if (extension instanceof IInventory && slot >= 2) {
IInventory ext = (IInventory) extension;
@ -151,7 +151,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
}
}
@Inject(method = "getStackInSlotOnClosing", at = @At("HEAD"), remap = false, cancellable = true)
@Inject(method = "getStackInSlotOnClosing", at = @At("HEAD"), cancellable = true)
public void onGetStackInSlotOnClosing(int slot, CallbackInfoReturnable<ItemStack> ci) {
if (extension instanceof IInventory && slot >= 2) {
IInventory ext = (IInventory) extension;
@ -159,7 +159,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
}
}
@Inject(method = "decrStackSize", at = @At("HEAD"), remap = false, cancellable = true)
@Inject(method = "decrStackSize", at = @At("HEAD"), cancellable = true)
public void onDecrStackSize(int slot, int amt, CallbackInfoReturnable<ItemStack> ci) {
if (extension instanceof IInventory && slot >= 2) {
IInventory ext = (IInventory) extension;
@ -167,7 +167,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
}
}
@Inject(method = "setInventorySlotContents", at = @At("HEAD"), remap = false, cancellable = true)
@Inject(method = "setInventorySlotContents", at = @At("HEAD"), cancellable = true)
public void onSetSlotContents(int slot, ItemStack stack, CallbackInfo ci) {
if (extension instanceof IInventory && slot >= 2) {
IInventory ext = (IInventory) extension;
@ -176,7 +176,7 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
}
}
@Inject(method = "isItemValidForSlot", at = @At("HEAD"), remap = false, cancellable = true)
@Inject(method = "isItemValidForSlot", at = @At("HEAD"), cancellable = true)
public void onIsItemValid(int slot, ItemStack stack, CallbackInfoReturnable<Boolean> ci) {
if (extension instanceof IInventory) {
IInventory ext = (IInventory) extension;

View file

@ -1,10 +1,16 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.api.AuraNode;
import dev.tilera.auracore.client.AuraManagerClient;
import io.netty.buffer.ByteBuf;
import net.anvilcraft.anvillib.network.AnvilPacket;
import net.anvilcraft.anvillib.network.IAnvilPacket;
public class AuraDeletePacket implements IMessage {
@AnvilPacket(Side.CLIENT)
public class AuraDeletePacket implements IAnvilPacket {
int key;
@ -23,5 +29,12 @@ public class AuraDeletePacket implements IMessage {
public void toBytes(ByteBuf buf) {
buf.writeInt(key);
}
@SideOnly(Side.CLIENT)
@Override
public void handle(MessageContext ctx) {
AuraManagerClient.auraClientList.remove(this.key);
AuraManagerClient.auraClientHistory.remove(this.key);
}
}

View file

@ -1,20 +0,0 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.client.AuraManagerClient;
public class AuraDeletePacketHandler implements IMessageHandler<AuraDeletePacket, IMessage> {
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(AuraDeletePacket message, MessageContext ctx) {
AuraManagerClient.auraClientList.remove(message.key);
AuraManagerClient.auraClientHistory.remove(message.key);
return null;
}
}

View file

@ -1,10 +1,20 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.api.AuraNode;
import dev.tilera.auracore.client.AuraManagerClient;
import dev.tilera.auracore.client.AuraManagerClient.NodeHistoryStats;
import dev.tilera.auracore.client.AuraManagerClient.NodeStats;
import io.netty.buffer.ByteBuf;
import net.anvilcraft.anvillib.network.AnvilPacket;
import net.anvilcraft.anvillib.network.IAnvilPacket;
import net.minecraft.world.World;
public class AuraPacket implements IMessage {
@AnvilPacket(Side.CLIENT)
public class AuraPacket implements IAnvilPacket {
public int key;
public double x;
@ -63,5 +73,18 @@ public class AuraPacket implements IMessage {
buf.writeByte(type);
buf.writeBoolean(virtual);
}
@SideOnly(Side.CLIENT)
@Override
public void handle(MessageContext ctx) {
World world = FMLClientHandler.instance().getWorldClient();
if (AuraManagerClient.auraClientHistory.get(this.key) != null) {
AuraManagerClient.auraClientHistory.put(this.key, new NodeHistoryStats(AuraManagerClient.auraClientList.get(this.key)));
}
AuraManagerClient.auraClientList.put(this.key, new NodeStats(this, world.provider.dimensionId));
if (AuraManagerClient.auraClientHistory.get(this.key) == null) {
AuraManagerClient.auraClientHistory.put(this.key, new NodeHistoryStats(this.level, this.flux, this.taint));
}
}
}

View file

@ -1,30 +0,0 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.client.AuraManagerClient;
import dev.tilera.auracore.client.AuraManagerClient.NodeHistoryStats;
import dev.tilera.auracore.client.AuraManagerClient.NodeStats;
import net.minecraft.world.World;
public class AuraPacketHandler implements IMessageHandler<AuraPacket, IMessage> {
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(AuraPacket message, MessageContext ctx) {
World world = FMLClientHandler.instance().getWorldClient();
if (AuraManagerClient.auraClientHistory.get(message.key) != null) {
AuraManagerClient.auraClientHistory.put(message.key, new NodeHistoryStats(AuraManagerClient.auraClientList.get(message.key)));
}
AuraManagerClient.auraClientList.put(message.key, new NodeStats(message, world.provider.dimensionId));
if (AuraManagerClient.auraClientHistory.get(message.key) == null) {
AuraManagerClient.auraClientHistory.put(message.key, new NodeHistoryStats(message.level, message.flux, message.taint));
}
return null;
}
}

View file

@ -1,10 +1,20 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.api.AuraNode;
import dev.tilera.auracore.client.FXSparkle;
import dev.tilera.auracore.helper.Utils;
import io.netty.buffer.ByteBuf;
import net.anvilcraft.anvillib.network.AnvilPacket;
import net.anvilcraft.anvillib.network.IAnvilPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
public class AuraTransferFXPacket implements IMessage {
@AnvilPacket(Side.CLIENT)
public class AuraTransferFXPacket implements IAnvilPacket {
double x;
double y;
@ -43,5 +53,23 @@ public class AuraTransferFXPacket implements IMessage {
buf.writeDouble(targetY);
buf.writeDouble(targetZ);
}
@SideOnly(Side.CLIENT)
@Override
public void handle(MessageContext ctx) {
EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
if (Utils.hasGoggles(player)) {
double var7 = this.x - this.targetX;
double var9 = this.y - this.targetY;
double var11 = this.z - this.targetZ;
int distance = (int)MathHelper.sqrt_double((double)(var7 * var7 + var9 * var9 + var11 * var11));
FXSparkle fx = new FXSparkle(player.worldObj, this.x, this.y, this.z, this.targetX, this.targetY, this.targetZ, 2.5f, 0, distance / 2);
fx.slowdown = false;
fx.noClip = true;
fx.leyLineEffect = true;
fx.shrink = false;
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
}
}
}

View file

@ -1,35 +0,0 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.client.FXSparkle;
import dev.tilera.auracore.helper.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
public class AuraTransferFXPacketHandler implements IMessageHandler<AuraTransferFXPacket, IMessage> {
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(AuraTransferFXPacket message, MessageContext ctx) {
EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
if (Utils.hasGoggles(player)) {
double var7 = message.x - message.targetX;
double var9 = message.y - message.targetY;
double var11 = message.z - message.targetZ;
int distance = (int)MathHelper.sqrt_double((double)(var7 * var7 + var9 * var9 + var11 * var11));
FXSparkle fx = new FXSparkle(player.worldObj, message.x, message.y, message.z, message.targetX, message.targetY, message.targetZ, 2.5f, 0, distance / 2);
fx.slowdown = false;
fx.noClip = true;
fx.leyLineEffect = true;
fx.shrink = false;
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
}
return null;
}
}

View file

@ -1,10 +1,18 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.anvilcraft.anvillib.network.AnvilPacket;
import net.anvilcraft.anvillib.network.IAnvilPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import thaumcraft.client.fx.bolt.FXLightningBolt;
public class NodeZapPacket implements IMessage {
@AnvilPacket(Side.CLIENT)
public class NodeZapPacket implements IAnvilPacket {
public double x;
public double y;
@ -35,5 +43,18 @@ public class NodeZapPacket implements IMessage {
buf.writeDouble(z);
buf.writeInt(entityID);
}
@SideOnly(Side.CLIENT)
@Override
public void handle(MessageContext ctx) {
World world = Minecraft.getMinecraft().theWorld;
Entity targetedEntity = world.getEntityByID(this.entityID);
if (targetedEntity != null) {
FXLightningBolt bolt = new FXLightningBolt(world, this.x, this.y, this.z, targetedEntity.posX, targetedEntity.posY, targetedEntity.posZ, world.rand.nextLong(), 10, 2.0f, 5);
bolt.defaultFractal();
bolt.setType(3);
bolt.finalizeBolt();
}
}
}

View file

@ -1,29 +0,0 @@
package dev.tilera.auracore.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import thaumcraft.client.fx.bolt.FXLightningBolt;
public class NodeZapPacketHandler implements IMessageHandler<NodeZapPacket, IMessage> {
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(NodeZapPacket message, MessageContext ctx) {
World world = Minecraft.getMinecraft().theWorld;
Entity targetedEntity = world.getEntityByID(message.entityID);
if (targetedEntity != null) {
FXLightningBolt bolt = new FXLightningBolt(world, message.x, message.y, message.z, targetedEntity.posX, targetedEntity.posY, targetedEntity.posZ, world.rand.nextLong(), 10, 2.0f, 5);
bolt.defaultFractal();
bolt.setType(3);
bolt.finalizeBolt();
}
return null;
}
}

View file

@ -1,6 +1,7 @@
package dev.tilera.auracore.proxy;
import dev.tilera.auracore.client.gui.GuiArcaneWorkbench;
import dev.tilera.capes.Capes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import thaumcraft.common.tiles.TileArcaneWorkbench;
@ -15,4 +16,9 @@ public class ClientProxy extends CommonProxy {
return null;
}
@Override
public void init() {
Capes.initCapes();
}
}

View file

@ -10,6 +10,8 @@ public class CommonProxy implements IGuiHandler {
public void preInit() {}
public void init() {}
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == 0) {

View file

@ -98,8 +98,8 @@ public class WorldGenerator implements IWorldGenerator {
auraGen = true;
this.structureNode.put(var7.hashCode(), true);
int yPos = world.getHeightValue(var7.chunkPosX, var7.chunkPosZ) + 3;
int nearKey = AuraManager.getClosestAuraWithinRange(world, var7.chunkPosX, yPos, var7.chunkPosZ, 10);
if (nearKey < 0) {
int nearKey = AuraManager.getClosestAuraWithinRange(world, var7.chunkPosX, var7.chunkPosZ, 10);
if (nearKey < 0 && yPos > 5) {
int value = random.nextInt(200) + 800;
AuraManager.registerAuraNode(world, (short)value, EnumNodeType.NORMAL, world.provider.dimensionId, var7.chunkPosX, yPos, var7.chunkPosZ);
}