Compare commits

...

38 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
Timo Ley ea5df8a3f2 fix: allow multiple recipes in research page
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-30 16:52:11 +01:00
Timo Ley da11f55a94 fix: add missing oredict aspects
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-24 20:53:44 +01:00
Timo Ley b98a39af6e feat: add crucible mechanics config option
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-21 23:31:46 +01:00
Timo Ley eb7c01ad7b feat: basic node synergy
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-21 22:58:54 +01:00
Timo Ley 6ffec2106c fix: arcane workbench
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
fixes #3
2023-01-20 18:43:51 +01:00
Timo Ley c79f7779bb fix: CancellationException
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-20 17:50:22 +01:00
Timo Ley 0b2eed4b7c fix: research table now dropping extension content
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-20 17:06:40 +01:00
Timo Ley 96e611fd13 fix: aspect calculation exceptions
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
fixes #2
2023-01-19 21:38:32 +01:00
Timo Ley 80bbd9f283 fix: vis calculation
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-14 17:27:38 +01:00
Timo Ley 59ec91cf7c fix: remove obfuscation mapping warnings
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-14 17:12:59 +01:00
Timo Ley 49c41c1ef4 feat: implement old aspect calculation
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-14 17:06:03 +01:00
Timo Ley 0e909e82de fix: research table extension
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-13 17:30:04 +01:00
Timo Ley 881e51ec6c feat: add researchtable extension API
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-01-13 13:23:12 +01:00
Timo Ley 89b713de99 fix: aura animation with doDaylightCycle false 2023-01-13 12:17:10 +01:00
44 changed files with 1246 additions and 165 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

@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = "1.5.0"
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,9 +70,12 @@ public class AuraCore {
@Mod.EventHandler
public void init(FMLInitializationEvent ev) {
proxy.init();
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,13 @@ 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 legacyCrucibleMechanics = true;
public static boolean noScanning() {
return knowAllAspects;
@ -23,10 +26,13 @@ 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");
legacyCrucibleMechanics = config.getBoolean("legacyCrucibleMechanics", "crucible", legacyCrucibleMechanics, "Use TC3 crucible mechanics");
config.save();
}

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

@ -0,0 +1,24 @@
package dev.tilera.auracore.api.research;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
/**
* DO NOT IMPLEMENT THIS!
* Implemented by TileResearchTable. Can safely be casted to it.
*/
public interface IResearchTable {
ResearchTableExtension getInternalExtension();
World getWorld();
int getXCoord();
int getYCoord();
int getZCoord();
void openGUI(EntityPlayer player);
}

View file

@ -8,6 +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,6 +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

@ -0,0 +1,72 @@
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() {
return researchTable.get().getWorld();
}
public int getXCoord() {
return researchTable.get().getXCoord();
}
public int getYCoord() {
return researchTable.get().getYCoord();
}
public int getZCoord() {
return researchTable.get().getZCoord();
}
public IResearchTable getResearchTable() {
return researchTable.get();
}
public abstract void writeToNBT(NBTTagCompound nbt);
public abstract void readFromNBT(NBTTagCompound nbt);
public abstract void writeToPacket(NBTTagCompound nbt);
public abstract void readFromPacket(NBTTagCompound nbt);
public abstract void onTick();
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);
public abstract String getNBTKey();
}

View file

@ -0,0 +1,31 @@
package dev.tilera.auracore.api.research;
import java.lang.reflect.Constructor;
public class ResearchTableExtensionRegistry {
private static Class<? extends ResearchTableExtension> extension = null;
public static boolean registerResearchTableExtension(Class<? extends ResearchTableExtension> ext, boolean force) {
if (extension == null || force) {
extension = ext;
return true;
}
return false;
}
public static boolean hasActiveExtension() {
return extension != null;
}
public static ResearchTableExtension createInstance(IResearchTable table) {
try {
Constructor<?> constr = extension.getConstructor(IResearchTable.class);
return (ResearchTableExtension) constr.newInstance(table);
} catch (NullPointerException | ReflectiveOperationException | SecurityException | IllegalArgumentException e) {
e.printStackTrace();
return null;
}
}
}

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

@ -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

