diff --git a/build.gradle b/build.gradle index 45561241..87343a87 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ repositories { } } -version = "1.6.11" +version = "1.6.12" group = "com.mitchej123.hodgepodge" archivesBaseName = "hodgepodge" sourceCompatibility = 1.8 diff --git a/src/main/java/com/mitchej123/hodgepodge/core/HodgepodgeMixinPlugin.java b/src/main/java/com/mitchej123/hodgepodge/core/HodgepodgeMixinPlugin.java index ec841f87..e03dd02c 100644 --- a/src/main/java/com/mitchej123/hodgepodge/core/HodgepodgeMixinPlugin.java +++ b/src/main/java/com/mitchej123/hodgepodge/core/HodgepodgeMixinPlugin.java @@ -182,7 +182,10 @@ public enum MixinSets { Collections.singletonList("fixFireSpread.MixinBlockFire")), TILE_RENDERER_PROFILER("Shows renderer's impact on FPS in vanilla lagometer", () -> config.enableTileRendererProfiler, - Arrays.asList("profiler.TileEntityRendererDispatcherMixin", "profiler.MinecraftMixin")) + Arrays.asList("profiler.TileEntityRendererDispatcherMixin", "profiler.MinecraftMixin")), + ADD_CV_SUPPORT_TO_WAND_PEDESTAL("Add CV support to Thaumcraft wand recharge pedestal", + ()->config.addCVSupportToWandPedestal, + Collections.singletonList("wandPedestalCV.MixinTileWandPedestal")) ; diff --git a/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java b/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java index 4d02864a..55b51d00 100644 --- a/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java +++ b/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java @@ -29,6 +29,7 @@ public class LoadingConfig { public boolean fixGetBlockLightValue; public boolean fixFireSpread; public boolean fixPotionEffectRender; + public boolean addCVSupportToWandPedestal; // ASM public boolean pollutionAsm; public boolean cofhWorldTransformer; @@ -65,6 +66,7 @@ public LoadingConfig(File file) { dropPickedLootOnDespawn = config.get("tweaks", "dropPickedLootOnDespawn", true, "Drop picked loot on entity despawn").getBoolean(); hideIc2ReactorSlots = config.get("tweaks", "hideIc2ReactorSlots", true, "Prevent IC2's reactor's coolant slots from being accessed by automations if not a fluid reactor").getBoolean(); enableTileRendererProfiler = config.get("tweaks", "enableTileRendererProfiler", true, "Shows renderer's impact on FPS in vanilla lagometer").getBoolean(); + addCVSupportToWandPedestal = config.get("tweaks", "addCVSupportToWandPedestal", true, "Add CV support to Thaumcraft wand recharge pedestal").getBoolean(); speedupChunkCoordinatesHashCode = config.get("speedups", "speedupChunkCoordinatesHashCode", true, "Speedup ChunkCoordinates hashCode").getBoolean(); diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/wandPedestalCV/MixinTileWandPedestal.java b/src/main/java/com/mitchej123/hodgepodge/mixins/wandPedestalCV/MixinTileWandPedestal.java new file mode 100644 index 00000000..5141f4fb --- /dev/null +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/wandPedestalCV/MixinTileWandPedestal.java @@ -0,0 +1,53 @@ +package com.mitchej123.hodgepodge.mixins.wandPedestalCV; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import thaumcraft.api.TileThaumcraft; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.visnet.TileVisNode; +import thaumcraft.api.visnet.VisNetHandler; +import thaumcraft.common.items.wands.ItemWandCasting; +import thaumcraft.common.tiles.TileWandPedestal; + +@Mixin(TileWandPedestal.class) +public class MixinTileWandPedestal extends TileThaumcraft { + @Shadow + ArrayList nodes = null; + @Shadow int counter = 0; + + @Redirect(method ="Lthaumcraft/common/tiles/TileWandPedestal;updateEntity()V", + at=@At(value = "INVOKE",target="Lthaumcraft/common/items/wands/ItemWandCasting;getAspectsWithRoom(Lnet/minecraft/item/ItemStack;)Lthaumcraft/api/aspects/AspectList;")) + AspectList getAspectsWithRoomReplacement(ItemWandCasting wand, ItemStack wandstack) + { + AspectList as = wand.getAspectsWithRoom(wandstack); + if (as != null && as.size() > 0) { + for(Aspect aspect : as.getAspects()) { + int drained = VisNetHandler.drainVis(worldObj, xCoord, yCoord, zCoord, aspect, 25); // Pedestal operates every 5 tick + if (drained > 0) + wand.addRealVis(wandstack, aspect, drained, true); + } + } + return as; + } + + @Redirect(method="Lthaumcraft/common/tiles/TileWandPedestal;findNodes()V", at=@At(value="INVOKE", target="Lnet/minecraft/world/World;getTileEntity(III)Lnet/minecraft/tileentity/TileEntity;")) + TileEntity addCVNodes(World w, int x, int y, int z) + { + TileEntity te = this.worldObj.getTileEntity(x, y, z); + if (te instanceof TileVisNode) + nodes.add(new ChunkCoordinates(x, y, z)); + return te; + } +}