@ -33,7 +33,7 @@ public class RenderEventHandler {
Minecraft mc = Minecraft.getMinecraft();
if (Minecraft.getMinecraft().renderViewEntity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().renderViewEntity;
long time = mc.theWorld.getWorldTime();
long time = mc.theWorld.getTotalWorldTime();
if (Utils.hasGoggles(player)) {
GL11.glPushMatrix();
GL11.glDepthMask((boolean)false);
@ -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

@ -27,7 +27,7 @@ public class ContainerWorkbench extends Container {
this.tileEntity.eventHandler = this;
this.ip = par1InventoryPlayer;
this.addSlotToContainer((Slot)new SlotCraftingArcaneWorkbench(par1InventoryPlayer.player, this.tileEntity, this.tileEntity, 9, 124, 29));
this.addSlotToContainer(new SlotWorkbenchWand(this.tileEntity, 10, 124, 61));
this.addSlotToContainer(new SlotWorkbenchWand(this.tileEntity, 10, 124, 61, par1InventoryPlayer.player));
for (var6 = 0; var6 < 3; ++var6) {
for (var7 = 0; var7 < 3; ++var7) {
this.addSlotToContainer(new Slot(this.tileEntity, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18));

View file

@ -1,18 +1,38 @@
package dev.tilera.auracore.container;
import dev.tilera.auracore.api.IWand;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumcraft.common.tiles.TileArcaneWorkbench;
class SlotWorkbenchWand extends Slot {
public SlotWorkbenchWand(IInventory par2IInventory, int par3, int par4, int par5) {
TileArcaneWorkbench workbench;
EntityPlayer player;
public SlotWorkbenchWand(TileArcaneWorkbench par2IInventory, int par3, int par4, int par5, EntityPlayer player) {
super(par2IInventory, par3, par4, par5);
this.workbench = par2IInventory;
this.player = player;
}
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
return par1ItemStack.getItem() instanceof ItemWandCasting || par1ItemStack.getItem() instanceof IWand;
}
@Override
public void onSlotChanged() {
super.onSlotChanged();
if (
!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

@ -0,0 +1,257 @@
package dev.tilera.auracore.crafting;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import dev.tilera.auracore.api.AuracoreRecipes;
import dev.tilera.auracore.api.crafting.CrucibleRecipe;
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
import dev.tilera.auracore.api.crafting.ShapedInfusionCraftingRecipe;
import dev.tilera.auracore.api.crafting.ShapelessInfusionCraftingRecipe;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.ShapedArcaneRecipe;
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
public class AspectCalculation {
public static AspectList generateTagsFromInfusionRecipes(Item item, int meta, ArrayList<List> history) {
AspectList ret = null;
int value = 0;
List<IInfusionRecipe> recipeList = AuracoreRecipes.getInfusionRecipes();
for (int q = 0; q < recipeList.size(); ++q) {
int idS;
IInfusionRecipe recipe = recipeList.get(q);
int idR = recipe.getRecipeOutput().getItemDamage() < 0 ? 0 : recipe.getRecipeOutput().getItemDamage();
int n = idS = meta < 0 ? 0 : meta;
if (recipe.getRecipeOutput().getItem() != item || idR != idS) continue;
HashMap<ItemSignature, ItemStack> ingredients = new HashMap<>();
AspectList ph = new AspectList();
int cval = 0;
try {
if (recipe instanceof ShapedInfusionCraftingRecipe) {
int width = ((ShapedInfusionCraftingRecipe)recipe).recipeWidth;
int height = ((ShapedInfusionCraftingRecipe)recipe).recipeHeight;
ItemStack[] items = ((ShapedInfusionCraftingRecipe)recipe).recipeItems;
for (int i = 0; i < width && i < 3; ++i) {
for (int j = 0; j < height && j < 3; ++j) {
if (items[i + j * width] == null) continue;
items[i + j * width].stackSize = 1;
if (ingredients.containsKey(new ItemSignature(items[i + j * width]))) {
ItemStack is = (ItemStack)ingredients.get(new ItemSignature(items[i + j * width]));
++is.stackSize;
ingredients.put(new ItemSignature(items[i + j * width]), is);
continue;
}
ingredients.put(new ItemSignature(items[i + j * width]), items[i + j * width]);
}
}
} else {
List<ItemStack> items = ((ShapelessInfusionCraftingRecipe)recipe).recipeItems;
for (int i = 0; i < items.size() && i < 9; ++i) {
if (items.get(i) == null) continue;
((ItemStack)items.get((int)i)).stackSize = 1;
if (ingredients.containsKey(new ItemSignature(items.get((int)i)))) {
ItemStack is = (ItemStack)ingredients.get(new ItemSignature(items.get((int)i)));
++is.stackSize;
ingredients.put(new ItemSignature(items.get((int)i)), is);
continue;
}
ingredients.put(new ItemSignature(items.get((int)i)), items.get(i));
}
}
Collection<ItemStack> ings = ingredients.values();
for (ItemStack is : ings) {
AspectList obj = ThaumcraftCraftingManager.generateTags(is.getItem(), is.getItemDamage(), history);
AspectList objC = null;
if (is.getItem().getContainerItem() != null) {
objC = ThaumcraftCraftingManager.generateTags(is.getItem().getContainerItem(), -1, history);
}
if (obj == null) continue;
for (Aspect as : obj.getAspects()) {
float amnt;
if (objC != null && objC.getAmount(as) > 0 || !((amnt = (float)(obj.getAmount(as) * is.stackSize) / (float)recipe.getRecipeOutput().stackSize) > 0.5f)) continue;
float tmod = 0.8f;
ph.add(as, Math.max(Math.round(amnt * tmod), 1));
cval += Math.max(Math.round(amnt * tmod), 1);
}
}
ph.add(Aspect.MAGIC, Math.round((float)recipe.getCost() / 10.0f / (float)recipe.getRecipeOutput().stackSize));
for (Aspect tag : recipe.getAspects().getAspects()) {
ph.add(tag, Math.round((float)recipe.getAspects().getAmount(tag) / (float)recipe.getRecipeOutput().stackSize));
}
if (cval < value) continue;
ret = ph;
value = cval;
continue;
}
catch (Exception e) {
e.printStackTrace();
}
}
return ret;
}
public static AspectList generateTagsFromCrucibleRecipes(Item item, int meta, ArrayList<List> history) {
CrucibleRecipe cr = AuracoreRecipes.getCrucibleRecipe(new ItemStack(item, 1, meta));
if (cr != null) {
AspectList ot = new AspectList();
int ss = cr.recipeOutput.stackSize;
ot.add(Aspect.MAGIC, Math.round((float)cr.cost / 10.0f));
for (Aspect tt : cr.aspects.getAspects()) {
int amt = cr.aspects.getAmount(tt) / ss;
ot.add(tt, amt);
}
return ot;
}
return null;
}
public static AspectList generateTagsFromArcaneRecipes(Item item, int meta, ArrayList<List> history) {
AspectList ret = null;
int value = 0;
List recipeList = ThaumcraftApi.getCraftingRecipes();
for (int q = 0; q < recipeList.size(); ++q) {
int idS;
if (!(recipeList.get(q) instanceof IArcaneRecipe)) continue;
IArcaneRecipe recipe = (IArcaneRecipe)recipeList.get(q);
if (!(recipe instanceof ShapedArcaneRecipe || recipe instanceof ShapelessArcaneRecipe)) continue;
int idR = recipe.getRecipeOutput().getItemDamage() < 0 ? 0 : recipe.getRecipeOutput().getItemDamage();
int n = idS = meta < 0 ? 0 : meta;
if (recipe.getRecipeOutput().getItem() != item || idR != idS) continue;
HashMap<ItemSignature, ItemStack> ingredients = new HashMap<>();
AspectList ph = new AspectList();
int cval = 0;
try {
if (recipe instanceof ShapedArcaneRecipe) {
int width = ((ShapedArcaneRecipe)recipe).width;
int height = ((ShapedArcaneRecipe)recipe).width;
Object[] items = ((ShapedArcaneRecipe)recipe).input;
for (int i = 0; i < width && i < 3; ++i) {
for (int j = 0; j < height && j < 3; ++j) {
if (items[i + j * width] == null) continue;
ItemStack stack = null;
if (items[i + j * width] instanceof ItemStack) {
stack = (ItemStack) items[i + j * width];
} else if (items[i + j * width] instanceof ArrayList) {
ArrayList<ItemStack> l = (ArrayList<ItemStack>) items[i + j * width];
if (l.size() > 0) {
stack = l.get(0);
}
}
if (stack != null) {
stack.stackSize = 1;
if (ingredients.containsKey(new ItemSignature(stack))) {
ItemStack is = (ItemStack)ingredients.get(new ItemSignature(stack));
++is.stackSize;
ingredients.put(new ItemSignature(stack), is);
continue;
}
ingredients.put(new ItemSignature(stack), stack);
}
}
}
} else {
List<Object> items = ((ShapelessArcaneRecipe)recipe).getInput();
for (int i = 0; i < items.size() && i < 9; ++i) {
if (items.get(i) == null) continue;
ItemStack stack = null;
if (items.get(i) instanceof ItemStack) {
stack = (ItemStack) items.get(i);
} else if (items.get(i) instanceof ArrayList) {
ArrayList<ItemStack> l = (ArrayList<ItemStack>) items.get(i);
if (l.size() > 0){
stack = l.get(0);
}
}
if (stack != null) {
stack.stackSize = 1;
if (ingredients.containsKey(new ItemSignature(stack))) {
ItemStack is = (ItemStack)ingredients.get(new ItemSignature(stack));
++is.stackSize;
ingredients.put(new ItemSignature(stack), is);
continue;
}
ingredients.put(new ItemSignature(stack), stack);
}
}
}
Collection<ItemStack> ings = ingredients.values();
for (ItemStack is : ings) {
AspectList obj = ThaumcraftCraftingManager.generateTags(is.getItem(), is.getItemDamage(), history);
AspectList objC = null;
if (is.getItem().getContainerItem() != null) {
objC = ThaumcraftCraftingManager.generateTags(is.getItem().getContainerItem(), -1, history);
}
if (obj == null) continue;
for (Aspect as : obj.getAspects()) {
float amnt;
if (objC != null && objC.getAmount(as) > 0 || !((amnt = (float)(obj.getAmount(as) * is.stackSize) / (float)recipe.getRecipeOutput().stackSize) > 0.5f)) continue;
float tmod = 0.8f;
ph.add(as, Math.max(Math.round(amnt * tmod), 1));
cval += Math.max(Math.round(amnt * tmod), 1);
}
}
ph.add(Aspect.MAGIC, Math.round((float)AuracoreCraftingManager.getArcaneRecipeVisCost(recipe, null) / 10.0f / (float)recipe.getRecipeOutput().stackSize));
if (cval < value) continue;
ret = ph;
value = cval;
continue;
}
catch (Exception e) {
e.printStackTrace();
}
}
return ret;
}
public static class ItemSignature {
Item item;
int metadata;
public ItemSignature(ItemStack stack) {
this.item = stack.getItem();
this.metadata = stack.getItemDamage();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((item == null) ? 0 : item.hashCode());
result = prime * result + metadata;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ItemSignature other = (ItemSignature) obj;
if (item == null) {
if (other.item != null)
return false;
} else if (!item.equals(other.item))
return false;
if (metadata != other.metadata)
return false;
return true;
}
}
}

View file

@ -41,7 +41,13 @@ public class AuracoreCraftingManager {
public static int getArcaneRecipeVisCost(IArcaneRecipe recipe, TileMagicWorkbench awb) {
if (recipe == null) return 0;
int sum = 0;
AspectList aspects = recipe.getAspects(awb);
AspectList aspects = recipe.getAspects();
if (awb != null) {
aspects = recipe.getAspects(awb);
}
if (aspects == null) {
aspects = new AspectList();
}
for (Aspect aspect : aspects.getAspects()) {
if (aspect != null) sum += aspects.getAmount(aspect);
}

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));
@ -301,6 +302,47 @@ public class LegacyAspects {
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigBlocks.blockCustomOre, 1, 4), (new AspectList()).add(Aspect.EARTH, 1).add(Aspect.EARTH, 3).add(Aspect.CRYSTAL, 2));
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigBlocks.blockCustomOre, 1, 5), (new AspectList()).add(Aspect.EARTH, 1).add(Aspect.ORDER, 3).add(Aspect.CRYSTAL, 2));
ThaumcraftApi.registerObjectTag(new ItemStack(ConfigBlocks.blockCustomOre, 1, 6), (new AspectList()).add(Aspect.EARTH, 1).add(Aspect.ENTROPY, 3).add(Aspect.CRYSTAL, 2));
// Oredict
ThaumcraftApi.registerObjectTag("nuggetIron", new AspectList().add(Aspect.METAL, 1));
ThaumcraftApi.registerObjectTag("nuggetTin", new AspectList().add(Aspect.METAL, 1));
ThaumcraftApi.registerObjectTag("nuggetCopper", new AspectList().add(Aspect.METAL, 1));
ThaumcraftApi.registerObjectTag("nuggetSilver", new AspectList().add(Aspect.METAL, 1));
ThaumcraftApi.registerObjectTag("nuggetLead", new AspectList().add(Aspect.METAL, 1));
ThaumcraftApi.registerObjectTag("dustIron", new AspectList().add(Aspect.METAL, 7).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustGold", new AspectList().add(Aspect.METAL, 7).add(Aspects.VALUABLE, 4).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustCopper", new AspectList().add(Aspect.METAL, 5).add(Aspect.LIFE, 2).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustTin", new AspectList().add(Aspect.METAL, 5).add(Aspect.CRYSTAL, 2).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustSilver", new AspectList().add(Aspect.METAL, 5).add(Aspect.EXCHANGE, 2).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustBrass", new AspectList().add(Aspect.METAL, 5).add(Aspects.CONTROL, 1).add(Aspect.EXCHANGE, 1).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustBronze", new AspectList().add(Aspect.METAL, 5).add(Aspects.CONTROL, 1).add(Aspect.EXCHANGE, 1).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("dustLead", new AspectList().add(Aspect.METAL, 5).add(Aspect.VOID, 2).add(Aspects.DESTRUCTION, 1));
ThaumcraftApi.registerObjectTag("ingotCopper", new AspectList().add(Aspect.METAL, 6).add(Aspect.LIFE, 2));
ThaumcraftApi.registerObjectTag("ingotTin", new AspectList().add(Aspect.METAL, 6).add(Aspect.CRYSTAL, 2));
ThaumcraftApi.registerObjectTag("ingotSilver", new AspectList().add(Aspect.METAL, 6).add(Aspect.EXCHANGE, 2));
ThaumcraftApi.registerObjectTag("ingotLead", new AspectList().add(Aspect.METAL, 6).add(Aspect.VOID, 2));
ThaumcraftApi.registerObjectTag("ingotBrass", new AspectList().add(Aspect.METAL, 6).add(Aspects.CONTROL, 1).add(Aspect.EXCHANGE, 1));
ThaumcraftApi.registerObjectTag("ingotBronze", new AspectList().add(Aspect.METAL, 6).add(Aspects.CONTROL, 1).add(Aspect.EXCHANGE, 1));
ThaumcraftApi.registerObjectTag("ingotRefinedIron", new AspectList().add(Aspect.METAL, 7).add(Aspects.PURE, 1));
ThaumcraftApi.registerObjectTag("ingotSteel", new AspectList().add(Aspect.METAL, 7).add(Aspect.CRAFT, 1));
ThaumcraftApi.registerObjectTag("ingotUranium", new AspectList().add(Aspect.METAL, 6).add(Aspect.POISON, 4).add(Aspect.ENERGY, 6));
ThaumcraftApi.registerObjectTag("oreUranium", new AspectList().add(Aspect.METAL, 6).add(Aspect.POISON, 4).add(Aspect.ENERGY, 6));
ThaumcraftApi.registerObjectTag("oreCopper", new AspectList().add(Aspect.METAL, 5).add(Aspect.EXCHANGE, 1).add(Aspects.ROCK, 2));
ThaumcraftApi.registerObjectTag("oreTin", new AspectList().add(Aspect.METAL, 5).add(Aspects.CONTROL, 1).add(Aspects.ROCK, 2));
ThaumcraftApi.registerObjectTag("oreSilver", new AspectList().add(Aspect.METAL, 5).add(Aspect.EXCHANGE, 1).add(Aspects.ROCK, 2));
ThaumcraftApi.registerObjectTag("dustNikolite", new AspectList().add(Aspect.ENERGY, 2).add(Aspect.MECHANISM, 2));
ThaumcraftApi.registerObjectTag("dustSulfur", new AspectList().add(Aspect.LIFE, 2).add(Aspect.FIRE, 1));
ThaumcraftApi.registerObjectTag("gemRuby", new AspectList().add(Aspect.CRYSTAL, 8).add(Aspects.VALUABLE, 4));
ThaumcraftApi.registerObjectTag("gemGreenSapphire", new AspectList().add(Aspect.CRYSTAL, 8).add(Aspects.VALUABLE, 4));
ThaumcraftApi.registerObjectTag("gemSapphire", new AspectList().add(Aspect.CRYSTAL, 8).add(Aspects.VALUABLE, 4));
ThaumcraftApi.registerObjectTag("woodRubber", new AspectList().add(Aspect.TREE, 6).add(Aspect.MOTION, 1).add(Aspect.TOOL, 1));
ThaumcraftApi.registerObjectTag("itemRubber", new AspectList().add(Aspect.MOTION, 2).add(Aspects.CONTROL, 2));
ThaumcraftApi.registerObjectTag("dropUranium", new AspectList().add(Aspect.METAL, 6).add(Aspect.POISON, 4).add(Aspect.ENERGY, 6));
}
}

View file

@ -124,6 +124,7 @@ public class Utils {
}
public static boolean spendCharge(final ItemStack itemstack, final EntityPlayer player, int amount) {
if (itemstack == null) return false;
final int discount = 100 - Math.min(50, getTotalVisDiscount(player));
amount = Math.round(amount * (discount / 100.0f));
return ((IWand) itemstack.getItem()).consumeVis(itemstack, amount);

View file

@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import dev.tilera.auracore.AuraCore;
import dev.tilera.auracore.api.research.IResearchTable;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@ -48,12 +49,12 @@ public abstract class MixinBlockTable extends BlockContainer {
return true;
} else {
if (tileEntity instanceof TileResearchTable) {
player.openGui(Thaumcraft.instance, 10, world, x, y, z);
((IResearchTable)tileEntity).openGUI(player);
} else {
for(int a = 2; a < 6; ++a) {
TileEntity tile = world.getTileEntity(x + ForgeDirection.getOrientation(a).offsetX, y + ForgeDirection.getOrientation(a).offsetY, z + ForgeDirection.getOrientation(a).offsetZ);
if (tile != null && tile instanceof TileResearchTable) {
player.openGui(Thaumcraft.instance, 10, world, x + ForgeDirection.getOrientation(a).offsetX, y + ForgeDirection.getOrientation(a).offsetY, z + ForgeDirection.getOrientation(a).offsetZ);
if (tile instanceof TileResearchTable) {
((IResearchTable)tile).openGUI(player);
break;
}
}

View file

@ -0,0 +1,92 @@
package dev.tilera.auracore.mixins;
import java.util.ArrayList;
import java.util.List;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.gen.Invoker;
import dev.tilera.auracore.api.Aspects;
import dev.tilera.auracore.crafting.AspectCalculation;
import net.minecraft.item.Item;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
@Mixin(ThaumcraftCraftingManager.class)
public abstract class MixinThaumcraftCraftingManager {
@Invoker(value = "generateTagsFromCrucibleRecipes", remap = false)
public static AspectList invokeGenerateTagsFromCrucibleRecipes(Item item, int meta, ArrayList<List> history) {
throw new RuntimeException();
}
@Invoker(value = "generateTagsFromArcaneRecipes", remap = false)
public static AspectList invokeGenerateTagsFromArcaneRecipes(Item item, int meta, ArrayList<List> history) {
throw new RuntimeException();
}
@Invoker(value = "generateTagsFromInfusionRecipes", remap = false)
public static AspectList invokeGenerateTagsFromInfusionRecipes(Item item, int meta, ArrayList<List> history) {
throw new RuntimeException();
}
@Invoker(value = "generateTagsFromCraftingRecipes", remap = false)
public static AspectList invokeGenerateTagsFromCraftingRecipes(Item item, int meta, ArrayList<List> history) {
throw new RuntimeException();
}
/**
* @author tilera
* @reason recipe tag generation
*/
@Overwrite(remap = false)
private static AspectList generateTagsFromRecipes(Item item, int meta, ArrayList<List> history) {
AspectList ret = null;
ret = AspectCalculation.generateTagsFromCrucibleRecipes(item, meta, history);
if (ret != null) {
return ret;
}
ret = invokeGenerateTagsFromCrucibleRecipes(item, meta, history);
if (ret != null) {
removeVis(ret);
return ret;
}
ret = AspectCalculation.generateTagsFromArcaneRecipes(item, meta, history);
if (ret != null) {
return ret;
}
ret = invokeGenerateTagsFromArcaneRecipes(item, meta, history);
if (ret != null) {
removeVis(ret);
return ret;
}
ret = AspectCalculation.generateTagsFromInfusionRecipes(item, meta, history);
if (ret != null) {
return ret;
}
ret = invokeGenerateTagsFromInfusionRecipes(item, meta, history);
if (ret != null) {
removeVis(ret);
return ret;
}
ret = invokeGenerateTagsFromCraftingRecipes(item, meta, history);
if (ret != null) {
removeVis(ret);
}
return ret;
}
private static void removeVis(AspectList aspects) {
int vis = aspects.getAmount(Aspects.VIS);
if (vis > 0) {
aspects.remove(Aspects.VIS);
int magic = Math.round((float)vis / 10.0f);
aspects.add(Aspect.MAGIC, magic);
}
}
}

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

@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import dev.tilera.auracore.Config;
import dev.tilera.auracore.api.IAlembic;
import dev.tilera.auracore.aura.AuraManager;
import net.minecraft.block.Block;
@ -39,6 +40,8 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
@Shadow(remap = false)
public abstract int tagAmount();
@Shadow(remap = false)
public abstract void spill();
@Shadow(remap = false)
abstract void drawEffects();
boolean spillNextTick = false;
@ -91,8 +94,13 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
}
}
}
AuraManager.addFluxToClosest(this.worldObj, (float) this.xCoord + 0.5f, (float) this.yCoord + 0.5f,
(float) this.zCoord + 0.5f, this.aspects);
if (Config.legacyCrucibleMechanics) {
AuraManager.addFluxToClosest(this.worldObj, (float) this.xCoord + 0.5f, (float) this.yCoord + 0.5f, (float) this.zCoord + 0.5f, this.aspects);
} else {
for(int a = 0; a < this.aspects.visSize() / 2; ++a) {
this.spill();
}
}
this.aspects = new AspectList();
this.markDirty();
@ -143,13 +151,45 @@ public abstract class MixinTileCrucible extends TileThaumcraft implements IAspec
}
}
}
if (this.tagAmount() > 500 && this.counter % 5L == 0L) {
AspectList tt = this.takeRandomFromSource();
AuraManager.addFluxToClosest(this.worldObj, this.xCoord, this.yCoord, this.zCoord, tt);
if (this.tagAmount() <= 500) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
if (Config.legacyCrucibleMechanics) {
if (this.tagAmount() > 500 && this.counter % 5L == 0L) {
AspectList tt = this.takeRandomFromSource();
AuraManager.addFluxToClosest(this.worldObj, this.xCoord, this.yCoord, this.zCoord, tt);
if (this.tagAmount() <= 500) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
} else {
if (this.tagAmount() > 100 && this.counter % 5L == 0L) {
this.takeRandomFromSource();
this.spill();
}
if (this.counter > 100L && this.heat > 150) {
this.counter = 0L;
if (this.tagAmount() > 0) {
int s = this.aspects.getAspects().length;
Aspect a = this.aspects.getAspects()[super.worldObj.rand.nextInt(s)];
if (a.isPrimal()) {
a = this.aspects.getAspects()[super.worldObj.rand.nextInt(s)];
}
this.tank.drain(2, true);
this.aspects.remove(a, 1);
if (!a.isPrimal()) {
if (super.worldObj.rand.nextBoolean()) {
this.aspects.add(a.getComponents()[0], 1);
} else {
this.aspects.add(a.getComponents()[1], 1);
}
} else {
this.spill();
}
}
this.markDirty();
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
}
}
} else if (this.tank.getFluidAmount() > 0) {
this.drawEffects();

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

@ -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

@ -0,0 +1,187 @@
package dev.tilera.auracore.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import dev.tilera.auracore.api.research.IResearchTable;
import dev.tilera.auracore.api.research.ResearchTableExtension;
import dev.tilera.auracore.api.research.ResearchTableExtensionRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.world.World;
import thaumcraft.api.TileThaumcraft;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.tiles.TileResearchTable;
@Mixin(TileResearchTable.class)
public abstract class MixinTileResearchTable extends TileThaumcraft implements IResearchTable {
private ResearchTableExtension extension = null;
@Inject(method = "<init>()V", at = @At("TAIL"), remap = false)
public void constructorHead(CallbackInfo ci) {
if (ResearchTableExtensionRegistry.hasActiveExtension()) {
extension = ResearchTableExtensionRegistry.createInstance(this);
}
}
@Override
public ResearchTableExtension getInternalExtension() {
return extension;
}
@Override
public World getWorld() {
return this.worldObj;
}
@Override
public int getXCoord() {
return this.xCoord;
}
@Override
public int getYCoord() {
return this.yCoord;
}
@Override
public int getZCoord() {
return this.zCoord;
}
@Override
public void openGUI(EntityPlayer player) {
if (extension != null) {
if (extension.openGUI(player)) return;
}
player.openGui(Thaumcraft.instance, 10, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
@Inject(method = "markDirty", at = @At("TAIL"))
public void onMarkDirty(CallbackInfo ci) {
if (extension != null) {
extension.extMarkDirty();
}
}
@Inject(method = "updateEntity", at = @At("TAIL"))
public void onUpdateEntity(CallbackInfo ci) {
if (extension != null) {
extension.onTick();
}
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
if (extension != null) {
String key = extension.getNBTKey();
if (!nbttagcompound.hasKey(key)) return;
NBTTagCompound nbt = nbttagcompound.getCompoundTag(key);
extension.readFromNBT(nbt);
}
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
if (extension != null) {
String key = extension.getNBTKey();
NBTTagCompound nbt = new NBTTagCompound();
extension.writeToNBT(nbt);
nbttagcompound.setTag(key, nbt);
}
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.writeCustomNBT(nbttagcompound);
if (extension != null) {
String key = extension.getNBTKey();
NBTTagCompound nbt = new NBTTagCompound();
extension.writeToPacket(nbt);
nbttagcompound.setTag(key, nbt);
}
return new S35PacketUpdateTileEntity(super.xCoord, super.yCoord, super.zCoord, -999, nbttagcompound);
}
/**
* @author tilera
* @reason ResearchTable extensions
*/
@Overwrite(remap = false)
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
super.onDataPacket(net, pkt);
if (super.worldObj != null && super.worldObj.isRemote) {
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
}
if (extension != null) {
NBTTagCompound nbttagcompound = pkt.func_148857_g();
String key = extension.getNBTKey();
if (!nbttagcompound.hasKey(key)) return;
NBTTagCompound nbt = nbttagcompound.getCompoundTag(key);
extension.readFromNBT(nbt);
}
}
@Inject(method = "getSizeInventory", at = @At("HEAD"), cancellable = true)
public void onGetInventorySize(CallbackInfoReturnable<Integer> ci) {
if (extension instanceof IInventory) {
IInventory ext = (IInventory) extension;
ci.setReturnValue(2 + ext.getSizeInventory());
}
}
@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;
ci.setReturnValue(ext.getStackInSlot(slot - 2));
}
}
@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;
ci.setReturnValue(ext.getStackInSlotOnClosing(slot - 2));
}
}
@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;
ci.setReturnValue(ext.decrStackSize(slot - 2, amt));
}
}
@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;
ext.setInventorySlotContents(slot - 2, stack);
ci.cancel();
}
}
@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;
ci.setReturnValue(ext.isItemValidForSlot(slot - 2, stack));
}
}
}

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;
@ -16,6 +26,7 @@ public class AuraPacket implements IMessage {
public int flux;
public boolean lock;
public byte type;
public boolean virtual;
public AuraPacket() {}
@ -30,6 +41,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 +56,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 +71,20 @@ public class AuraPacket implements IMessage {
buf.writeInt(flux);
buf.writeBoolean(lock);
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

@ -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)) {
@ -80,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);
}
@ -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

@ -12,6 +12,8 @@
"MixinTileArcaneFurnace",
"MixinTileJarFillable",
"MixinTileAlembic",
"MixinTileResearchTable",
"MixinTileNode",
"MixinBlockCustomPlant",
"MixinBlockCustomOre",
"MixinBlockTable",
@ -19,7 +21,8 @@
"MixinEventHandlerEntity",
"MixinThaumcraftWorldGenerator",
"MixinPlayerKnowledge",
"MixinConfigAspects"
"MixinConfigAspects",
"MixinThaumcraftCraftingManager"
],
"client": [
"MixinBlockCustomOreRenderer",