Compare commits

..
20 Commits
Author SHA1 Message Date
Kogepan229 4927757ee6 Replace AE2-Unofficial with AE2NH (#115) 2026-11-15 17:36:50 +01:00
Nikolay S.andM R S E e9f605f243 Fix packets (#114)
Co-authored-by: M R S E <[email protected]>\
2026-11-10 11:15:37 -06:00
gorbit99 fc15fb492a Fix talisman of remedium deleting other baubles (#113) 2026-11-09 02:25:10 -06:00
UltraProdigy b3a23f53db ci: run build and test on release branches 2026-11-09 00:56:25 -05:00
Dream Master 28f4def938 update+gradle+bs+deps+gitignore 2026-10-22 12:57:05 +02:00
VortexSo4andVortexSo4 5e12defde0 Capitalize the ore name target once in addAspectLoot (#110)
Co-authored-by: VortexSo4 <[email protected]>
2026-10-22 12:43:35 +02:00
Ranzu e4c8acdd4f Modify Infused Seeds NEI Handler and change some seeds textures (#108)
- Changed infused seed NEI page to use chest slot texture (which was messing with resource packs).
- Change handler id to use mod-like names (so there are different ID (mostly for debug purposes; this is how other mods do it).
- Moved some seeds 1px to the right for consistency (most bottom screenshot).
Co-authored-by: Spaghetti-OberNub <[email protected]>
2026-09-20 11:16:56 +02:00
LazyFlesh 470601170a Modify Infused Seed Drops (#107) 2026-09-03 21:04:38 -05:00
Spaghetti 40c0ea5f53 Adds a NEI Page for Infused Seeds and fixes their drops. (#106) 2026-08-28 11:00:56 +07:00
Jason Mitchell 18c787153c Fixes for [Client thread/ERROR]: Couldn't render entity (#104) 2026-08-15 15:43:01 -07:00
__felix__ dc9e4688a3 fix gt loader check (#103) 2026-07-29 11:54:32 -04:00
vladislemon 853ad538df Fix thaumic restorer suction + better automation (#102) 2026-07-15 15:15:43 +00:00
Martin Robertz d8b69c4311 deps 2026-06-28 13:56:16 +02:00
Algent c8d5cf92d2 Fix dropping backpack keeping GUI open (#98) 2026-06-28 03:16:47 +02:00
koolkrafter5 a0f95ee27b Drain power from electric hoe of growth instead of damaging it (#100) 2026-06-25 23:01:10 +02:00
Martin Robertz c27af147bf update deps 2026-06-19 21:11:35 +02:00
koolkrafter5 c101bb2e6d Wither Skeleton Summoning Remake (#99) 2026-06-17 11:16:53 +02:00
6c25bcee2a Tablet of Necromancy Handler (#93)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Martin Robertz <[email protected]>
2026-06-16 14:23:57 -04:00
Martin Robertz 1f3e772def update+deps+bs+gradle 2026-06-12 21:59:28 +02:00
xXjudeXx a6047ee7ec Awakened Ichorium Pickaxe Fixes (#97) 2026-06-12 21:26:52 +02:00
70 changed files with 1349 additions and 872 deletions

No files matched your search

+2 -2
View File
@@ -3,9 +3,9 @@ name: Build and test
on:
pull_request:
branches: [ master, main ]
branches: [ master, main, release/** ]
push:
branches: [ master, main ]
branches: [ master, main, release/** ]
jobs:
build-and-test:
+15 -16
View File
@@ -1,28 +1,27 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev')
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.25-GTNH:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-882-GTNH:api')
api('com.github.GTNewHorizons:ThaumicBoots:1.5.8:dev') {transitive=false}
api('com.github.GTNewHorizons:Applied-Energistics-2-NH:1.0.2:api')
api('com.github.GTNewHorizons:ThaumicBoots:1.5.13:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Botania:1.13.16-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.12:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.22:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.3:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.19.22:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.46-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.3:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.22-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:Botania:1.13.39-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.49:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.9:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.19.34:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.120-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.18:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.22:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:api') {transitive=false}
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.399:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.54.242:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
compileOnly('curse.maven:computercraft-67504:2269339')
compileOnly('curse.maven:cofh-core-69162:2388751')
// For testing purposes
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.20:dev")
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.25:dev")
runtimeOnly(rfg.deobf('curse.maven:thaumcraft-nei-plugin-225095:2241913'))
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.13:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:AspectRecipeIndex:1.1.5:dev')
}
+6 -1
View File
@@ -115,7 +115,7 @@ usesMixins = true
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = true
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
@@ -186,6 +186,11 @@ modrinthRelations =
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
# Use client or server for mods that only support one environment. Defaults to client,server.
# These tags describe where the mod can run, not whether installation is required on both sides.
curseForgeEnvironments = client,server
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
+10 -10
View File
@@ -1,12 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
toolchainVersion=25
Binary file not shown.
+3 -1
View File
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+3 -3
View File
@@ -20,7 +20,7 @@
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
# gradlew start up script for POSIX generated by Gradle.
#
# Important for running:
#
@@ -29,7 +29,7 @@
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
# ksh gradlew
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Vendored
+12 -23
View File
@@ -19,12 +19,12 @@
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem gradlew startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -51,7 +51,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
"%COMSPEC%" /c exit 1
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -65,29 +65,18 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
"%COMSPEC%" /c exit 1
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
@rem Execute gradlew
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.24"
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.34"
}
@@ -23,7 +23,6 @@ import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -60,6 +59,7 @@ import thaumic.tinkerer.common.block.tile.TileRepairer;
import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
import thaumic.tinkerer.common.compat.FumeTool;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
@@ -80,7 +80,7 @@ public final class TTClientProxy extends TTCommonProxy {
public void preInit(FMLPreInitializationEvent event) {
super.preInit(event);
FMLCommonHandler.instance().bus().register(this);
if (Loader.isModLoaded("ComputerCraft")) {
if (LoadedMods.computerCraftLoaded) {
MinecraftForge.EVENT_BUS.register(new FumeTool());
}
@@ -154,9 +154,11 @@ public final class TTClientProxy extends TTCommonProxy {
RenderingRegistry.registerBlockHandler(new RenderMagnet());
RenderingRegistry.registerBlockHandler(new RenderRepairer());
RenderMobDisplay mobDisplayRenderer = new RenderMobDisplay();
MinecraftForge.EVENT_BUS.register(mobDisplayRenderer);
MinecraftForgeClient.registerItemRenderer(
ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class),
new RenderMobDisplay());
mobDisplayRenderer);
MinecraftForgeClient.registerItemRenderer(
ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class),
new RenderGenericSeeds());
@@ -127,11 +127,11 @@ public class GuiEnchanting extends GuiContainer {
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.id == 0) {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking());
} else if (par1GuiButton.id <= 16) {
GuiButtonEnchantment button = enchantButtons[par1GuiButton.id - 1];
if (button != null && button.enchant != null) ThaumicTinkerer.netHandler
.sendToServer(new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
if (button != null && button.enchant != null)
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(button.enchant.effectId, 0));
} else {
int type = (par1GuiButton.id - 17) % 3;
int index = (par1GuiButton.id - 17) / 3;
@@ -143,20 +143,15 @@ public class GuiEnchanting extends GuiContainer {
Enchantment enchant = Enchantment.enchantmentsList[enchanter.enchantments.get(index)];
switch (type) {
case 0: {
ThaumicTinkerer.netHandler
.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
break;
case 0 -> {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchant.effectId, -1));
}
case 1: {
ThaumicTinkerer.netHandler.sendToServer(
new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level == 1 ? -1 : level - 1));
break;
}
case 2: {
case 1 -> {
ThaumicTinkerer.netHandler
.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
break;
.sendToServer(new PacketEnchanterAddEnchant(enchant.effectId, level == 1 ? -1 : level - 1));
}
case 2 -> {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchant.effectId, level + 1));
}
}
}
@@ -37,9 +37,8 @@ public class GuiMobMagnet extends GuiContainer {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
int x, y;
private int x, y;
ItemStack stack = null;
TileMobMagnet mobMagnet;
List<IRadioButton> radioButtons = new ArrayList<>();
@@ -64,11 +63,14 @@ public class GuiMobMagnet extends GuiContainer {
}
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
else buttonList.get(0).enabled = !buttonList.get(0).enabled;
protected void actionPerformed(GuiButton button) {
if (button instanceof IRadioButton rButton) {
rButton.enableFromClick();
} else {
buttonList.get(0).enabled = !buttonList.get(0).enabled;
}
mobMagnet.adult = buttonList.get(0).enabled;
mobMagnet.setAdult(buttonList.get(0).enabled);
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
}
@@ -80,7 +82,7 @@ public class GuiMobMagnet extends GuiContainer {
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
String adult = StatCollector.translateToLocal("ttmisc.adult");
String child = StatCollector.translateToLocal("ttmisc.child");
stack = mobMagnet.getStackInSlot(0);
ItemStack stack = mobMagnet.getStackInSlot(0);
String filter;
@@ -10,7 +10,6 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import thaumcraft.api.aspects.Aspect;
import thaumic.tinkerer.client.gui.button.GuiButtonRP;
import thaumic.tinkerer.client.gui.button.GuiButtonRPRadio;
import thaumic.tinkerer.client.gui.button.IRadioButton;
@@ -30,7 +29,6 @@ public class GuiRemotePlacer extends GuiContainer {
int x, y;
List<IRadioButton> radioButtons = new ArrayList<>();
TileRPlacer placer;
Aspect aspectHovered = null;
public GuiRemotePlacer(TileRPlacer placer, InventoryPlayer inv) {
super(new ContainerRemotePlacer(placer, inv));
@@ -21,16 +21,14 @@ public class GuiButtonMM extends GuiButton {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
public boolean enabled = false;
public GuiButtonMM(int par1, int par2, int par3, boolean enabled) {
super(par1, par2, par3, 13, 13, "");
public GuiButtonMM(int buttonId, int x, int y, boolean enabled) {
super(buttonId, x, y, 13, 13, "");
this.enabled = enabled;
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (enabled) {
if (visible) {
par1Minecraft.renderEngine.bindTexture(gui);
int y = enabled ? 13 : 0;
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
@@ -17,8 +17,8 @@ public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
List<IRadioButton> linkedButtons;
public GuiButtonMMRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
super(par1, par2, par3, enabled);
public GuiButtonMMRadio(int buttonId, int x, int y, boolean enabled, List<IRadioButton> linkedButtons) {
super(buttonId, x, y, enabled);
this.linkedButtons = linkedButtons;
}
@@ -41,7 +41,7 @@ public class GuiWarpGate extends GuiContainer {
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
((GuiButtonWG) par1GuiButton).enabled = !((GuiButtonWG) par1GuiButton).enabled;
warpGate.locked = ((GuiButtonWG) par1GuiButton).enabled;
warpGate.setLocked(((GuiButtonWG) par1GuiButton).enabled);
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateButton(warpGate));
}
@@ -37,7 +37,7 @@ import thaumic.tinkerer.common.network.packet.kami.PacketWarpGateTeleport;
public class GuiWarpGateDestinations extends GuiScreen {
private static ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
private static final ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
TileWarpGate warpGate;
RenderItem render = new RenderItem();
@@ -32,6 +32,7 @@ public final class LibResources {
public static final String GUI_ICHOR_POUCH = PREFIX_GUI + "ichorPouch.png";
public static final String GUI_WARP_GATE = PREFIX_GUI + "warpGate.png";
public static final String GUI_REMOTE_PLACER = PREFIX_GUI + "remotePlacer.png";
public static final String NEI_RECIPE_ARROW = PREFIX_GUI + "neiRecipeArrow.png";
public static final String MISC_R_ENCHANTING = PREFIX_MISC + "r_enchanting.png";
public static final String MISC_AT_CENTER = PREFIX_MISC + "atCenter.png";
@@ -0,0 +1,41 @@
package thaumic.tinkerer.client.nei;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import thaumic.tinkerer.common.compat.LoadedMods;
public class NEIConfig implements IConfigureNEI {
@Override
public void loadConfig() {
if (!LoadedMods.aspectRecipeIndexLoaded) return;
AspectRecipeIndexIntegration.register();
NEIInfusedSeedRecipeHandler seedHandler = new NEIInfusedSeedRecipeHandler();
API.registerRecipeHandler(seedHandler);
API.registerUsageHandler(seedHandler);
}
@Override
public String getName() {
return "Thaumic Tinkerer NEI";
}
@Override
public String getVersion() {
return "1.0";
}
// This needs to be an inner class to prevent a NoClassDefFoundError from class loading when ARI isn't loaded.
private static class AspectRecipeIndexIntegration {
public static void register() {
TemplateRecipeHandler handler = new NEINecromancyHandler();
GuiCraftingRecipe.craftinghandlers.add(handler);
GuiUsageRecipe.usagehandlers.add(handler);
}
}
}
@@ -0,0 +1,251 @@
package thaumic.tinkerer.client.nei;
import static thaumic.tinkerer.client.lib.LibResources.NEI_RECIPE_ARROW;
import java.awt.Rectangle;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import thaumcraft.api.aspects.Aspect;
import thaumic.tinkerer.common.core.helper.AspectCropLootManager;
import thaumic.tinkerer.common.core.helper.AspectCropLootManager.LootEntry;
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
public class NEIInfusedSeedRecipeHandler extends TemplateRecipeHandler {
public static final String OVERLAY = "thaumictinkerer.infusedseeds";
private static final int SLOT_NUM_X = 9;
private static final int SLOT_TEXTURE_U = 7;
private static final int SLOT_TEXTURE_V = 17;
private static final DecimalFormat CHANCE_FORMAT = new DecimalFormat("#.##");
public static class DropInfo {
public final ItemStack stack;
public final float chance;
public DropInfo(ItemStack stack, float chance) {
this.stack = stack;
this.chance = chance;
}
}
public static class SeedDropRecipeWrapper {
public final ItemStack seed;
public final List<DropInfo> drops;
public SeedDropRecipeWrapper(ItemStack seed, List<DropInfo> drops) {
this.seed = seed;
this.drops = drops;
}
}
public class CachedSeedRecipe extends CachedRecipe {
private final List<PositionedStack> input = new ArrayList<>();
private final List<PositionedStack> outputs = new ArrayList<>();
public final SeedDropRecipeWrapper wrapper;
public int rows = 0;
public CachedSeedRecipe(SeedDropRecipeWrapper recipe) {
this.wrapper = recipe;
this.input.add(new PositionedStack(recipe.seed, 74, 4));
int row = 0;
int col = 0;
for (DropInfo drop : recipe.drops) {
int xPos = 3 + 18 * col;
int yPos = 36 + 18 * row;
this.outputs.add(new PositionedStack(drop.stack, xPos, yPos));
col++;
if (col >= SLOT_NUM_X) {
col = 0;
row++;
}
}
this.rows = col == 0 ? row - 1 : row;
if (this.rows < 0) this.rows = 0;
}
@Override
public List<PositionedStack> getIngredients() {
return input;
}
@Override
public PositionedStack getResult() {
return null;
}
@Override
public List<PositionedStack> getOtherStacks() {
return outputs;
}
}
private List<SeedDropRecipeWrapper> getSeedRecipes() {
List<SeedDropRecipeWrapper> recipes = new ArrayList<>();
Map<Aspect, List<LootEntry>> allLoot = AspectCropLootManager.getAllLoot();
for (Map.Entry<Aspect, List<LootEntry>> entry : allLoot.entrySet()) {
Aspect aspect = entry.getKey();
List<LootEntry> lootList = entry.getValue();
if (lootList == null || lootList.isEmpty()) continue;
int totalWeight = 0;
for (LootEntry loot : lootList) {
totalWeight += loot.weight;
}
List<DropInfo> drops = new ArrayList<>();
for (LootEntry loot : lootList) {
if (loot.stack != null) {
float chance = ((float) loot.weight / totalWeight) * 100f;
drops.add(new DropInfo(loot.stack.copy(), chance));
}
}
ItemStack seedStack = ItemInfusedSeeds.getStackFromAspect(aspect);
recipes.add(new SeedDropRecipeWrapper(seedStack, drops));
}
return recipes;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(73, 22, 18, 12), getOverlayIdentifier()));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier()) && getClass() == NEIInfusedSeedRecipeHandler.class) {
for (SeedDropRecipeWrapper recipe : getSeedRecipes()) {
arecipes.add(new CachedSeedRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (SeedDropRecipeWrapper recipe : getSeedRecipes()) {
for (DropInfo drop : recipe.drops) {
if (NEIServerUtils.areStacksSameTypeCrafting(result, drop.stack)) {
arecipes.add(new CachedSeedRecipe(recipe));
break;
}
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (ingredient != null && ingredient.getItem() instanceof ItemInfusedSeeds) {
Aspect aspectIn = ItemInfusedSeeds.getAspect(ingredient);
if (aspectIn != null) {
for (SeedDropRecipeWrapper recipe : getSeedRecipes()) {
Aspect aspectRecipe = ItemInfusedSeeds.getAspect(recipe.seed);
if (aspectIn == aspectRecipe || aspectIn.getTag().equals(aspectRecipe.getTag())) {
arecipes.add(new CachedSeedRecipe(recipe));
}
}
}
}
}
@Override
public int getRecipeHeight(int recipeIndex) {
return 36 + 18 * (((CachedSeedRecipe) this.arecipes.get(recipeIndex)).rows + 1) + 6;
}
@Override
public void drawBackground(int recipeIndex) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(74, 3, SLOT_TEXTURE_U, SLOT_TEXTURE_V, 18, 18);
CachedSeedRecipe recipe = (CachedSeedRecipe) this.arecipes.get(recipeIndex);
int totalDrops = recipe.outputs.size();
int rows = Math.max(1, (totalDrops + SLOT_NUM_X - 1) / SLOT_NUM_X);
int totalSlotsToDraw = rows * SLOT_NUM_X;
for (int i = 0; i < totalSlotsToDraw; i++) {
int col = i % SLOT_NUM_X;
int row = i / SLOT_NUM_X;
int xPos = 2 + 18 * col;
int yPos = 35 + 18 * row;
GuiDraw.drawTexturedModalRect(xPos, yPos, SLOT_TEXTURE_U, SLOT_TEXTURE_V, 18, 18);
}
GuiDraw.changeTexture(NEI_RECIPE_ARROW);
GuiDraw.drawTexturedModalRect(74, 20, 0, 0, 18, 14);
}
@Override
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipeIndex) {
CachedSeedRecipe recipe = (CachedSeedRecipe) this.arecipes.get(recipeIndex);
for (DropInfo drop : recipe.wrapper.drops) {
if (NEIServerUtils.areStacksSameTypeCrafting(stack, drop.stack)) {
String chancePrefix = StatCollector.translateToLocal("tt.nei.chance");
String chanceStr = CHANCE_FORMAT.format(drop.chance) + "%";
currenttip.add(EnumChatFormatting.GRAY + chancePrefix + ": " + EnumChatFormatting.YELLOW + chanceStr);
break;
}
}
return currenttip;
}
@Override
public String getGuiTexture() {
return "minecraft:textures/gui/container/generic_54.png";
}
@Override
public String getOverlayIdentifier() {
return OVERLAY;
}
@Override
public String getHandlerId() {
return NEIInfusedSeedRecipeHandler.class.getName();
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("tt.nei.category.infusedseeds");
}
}
@@ -0,0 +1,139 @@
package thaumic.tinkerer.client.nei;
import java.util.Arrays;
import net.glease.tc4tweak.api.infusionrecipe.RecipeIngredient;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.gtnewhorizons.aspectrecipeindex.nei.InfusionRecipeHandler;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
import thaumic.tinkerer.common.item.ItemMobAspect;
import thaumic.tinkerer.common.item.ItemMobDisplay;
public class NEINecromancyHandler extends InfusionRecipeHandler {
public static final String OVERLAY = "thaumictinkerer.necromancy";
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("tile.spawner.name");
}
@Override
public String getOverlayIdentifier() {
return OVERLAY;
}
@Override
public int getRecipeHeight(int recipe) {
return 0;
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(this.getOverlayIdentifier())) {
for (EnumMobAspect value : EnumMobAspect.values()) {
new NecromancyCachedRecipe(value);
}
} else if (outputId.equals("item")) {
this.loadCraftingRecipes((ItemStack) results[0]);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if (result.getItem() instanceof ItemMobDisplay display) {
EnumMobAspect type = display.getEntityType(result);
for (EnumMobAspect value : EnumMobAspect.values()) {
if (value == type) {
new NecromancyCachedRecipe(value);
break;
}
}
}
loadUsageRecipes(result);
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (!(ingredient.getItem() instanceof ItemMobAspect)) {
return;
}
Aspect target = ItemMobAspect.getAspect(ingredient);
if (target == null) return;
for (EnumMobAspect value : EnumMobAspect.values()) {
for (Aspect aspect : value.aspects) {
if (aspect == target) {
new NecromancyCachedRecipe(value);
break;
}
}
}
}
@Override
public void loadUsageRecipes(String inputId, Object... ingredients) {
loadCraftingRecipes(inputId, ingredients);
}
@Override
public void drawBackground(int recipeIndex) {
GL11.glPushMatrix();
GuiDraw.changeTexture(THAUM_OVERLAYS);
GL11.glEnable(GL11.GL_BLEND);
GL11.glScalef(1.75F, 1.75F, 1.0F);
GL11.glTranslatef(-0.5F, -1F, 0);
GuiDraw.drawTexturedModalRect(27, 8, 207, 78, 42, 42); // Runic matrix drawing
GL11.glTranslatef(0.5F, 1F, 0);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@Override
public void drawInstability(int recipeIndex) {}
@Override
public void drawExtras(int recipeIndex) {
drawSeeAllRecipesLabel(2);
}
protected class NecromancyCachedRecipe extends InfusionCachedRecipe {
public NecromancyCachedRecipe(EnumMobAspect enumMobAspect) {
super(0, true);
setIngredients(enumMobAspect.aspects);
setResult(enumMobAspect);
this.aspects = new AspectList();
addIfValid();
}
private void setResult(EnumMobAspect enumMobAspect) {
ItemStack result = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class));
((ItemMobDisplay) result.getItem()).setEntityType(result, enumMobAspect);
this.result = new PositionedStack(result, OUTPUT_X, 39, false);
}
private void setIngredients(Aspect[] aspects) {
if (aspects.length < 3) return;
addSurroundingItems(
Arrays.asList(
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[0])),
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[1])),
RecipeIngredient.item(true, ItemMobAspect.getStackFromAspect(aspects[2]))));
}
@Override
protected int itemOffset() {
return -24;
}
}
}
@@ -1,20 +1,43 @@
package thaumic.tinkerer.client.render.item;
import java.util.EnumMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.event.world.WorldEvent;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
import thaumic.tinkerer.common.item.ItemMobDisplay;
public class RenderMobDisplay implements IItemRenderer {
private static final int ATTRIB_MASK = GL11.GL_ENABLE_BIT | GL11.GL_CURRENT_BIT
| GL11.GL_DEPTH_BUFFER_BIT
| GL11.GL_COLOR_BUFFER_BIT
| GL11.GL_LIGHTING_BIT
| GL11.GL_TEXTURE_BIT;
private final EnumMap<EnumMobAspect, EntityLiving> cache = new EnumMap<>(EnumMobAspect.class);
private World cachedWorld;
private void setCachedWorld(World world) {
cache.clear();
cachedWorld = world;
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world == cachedWorld) setCachedWorld(null);
}
@Override
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
return true;
@@ -28,67 +51,34 @@ public class RenderMobDisplay implements IItemRenderer {
@Override
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
if (!(itemStack.getItem() instanceof ItemMobDisplay item)) return;
EnumMobAspect aspect = item.getEntityType(itemStack);
Entity entity = null;
float f1 = 0.4f;
float verticalOffset = 0.0f;
if (aspect != null) {
entity = EnumMobAspect.getEntityFromCache(aspect, null);
f1 = aspect.getScale();
verticalOffset = aspect.getVerticalOffset();
}
switch (itemRenderType) {
case ENTITY:
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
GL11.glScalef(f1, f1, f1);
EntityItem eItem = (EntityItem) objects[1];
if (entity != null) {
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
if (entity.worldObj != null) {
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
entity.setWorld(eItem.worldObj);
entity.copyLocationAndAnglesFrom(eItem);
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
// if (renderWithLighting) RenderUtils.enableLightmap();
renderer.doRender(entity, 0, 0, 0, 0, 0);
GL11.glPopAttrib();
}
}
entity.worldObj = null;
}
GL11.glPopMatrix();
case EQUIPPED:
break;
case EQUIPPED_FIRST_PERSON:
break;
case INVENTORY:
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
GL11.glScalef(f1, f1, f1);
if (entity != null) {
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
if (entity.worldObj != null) {
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
// if (renderWithLighting) RenderUtils.enableLightmap();
renderer.doRender(entity, 0, 0, 0, 0, 0);
GL11.glPopAttrib();
}
}
entity.worldObj = null;
}
GL11.glPopMatrix();
if (aspect == null) return;
case FIRST_PERSON_MAP:
break;
final World world = Minecraft.getMinecraft().theWorld;
if (world != cachedWorld) setCachedWorld(world);
if (world == null) return;
EntityLiving entity = cache.get(aspect);
if (entity == null || entity.worldObj != world) {
entity = aspect.createEntity(world);
cache.put(aspect, entity);
}
final Render renderer = RenderManager.instance.getEntityRenderObject(entity);
if (renderer == null || renderer.getFontRendererFromRenderManager() == null) return;
float scale = aspect.getScale();
GL11.glPushMatrix();
GL11.glPushAttrib(ATTRIB_MASK);
try {
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0, (-entity.height / 2) + aspect.getVerticalOffset(), 0.0F);
renderer.doRender(entity, 0, 0, 0, 0, 0);
} finally {
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}
}
@@ -17,7 +17,6 @@ import net.minecraftforge.common.DimensionManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@@ -34,6 +33,7 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import thaumcraft.common.CommonProxy;
import thaumcraft.common.Thaumcraft;
import thaumic.tinkerer.api.InterModCommsOperations;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
import thaumic.tinkerer.common.dim.WorldProviderBedrock;
@@ -51,10 +51,6 @@ public class ThaumicTinkerer {
@SidedProxy(clientSide = LibMisc.CLIENT_PROXY, serverSide = LibMisc.COMMON_PROXY)
public static TTCommonProxy proxy;
public static boolean isBootsActive = false;
public static boolean gtLoaded;
public static final String BOOTS = "thaumicboots";
public static CommonProxy tcProxy;
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
@@ -67,16 +63,12 @@ public class ThaumicTinkerer {
log = event.getModLog();
tcProxy = Thaumcraft.proxy;
proxy.preInit(event);
if (Loader.isModLoaded("Waila")) {
if (LoadedMods.wailaLoaded) {
FMLInterModComms.sendMessage(
"Waila",
"register",
"thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
}
if (Loader.isModLoaded(BOOTS)) {
isBootsActive = true;
}
gtLoaded = Loader.isModLoaded("gregtech");
}
@EventHandler
@@ -111,7 +103,7 @@ public class ThaumicTinkerer {
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
}
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_CC_BLACKLIST)) {
if (Loader.isModLoaded("ComputerCraft")) blackListCCDevices(message.getStringValue());
if (LoadedMods.computerCraftLoaded) blackListCCDevices(message.getStringValue());
}
}
}
@@ -25,7 +25,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.Loader;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
@@ -34,6 +33,7 @@ import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.client.core.helper.IconHelper;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.tile.TileAspectAnalyzer;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibGuiIDs;
import thaumic.tinkerer.common.lib.LibResearch;
@@ -141,7 +141,7 @@ public class BlockAspectAnalyzer extends BlockModContainer {
@Override
public boolean shouldRegister() {
return Loader.isModLoaded("ComputerCraft");
return LoadedMods.computerCraftLoaded;
}
@Override
@@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.Loader;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
@@ -16,6 +15,7 @@ import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.common.block.tile.TileCamo;
import thaumic.tinkerer.common.block.tile.TileGolemConnector;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ThaumicTinkererArcaneRecipe;
@@ -53,7 +53,7 @@ public class BlockGolemConnector extends BlockCamo {
@Override
public boolean shouldRegister() {
return Loader.isModLoaded("ComputerCraft");
return LoadedMods.computerCraftLoaded;
}
@Override
@@ -199,8 +199,7 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
if (tile != null && tile instanceof TileRPlacer) {
TileRPlacer placer = (TileRPlacer) tile;
if (tile instanceof TileRPlacer placer) {
placer.receiveRedstonePulse();
}
}
@@ -29,7 +29,6 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import thaumcraft.api.aspects.Aspect;
@@ -39,6 +38,7 @@ import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.client.lib.LibRenderIDs;
import thaumic.tinkerer.common.block.tile.TileRepairer;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.compat.TinkersConstructCompat;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibResearch;
@@ -127,7 +127,7 @@ public class BlockRepairer extends BlockModContainer {
itemstack.stackSize -= k1;
int dmg;
if (Loader.isModLoaded("TConstruct")) {
if (LoadedMods.TConstructLoaded) {
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
dmg = TinkersConstructCompat.getDamage(itemstack);
} else dmg = itemstack.getItemDamage();
@@ -8,9 +8,9 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import cpw.mods.fml.common.Loader;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.mobilizer.BlockMobilizer;
import thaumic.tinkerer.common.compat.LoadedMods;
public class TileEntityMobilizer extends TileEntity {
@@ -140,7 +140,7 @@ public class TileEntityMobilizer extends TileEntity {
}
}
// If AE is installed, use its handler
} else if (Loader.isModLoaded("appliedenergistics2")) {
} else if (LoadedMods.AE2Loaded) {
IAppEngApi api = AEApi.instance();
if (api.registries().movable().askToMove(passenger)) {
worldObj.setBlock(
@@ -180,6 +180,12 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
return true;
}
public void setAdult(boolean adult) {
this.adult = adult;
this.markDirty();
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public String[] getMethodNames() {
return new String[] { "isPulling", "setPulling", "getSignal", "getAdultSearch", "setAdultSearch" };
@@ -198,9 +204,7 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
}
private Object[] setAdultSearchImplementation(boolean argument) {
this.adult = argument;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
setAdult(argument);
return null;
}
@@ -34,7 +34,7 @@ public class TileRPlacer extends TileCamo implements IInventory {
super.readCustomNBT(cmp);
orientation = cmp.getInteger(TAG_ORIENTATION);
blocks = cmp.getInteger(TAG_BLOCKS);
blocks = Math.max(1, Math.min(cmp.getInteger(TAG_BLOCKS), 4));
NBTTagList var2 = cmp.getTagList("Items", Constants.NBT.TAG_COMPOUND);
inventorySlots = new ItemStack[getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
@@ -198,7 +198,7 @@ public class TileRPlacer extends TileCamo implements IInventory {
z = this.zCoord;
break;
case 5:
x = this.xCoord - this.blocks;
x = this.xCoord + this.blocks;
y = this.yCoord;
z = this.zCoord;
break;
@@ -237,4 +237,10 @@ public class TileRPlacer extends TileCamo implements IInventory {
}
}
public void setDistance(int distance) {
blocks = Math.max(1, Math.min(distance, 4));
this.markDirty();
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@@ -26,7 +26,6 @@ import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
@@ -34,6 +33,7 @@ import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.compat.TinkersConstructCompat;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.lib.LibBlockNames;
@@ -73,7 +73,7 @@ public class TileRepairer extends TileEntity
boolean oldTookLastTick = tookLastTick;
tookLastTick = false;
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
if (LoadedMods.TConstructLoaded && ConfigHandler.repairTConTools) {
if (inventorySlots[0] != null) {
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
int dmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
@@ -237,20 +237,15 @@ public class TileRepairer extends TileEntity
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
return itemstack != null;
}
}
return itemstack != null && itemstack.getItem().isRepairable();
return isRepairable(itemstack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
return true;
return !isRepairable(itemstack);
}
int drawEssentia() {
private int drawEssentia() {
ForgeDirection orientation = getOrientation();
TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, orientation);
if (te != null) {
@@ -265,7 +260,7 @@ public class TileRepairer extends TileEntity
return 0;
}
ForgeDirection getOrientation() {
private ForgeDirection getOrientation() {
return ForgeDirection.getOrientation(getBlockMetadata());
}
@@ -273,9 +268,12 @@ public class TileRepairer extends TileEntity
public AspectList getAspects() {
ItemStack stack = inventorySlots[0];
if (stack == null) return null;
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
if (TinkersConstructCompat.isTConstructTool(stack))
if (LoadedMods.TConstructLoaded && TinkersConstructCompat.isTConstructTool(stack)) {
if (ConfigHandler.repairTConTools) {
return new AspectList().add(Aspect.ENTROPY, TinkersConstructCompat.getDamage(stack));
} else {
return null;
}
}
return new AspectList().add(Aspect.ENTROPY, stack.getItemDamage());
}
@@ -369,7 +367,7 @@ public class TileRepairer extends TileEntity
@Override
public int getSuctionAmount(ForgeDirection arg0) {
return arg0 == getOrientation() ? 128 : 0;
return arg0 == getOrientation() && containsRepairableStack() ? 128 : 0;
}
@Override
@@ -386,4 +384,19 @@ public class TileRepairer extends TileEntity
@Override
@Optional.Method(modid = "appliedenergistics2")
public void doneMoving() {}
private boolean containsRepairableStack() {
return isRepairable(inventorySlots[0]);
}
private boolean isRepairable(ItemStack stack) {
if (stack == null) {
return false;
}
if (LoadedMods.TConstructLoaded && TinkersConstructCompat.isTConstructTool(stack)) {
return ConfigHandler.repairTConTools && TinkersConstructCompat.getDamage(stack) > 0;
}
return stack.getItem() != null && stack.getItem().isRepairable() && stack.getItemDamage() > 0;
}
}
@@ -3,10 +3,10 @@ package thaumic.tinkerer.common.block.tile;
import java.util.ArrayList;
import java.util.Arrays;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.api.aspects.Aspect;
@@ -19,121 +19,115 @@ public class TileSummon extends TileEntity {
@Override
public void updateEntity() {
if (worldObj.getTotalWorldTime() % 300 != 0
|| worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
return;
}
if (worldObj.getTotalWorldTime() % 300 == 0) {
if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
return;
}
for (int radius = 1; radius < 6; radius++) {
ArrayList<TileEntity> pedestals = new ArrayList<>();
for (int x = xCoord - radius; x <= xCoord + radius; x++) {
for (int z = zCoord - radius; z <= zCoord + radius; z++) {
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
if (tile instanceof TilePedestal && ((TilePedestal) tile).getStackInSlot(0) != null
&& ((TilePedestal) tile).getStackInSlot(0).getItem() instanceof ItemMobAspect) {
pedestals.add(tile);
}
for (int radius = 1; radius < 6; radius++) {
ArrayList<TilePedestal> pedestals = new ArrayList<>();
for (int x = xCoord - radius; x <= xCoord + radius; x++) {
for (int z = zCoord - radius; z <= zCoord + radius; z++) {
TileEntity tile = worldObj.getTileEntity(x, yCoord, z);
if (tile instanceof TilePedestal pedestal && pedestal.getStackInSlot(0) != null
&& pedestal.getStackInSlot(0).getItem() instanceof ItemMobAspect) {
pedestals.add(pedestal);
}
}
}
for (int i = 0; i < pedestals.size(); i++) {
for (int j = 0; j < pedestals.size(); j++) {
for (TileEntity pedestal : pedestals) {
TilePedestal ped1 = (TilePedestal) pedestals.get(i);
TilePedestal ped2 = (TilePedestal) pedestals.get(j);
TilePedestal ped3 = (TilePedestal) pedestal;
for (int i = 0; i < pedestals.size(); i++) {
for (int j = 0; j < pedestals.size(); j++) {
for (TilePedestal ped3 : pedestals) {
TilePedestal ped1 = pedestals.get(i);
TilePedestal ped2 = pedestals.get(j);
if ((ped1 != ped2) && (ped2 != ped3) && (ped1 != ped3)) {
ArrayList<Aspect> aspects = new ArrayList<>();
aspects.add(ItemMobAspect.getAspect(ped1.getStackInSlot(0)));
if ((ped1 == ped2) || (ped2 == ped3) || (ped1 == ped3)) continue;
ArrayList<Aspect> aspects = new ArrayList<>();
aspects.add(ItemMobAspect.getAspect(ped1.getStackInSlot(0)));
aspects.add(ItemMobAspect.getAspect(ped2.getStackInSlot(0)));
aspects.add(ItemMobAspect.getAspect(ped2.getStackInSlot(0)));
aspects.add(ItemMobAspect.getAspect(ped3.getStackInSlot(0)));
aspects.add(ItemMobAspect.getAspect(ped3.getStackInSlot(0)));
for (EnumMobAspect recipe : EnumMobAspect.values()) {
if (Arrays.asList(recipe.aspects).containsAll(aspects)
&& aspects.containsAll(Arrays.asList(recipe.aspects))) {
for (EnumMobAspect recipe : EnumMobAspect.values()) {
if (!Arrays.asList(recipe.aspects).containsAll(aspects)
|| !aspects.containsAll(Arrays.asList(recipe.aspects))) {
continue;
}
boolean isInfused = ItemMobAspect.isInfused(ped1.getStackInSlot(0))
&& ItemMobAspect.isInfused(ped2.getStackInSlot(0))
&& ItemMobAspect.isInfused(ped3.getStackInSlot(0));
boolean isInfused = ItemMobAspect.isInfused(ped1.getStackInSlot(0))
&& ItemMobAspect.isInfused(ped2.getStackInSlot(0))
&& ItemMobAspect.isInfused(ped3.getStackInSlot(0));
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) {
return;
}
if (isInfused && worldObj.getTotalWorldTime() % 1200 != 0) return;
if (!isInfused) {
ped1.setInventorySlotContents(0, null);
ped2.setInventorySlotContents(0, null);
ped3.setInventorySlotContents(0, null);
}
if (!isInfused) {
ped1.setInventorySlotContents(0, null);
ped2.setInventorySlotContents(0, null);
ped3.setInventorySlotContents(0, null);
}
if (!isInfused || ItemMobAspect
.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
&& ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
&& ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {
if (!isInfused || ItemMobAspect.lastUsedTabletMatches(ped1.getStackInSlot(0), this)
&& ItemMobAspect.lastUsedTabletMatches(ped2.getStackInSlot(0), this)
&& ItemMobAspect.lastUsedTabletMatches(ped3.getStackInSlot(0), this)) {
if (!worldObj.isRemote) {
Entity spawn = EntityList
.createEntityByName(recipe.toString(), worldObj);
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
if (spawn instanceof EntitySkeleton && worldObj.provider.isHellWorld) {
((EntitySkeleton) spawn).setSkeletonType(1);
}
worldObj.spawnEntityInWorld(spawn);
((EntityLiving) spawn).onSpawnWithEgg(null);
((EntityLiving) spawn).playLivingSound();
}
if (worldObj.isRemote) {
ThaumicTinkerer.tcProxy.essentiaTrailFx(
worldObj,
ped1.xCoord,
ped1.yCoord,
ped1.zCoord,
xCoord,
yCoord,
zCoord,
20,
aspects.get(0).getColor(),
20);
ThaumicTinkerer.tcProxy.essentiaTrailFx(
worldObj,
ped2.xCoord,
ped2.yCoord,
ped2.zCoord,
xCoord,
yCoord,
zCoord,
20,
aspects.get(1).getColor(),
20);
ThaumicTinkerer.tcProxy.essentiaTrailFx(
worldObj,
ped3.xCoord,
ped3.yCoord,
ped3.zCoord,
xCoord,
yCoord,
zCoord,
20,
aspects.get(2).getColor(),
20);
}
}
if (isInfused) {
ItemMobAspect.markLastUsedTablet(ped1.getStackInSlot(0), this);
ItemMobAspect.markLastUsedTablet(ped2.getStackInSlot(0), this);
ItemMobAspect.markLastUsedTablet(ped3.getStackInSlot(0), this);
}
return;
if (!worldObj.isRemote) {
EntityLiving spawn = recipe.createEntity(worldObj);
spawn.setLocationAndAngles(xCoord + .5, yCoord + 1, zCoord + .5, 0, 0);
worldObj.spawnEntityInWorld(spawn);
spawn.onSpawnWithEgg(null);
if (spawn instanceof EntitySkeleton skeleton && skeleton.getSkeletonType() == 1) {
// Needs to be done here instead of EnumMobAspect::setWither because
// EntitySkeleton::onSpawnWithEgg sets the held item to a bow
skeleton.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
}
spawn.playLivingSound();
}
if (worldObj.isRemote) {
ThaumicTinkerer.tcProxy.essentiaTrailFx(
worldObj,
ped1.xCoord,
ped1.yCoord,
ped1.zCoord,
xCoord,
yCoord,
zCoord,
20,
aspects.get(0).getColor(),
20);
ThaumicTinkerer.tcProxy.essentiaTrailFx(
worldObj,
ped2.xCoord,
ped2.yCoord,
ped2.zCoord,
xCoord,
yCoord,
zCoord,
20,
aspects.get(1).getColor(),
20);
ThaumicTinkerer.tcProxy.essentiaTrailFx(
worldObj,
ped3.xCoord,
ped3.yCoord,
ped3.zCoord,
xCoord,
yCoord,
zCoord,
20,
aspects.get(2).getColor(),
20);
}
}
if (isInfused) {
ItemMobAspect.markLastUsedTablet(ped1.getStackInSlot(0), this);
ItemMobAspect.markLastUsedTablet(ped2.getStackInSlot(0), this);
ItemMobAspect.markLastUsedTablet(ped3.getStackInSlot(0), this);
}
return;
}
}
}
@@ -23,7 +23,7 @@ import thaumic.tinkerer.common.block.tile.container.slot.SlotWand;
public class ContainerEnchanter extends ContainerPlayerInv {
TileEnchanter enchanter;
public TileEnchanter enchanter;
public ContainerEnchanter(TileEnchanter enchanter, InventoryPlayer playerInv) {
super(playerInv);
@@ -38,14 +38,14 @@ public class ContainerEnchanter extends ContainerPlayerInv {
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) inventorySlots.get(par2);
Slot var4 = inventorySlots.get(par2);
if (var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
if (var5 != null && var5.getItem() == Items.book) return null;
boolean wand = ((Slot) inventorySlots.get(1)).isItemValid(var5);
boolean wand = inventorySlots.get(1).isItemValid(var5);
// noinspection ConstantConditions
var3 = var5.copy();
@@ -43,6 +43,30 @@ public class ContainerIchorPouch extends ContainerPlayerInv {
} catch (Exception ignored) {}
}
@Override
public void initPlayerInv() {
int ys = getInvYStart();
int xs = getInvXStart();
int held = player.inventory.currentItem;
for (int x = 0; x < 3; ++x) for (int y = 0; y < 9; ++y)
addSlotToContainer(new Slot(player.inventory, y + x * 9 + 9, xs + y * 18, ys + x * 18));
for (int x = 0; x < 9; ++x) {
if (x == held) {
addSlotToContainer(new Slot(player.inventory, x, xs + x * 18, ys + 58) {
@Override
public boolean canTakeStack(EntityPlayer p) {
return false;
}
});
} else {
addSlotToContainer(new Slot(player.inventory, x, xs + x * 18, ys + 58));
}
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slot) {
if (slot == blockSlot) return null;
@@ -24,7 +24,7 @@ import thaumic.tinkerer.common.item.kami.ItemSkyPearl;
public class ContainerWarpGate extends ContainerPlayerInv {
TileWarpGate gate;
public TileWarpGate gate;
public ContainerWarpGate(TileWarpGate gate, InventoryPlayer playerInv) {
super(playerInv);
@@ -44,7 +44,7 @@ public class ContainerWarpGate extends ContainerPlayerInv {
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) inventorySlots.get(par2);
Slot var4 = inventorySlots.get(par2);
if (var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
@@ -11,8 +11,6 @@
*/
package thaumic.tinkerer.common.block.tile.kami;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
@@ -46,8 +44,7 @@ public class TileWarpGate extends TileEntity implements IInventory {
int z = coords.posZ;
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileWarpGate) {
TileWarpGate destGate = (TileWarpGate) tile;
if (tile instanceof TileWarpGate destGate) {
if (!destGate.locked) {
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
@@ -79,12 +76,12 @@ public class TileWarpGate extends TileEntity implements IInventory {
@Override
public void updateEntity() {
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(
EntityPlayer.class,
AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1));
final AxisAlignedBB bbox = getTeleportRange();
EntityPlayer clientPlayer = ThaumicTinkerer.proxy.getClientPlayer();
for (EntityPlayer player : players) if (player != null && player == clientPlayer && player.isSneaking()) {
EntityPlayer player = ThaumicTinkerer.proxy.getClientPlayer();
if (player != null && player.worldObj == this.worldObj
&& player.isSneaking()
&& player.boundingBox.intersectsWith(bbox)) {
player.openGui(
ThaumicTinkerer.instance,
LibGuiIDs.GUI_ID_WARP_GATE_DESTINATIONS,
@@ -92,12 +89,15 @@ public class TileWarpGate extends TileEntity implements IInventory {
xCoord,
yCoord,
zCoord);
break;
}
teleportedThisTick = false;
}
public AxisAlignedBB getTeleportRange() {
return AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1);
}
public void teleportPlayer(EntityPlayer player, int index) {
if (teleportedThisTick) return;
@@ -237,4 +237,10 @@ public class TileWarpGate extends TileEntity implements IInventory {
super.onDataPacket(manager, packet);
readCustomNBT(packet.func_148857_g());
}
public void setLocked(boolean locked) {
this.locked = locked;
this.markDirty();
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@@ -55,6 +55,7 @@ import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.registry.TTRegistry;
import thaumic.tinkerer.mixins.early.AccessorItemInWorldManager;
@@ -110,7 +111,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IMova
if (worldObj.isRemote) {
prevSwingProgress = swingProgress;
prevTicksElapsed = ticksElapsed;
int iterations = ThaumicTinkerer.gtLoaded ? MTEWorldAccelerator.getAccelerationForTEUnsafe(this) + 1 : 1;
int iterations = LoadedMods.gt5uNHLoaded ? MTEWorldAccelerator.getAccelerationForTEUnsafe(this) + 1 : 1;
ticksElapsed += iterations;
ItemStack stack = heldItem;
if (stack != null) {
@@ -25,7 +25,6 @@ import net.minecraftforge.fluids.IFluidHandler;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
@@ -41,6 +40,7 @@ import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumic.tinkerer.common.compat.IndustrialcraftUnloadHelper;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.lib.LibFeatures;
@Optional.InterfaceList({
@@ -70,7 +70,7 @@ public class TileTransvectorInterface extends TileTransvector
if (worldObj.getTotalWorldTime() % 100 == 0) {
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
if (!addedToICEnergyNet && !worldObj.isRemote && Loader.isModLoaded("IC2")) {
if (!addedToICEnergyNet && !worldObj.isRemote && LoadedMods.ic2Loaded) {
IndustrialcraftUnloadHelper.addToIC2EnergyNet(this);
addedToICEnergyNet = true;
@@ -84,7 +84,7 @@ public class TileTransvectorInterface extends TileTransvector
@Override
public void invalidate() {
if (Loader.isModLoaded("IC2")) {
if (LoadedMods.ic2Loaded) {
IndustrialcraftUnloadHelper.removeFromIC2EnergyNet(this);
}
super.invalidate();
@@ -93,7 +93,7 @@ public class TileTransvectorInterface extends TileTransvector
@Override
public void onChunkUnload() {
if (Loader.isModLoaded("IC2")) {
if (LoadedMods.ic2Loaded) {
IndustrialcraftUnloadHelper.removeFromIC2EnergyNet(this);
}
}
@@ -1,16 +1,26 @@
package thaumic.tinkerer.common.compat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import ic2.api.item.ElectricItem;
public class EMTCompat {
public static final boolean EMTLoaded = Loader.isModLoaded("EMT");
public static Item electricHoe;
public static void init() {
electricHoe = GameRegistry.findItem("EMT", "ElectricHoeGrowth");
}
public static boolean validElectricHoe(ItemStack stack) {
return LoadedMods.EMTLoaded && stack.getItem() == EMTCompat.electricHoe
&& ElectricItem.manager.canUse(stack, 250);
}
public static void useEnergy(ItemStack hoeOfGrowth, EntityPlayer player) {
ElectricItem.manager.use(hoeOfGrowth, 250, player);
}
}
@@ -0,0 +1,25 @@
package thaumic.tinkerer.common.compat;
import cpw.mods.fml.common.Loader;
public class LoadedMods {
public static final boolean AE2Loaded = Loader.isModLoaded("appliedenergistics2");
public static final boolean EMTLoaded = Loader.isModLoaded("EMT");
public static final boolean NEILoaded = Loader.isModLoaded("NotEnoughItems");
public static final boolean TConstructLoaded = Loader.isModLoaded("TConstruct");
public static final boolean aspectRecipeIndexLoaded = Loader.isModLoaded("aspectrecipeindex");
public static final boolean baublesExpandedLoaded = Loader.isModLoaded("Baubles|Expanded");
public static final boolean bloodMagicLoaded = Loader.isModLoaded("BloodMagic");
public static final boolean botaniaLoaded = Loader.isModLoaded("Botania");
public static final boolean computerCraftLoaded = Loader.isModLoaded("ComputerCraft");
public static final boolean enderIOLoaded = Loader.isModLoaded("EnderIO");
public static final boolean enderStorageLoaded = Loader.isModLoaded("EnderStorage");
public static final boolean forgeMultipartLoaded = Loader.isModLoaded("ForgeMultipart");
public static final boolean gt5uNHLoaded = Loader.isModLoaded("gregtech_nh");
public static final boolean ic2Loaded = Loader.isModLoaded("IC2");
public static final boolean openComputersLoaded = Loader.isModLoaded("OpenComputers");
public static final boolean thaumicBootsLoaded = Loader.isModLoaded("thaumicboots");
public static final boolean wailaLoaded = Loader.isModLoaded("Waila");
}
@@ -1,6 +1,8 @@
package thaumic.tinkerer.common.core.helper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -22,29 +24,46 @@ import thaumic.tinkerer.common.item.ItemBrightNitor;
import thaumic.tinkerer.common.item.ItemInfusedGrain;
/**
* Created by pixlepix on 8/7/14.
* Created by pixlepix on 8/7/14, reworked by Spaghetti on 2026-08-21 These very lines of code will cause great trouble
* in the future. However, they have proven to be less chaotic than anticipated in the past, so they live on ... even if
* that means nerfing them to the ground.
*/
public class AspectCropLootManager {
private static HashMap<Aspect, HashMap<ItemStack, Integer>> lootMap = new HashMap<>();
public static class LootEntry {
public final ItemStack stack;
public final int weight;
public LootEntry(ItemStack stack, int weight) {
this.stack = stack;
this.weight = weight;
}
}
private static final Random RAND = new Random();
private static HashMap<Aspect, List<LootEntry>> lootMap = new HashMap<>();
public static ItemStack getLootForAspect(Aspect aspect) {
HashMap<ItemStack, Integer> aspectHashmap = lootMap.get(aspect);
// Find total value of the possible ItemStacks for the aspect
if (aspectHashmap == null) return null;
int sum = 0;
List<LootEntry> aspectLootList = lootMap.get(aspect);
for (Integer i : aspectHashmap.values()) {
sum += i;
if (aspectLootList == null || aspectLootList.isEmpty()) {
return null;
}
int sum = 0;
for (LootEntry entry : aspectLootList) {
sum += entry.weight;
}
if (sum > 0) {
Random rand = new Random();
int randInt = rand.nextInt(sum);
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
if (randInt < pair.getValue()) {
return pair.getKey().copy();
int randInt = RAND.nextInt(sum);
for (LootEntry entry : aspectLootList) {
if (randInt < entry.weight) {
return entry.stack.copy();
}
randInt -= pair.getValue();
randInt -= entry.weight;
}
}
return null;
@@ -59,10 +78,14 @@ public class AspectCropLootManager {
}
public static void addAspectLoot(Aspect aspect, String target, int count) {
String capitalized = WordUtils.capitalizeFully(target);
for (String ore : OreDictionary.getOreNames()) {
if (ore.contains(WordUtils.capitalizeFully(target)) || ore.contains(target)) {
if (ore.contains(capitalized) || ore.contains(target)) {
for (ItemStack stack : OreDictionary.getOres(ore)) {
ItemStack newStack = stack.copy();
if (newStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
newStack.setItemDamage(0);
}
newStack.stackSize = count;
addAspectLoot(aspect, newStack);
}
@@ -71,12 +94,21 @@ public class AspectCropLootManager {
}
public static void addAspectLoot(Aspect aspect, ItemStack stack, int power) {
lootMap.get(aspect).put(stack, power);
if (stack == null || stack.getItem() == null) {
return;
}
lootMap.putIfAbsent(aspect, new ArrayList<>());
lootMap.get(aspect).add(new LootEntry(stack.copy(), power));
}
public static Map<Aspect, List<LootEntry>> getAllLoot() {
return lootMap;
}
public static void populateLootMap() {
for (Aspect a : Aspect.aspects.values()) {
lootMap.put(a, new HashMap<>());
lootMap.put(a, new ArrayList<>());
}
addAspectLoot(
Aspect.AIR,
@@ -103,16 +135,15 @@ public class AspectCropLootManager {
1,
ItemInfusedGrain.getMetaForAspect(Aspect.WATER)));
addAspectLoot(Aspect.ORDER, new ItemStack(Blocks.glass, 64));
addAspectLoot(Aspect.ENTROPY, new ItemStack(Blocks.sand, 64));
addAspectLoot(Aspect.ORDER, new ItemStack(Blocks.glass, 16));
addAspectLoot(Aspect.ENTROPY, new ItemStack(Blocks.sand, 16));
addAspectLoot(Aspect.ELDRITCH, new ItemStack(Items.ender_pearl, 4), 10);
addAspectLoot(Aspect.ELDRITCH, new ItemStack(Items.ender_eye, 4), 5);
addAspectLoot(Aspect.ELDRITCH, "bucketEnder");
addAspectLoot(Aspect.ELDRITCH, new ItemStack(ConfigItems.itemResource, 1, 17)); // void seed
// addAspectLoot(Aspect.TREE, "wood");
addAspectLoot(Aspect.TREE, new ItemStack(Blocks.log));
addAspectLoot(Aspect.TREE, "logWood");
for (Aspect tag : Aspect.aspects.values()) {
ItemStack i = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
@@ -120,33 +151,32 @@ public class AspectCropLootManager {
addAspectLoot(Aspect.AURA, i);
}
for (int i = 0; i < 24; i++) {
addAspectLoot(Aspect.BEAST, new ItemStack(Items.spawn_egg, 1, i));
}
addAspectLoot(Aspect.MIND, new ItemStack(Items.paper, 64), 15);
addAspectLoot(Aspect.MIND, new ItemStack(Items.book, 32), 10);
addAspectLoot(Aspect.MIND, new ItemStack(Blocks.bookshelf, 16), 5);
addAspectLoot(Aspect.MIND, new ItemStack(ConfigItems.itemResource, 4, 9), 5); // knowledge fragment
addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 4);
addAspectLoot(Aspect.FLESH, new ItemStack(ConfigItems.itemResource, 16, 5), 1);
addAspectLoot(Aspect.UNDEAD, new ItemStack(Items.rotten_flesh, 32));
addAspectLoot(Aspect.UNDEAD, new ItemStack(Items.bone, 24));
addAspectLoot(
Aspect.CRAFT,
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 32));
addAspectLoot(Aspect.CRAFT, new ItemStack(ConfigBlocks.blockStoneDevice, 16));
addAspectLoot(Aspect.CRAFT, new ItemStack(ConfigBlocks.blockStoneDevice, 16, 0)); // alchemical furnace
addAspectLoot(Aspect.CRAFT, new ItemStack(Blocks.crafting_table, 4));
addAspectLoot(Aspect.HUNGER, new ItemStack(Items.nether_wart, 16));
addAspectLoot(Aspect.COLD, new ItemStack(Items.snowball, 16));
addAspectLoot(Aspect.COLD, "rodBlizz");
addAspectLoot(Aspect.COLD, new ItemStack(Blocks.ice, 2));
addAspectLoot(Aspect.COLD, new ItemStack(Items.snowball, 64));
addAspectLoot(Aspect.COLD, new ItemStack(Blocks.snow, 32));
addAspectLoot(Aspect.COLD, new ItemStack(Blocks.snow_layer, 8));
addAspectLoot(Aspect.COLD, "rodBlizz", 1);
addAspectLoot(Aspect.PLANT, "grass");
addAspectLoot(Aspect.PLANT, "sapling");
for (int i = 0; i < 6; i++) {
addAspectLoot(Aspect.PLANT, new ItemStack(Blocks.sapling, 1, i));
}
for (int i = 0; i < 12; i++) {
addAspectLoot(Aspect.MAN, new ItemStack(ConfigItems.itemGolemCore, 1, i));
@@ -162,26 +192,27 @@ public class AspectCropLootManager {
addAspectLoot(Aspect.WEAPON, new ItemStack(ConfigItems.itemSwordThaumium));
addAspectLoot(Aspect.TOOL, new ItemStack(ConfigItems.itemShovelThaumium));
addAspectLoot(Aspect.TOOL, new ItemStack(ConfigItems.itemAxeThaumium));
addAspectLoot(Aspect.TRAVEL, new ItemStack(ConfigBlocks.blockCosmeticSolid, 8, 7));
addAspectLoot(Aspect.SLIME, new ItemStack(Items.slime_ball, 16));
addAspectLoot(Aspect.SLIME, "slime");
addAspectLoot(Aspect.SLIME, "slime", 4);
addAspectLoot(Aspect.GREED, new ItemStack(Items.gold_ingot, 4));
addAspectLoot(Aspect.GREED, new ItemStack(Items.emerald, 2));
addAspectLoot(Aspect.LIGHT, new ItemStack(Items.glowstone_dust, 16), 5);
addAspectLoot(Aspect.LIGHT, new ItemStack(ConfigItems.itemResource, 4, 1));
addAspectLoot(Aspect.LIGHT, new ItemStack(ConfigItems.itemResource, 4, 1)); // nitor
addAspectLoot(
Aspect.LIGHT,
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBrightNitor.class)));
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.piston, 8));
// addAspectLoot(Aspect.MECHANISM, "gear");
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.hopper, 4));
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.dropper, 8));
addAspectLoot(Aspect.MECHANISM, new ItemStack(Blocks.dispenser, 8));
addAspectLoot(Aspect.CROP, new ItemStack(Items.wheat, 32));
addAspectLoot(Aspect.CROP, "seed");
addAspectLoot(Aspect.METAL, new ItemStack(Items.iron_ingot, 4), 100);
// addAspectLoot(Aspect.METAL, "iron");
addAspectLoot(Aspect.DEATH, new ItemStack(Items.bone, 32));
@@ -198,7 +229,7 @@ public class AspectCropLootManager {
addAspectLoot(Aspect.EXCHANGE, "ingotCopper", 4);
addAspectLoot(Aspect.EXCHANGE, new ItemStack(ConfigBlocks.blockCustomOre, 4));
addAspectLoot(Aspect.ENERGY, new ItemStack(ConfigItems.itemResource, 12));
addAspectLoot(Aspect.ENERGY, new ItemStack(ConfigItems.itemResource, 12)); // alumentum
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 0));
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 1));
@@ -210,29 +241,40 @@ public class AspectCropLootManager {
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
addAspectLoot(Aspect.HEAL, new ItemStack(Items.cake));
addAspectLoot(Aspect.HEAL, new ItemStack(Items.potionitem, 1, 8261));
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 20, 4));
for (int i = 0; i < 16; i++) {
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 1, i));
addAspectLoot(Aspect.SENSES, new ItemStack(Blocks.stained_glass, 1, i));
addAspectLoot(Aspect.SENSES, new ItemStack(Blocks.stained_glass_pane, 2, i));
}
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.soul_sand, 64), 2);
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.netherrack, 64), 2);
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.nether_brick));
addAspectLoot(Aspect.SOUL, new ItemStack(Blocks.soul_sand, 16), 2);
addAspectLoot(Aspect.WEATHER, new ItemStack(Blocks.air));
addAspectLoot(Aspect.WEATHER, "cloud", 100);
addAspectLoot(Aspect.WEATHER, "cloud", 64);
addAspectLoot(Aspect.DARKNESS, new ItemStack(Blocks.obsidian, 10));
addAspectLoot(Aspect.VOID, new ItemStack(Items.bucket));
addAspectLoot(Aspect.VOID, "bucket");
addAspectLoot(Aspect.VOID, "bowl", 4);
addAspectLoot(Aspect.VOID, "ingotVoid", 2);
addAspectLoot(Aspect.POISON, new ItemStack(ConfigItems.itemResource, 16, 3));
addAspectLoot(Aspect.POISON, new ItemStack(ConfigItems.itemResource, 16, 3)); // quicksilver
addAspectLoot(Aspect.POISON, new ItemStack(Items.spider_eye, 8));
addAspectLoot(Aspect.LIFE, new ItemStack(Items.egg, 8));
addAspectLoot(Aspect.TRAP, new ItemStack(Blocks.web, 4));
addAspectLoot(Aspect.TRAP, "trapdoorWood");
addAspectLoot(Aspect.TRAP, new ItemStack(ConfigItems.itemResource, 16, 6)); // amber
addAspectLoot(Aspect.TRAVEL, new ItemStack(ConfigBlocks.blockCosmeticSolid, 4, 2)); // paved stone of travel
addAspectLoot(Aspect.TAINT, new ItemStack(ConfigItems.itemResource, 4, 11));
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.diamond));
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.diamond, 1));
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Items.quartz, 8));
addAspectLoot(Aspect.CRYSTAL, new ItemStack(Blocks.glass, 32), 4);
}
}
@@ -1,8 +1,9 @@
package thaumic.tinkerer.common.core.helper;
import static thaumic.tinkerer.common.compat.EMTCompat.EMTLoaded;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -11,6 +12,7 @@ import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.common.block.BlockInfusedGrain;
import thaumic.tinkerer.common.compat.EMTCompat;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
/**
@@ -31,20 +33,20 @@ public class BonemealEventHandler {
public static boolean isMagicHoe(ItemStack stack) {
if (stack == null) return false;
var item = stack.getItem();
return item == ConfigItems.itemHoeElemental || (EMTLoaded && item == EMTCompat.electricHoe);
Item item = stack.getItem();
return item == ConfigItems.itemHoeElemental || EMTCompat.validElectricHoe(stack);
}
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent event) {
var world = event.world;
World world = event.world;
if (world.isRemote) return;
if (!(world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain infusedGrain)) return;
var player = event.entityPlayer;
EntityPlayer player = event.entityPlayer;
if (player == null) return;
var hoeOfGrowth = player.getCurrentEquippedItem();
ItemStack hoeOfGrowth = player.getCurrentEquippedItem();
if (!isMagicHoe(hoeOfGrowth)) return;
if (!infusedGrain.func_149851_a(world, event.x, event.y, event.z, false)
@@ -52,7 +54,7 @@ public class BonemealEventHandler {
return;
}
infusedGrain.func_149853_b(world, world.rand, event.x, event.y, event.z);
hoeOfGrowth.damageItem(25, player);
damageHoe(hoeOfGrowth, player);
Thaumcraft.proxy.blockSparkle(world, event.x, event.y, event.z, 0, 2);
world.playSoundEffect(
event.x + 0.5D,
@@ -62,4 +64,12 @@ public class BonemealEventHandler {
0.75F,
0.9F + world.rand.nextFloat() * 0.2F);
}
private static void damageHoe(ItemStack hoeOfGrowth, EntityPlayer player) {
if (LoadedMods.EMTLoaded && hoeOfGrowth.getItem() == EMTCompat.electricHoe) {
EMTCompat.useEnergy(hoeOfGrowth, player);
} else {
hoeOfGrowth.damageItem(25, player);
}
}
}
@@ -1,9 +1,16 @@
package thaumic.tinkerer.common.core.helper;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
@@ -30,139 +37,150 @@ import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import com.google.common.collect.Maps;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.InfusionRecipe;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.common.entities.monster.EntityBrainyZombie;
import thaumcraft.common.entities.monster.EntityFireBat;
import thaumcraft.common.entities.monster.EntityWisp;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.BlockSummon;
import thaumic.tinkerer.common.item.ItemMobAspect;
import thaumic.tinkerer.common.item.ItemMobDisplay;
import thaumic.tinkerer.common.lib.LibResearch;
public enum EnumMobAspect {
SnowMan(EntitySnowman.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.MAN }),
Bat(EntityBat.class, new Aspect[] { Aspect.AIR, Aspect.AIR, Aspect.FLIGHT }, 1.9f, -0.3f),
Blaze(EntityBlaze.class, new Aspect[] { Aspect.FIRE, Aspect.FIRE, Aspect.FIRE }),
BrainyZombie(EntityBrainyZombie.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.FLESH }, "Thaumcraft."),
Firebat(EntityFireBat.class, new Aspect[] { Aspect.FLIGHT, Aspect.FIRE, Aspect.MAGIC }, 1.9f, -0.3f),
CaveSpider(EntityCaveSpider.class, new Aspect[] { Aspect.BEAST, Aspect.POISON, Aspect.POISON }),
Chicken(EntityChicken.class, new Aspect[] { Aspect.CROP, Aspect.FLIGHT, Aspect.BEAST }),
Cow(EntityCow.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.BEAST }),
Creeper(EntityCreeper.class, new Aspect[] { Aspect.MAGIC, Aspect.BEAST, Aspect.ELDRITCH }),
Enderman(EntityEnderman.class, new Aspect[] { Aspect.ELDRITCH, Aspect.ELDRITCH, Aspect.MAN }, 0.3f, 0.0f),
Ghast(EntityGhast.class, new Aspect[] { Aspect.FIRE, Aspect.FLIGHT, Aspect.FLIGHT }, 0.1f, 0.2f),
EntityHorse(EntityHorse.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.TRAVEL }),
VillagerGolem(EntityIronGolem.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.MAN }, 0.3f, 0.0f),
LavaSlime(EntityMagmaCube.class, new Aspect[] { Aspect.FIRE, Aspect.SLIME, Aspect.SLIME }, 0.6f, 0.0f) {
@Override
protected Entity createEntity(World worldObj) {
return setSlimeSize(super.createEntity(worldObj), 1);
}
},
MushroomCow(EntityMooshroom.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.CROP }),
Ozelot(EntityOcelot.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.ELDRITCH }),
// Passive
Chicken(EntityChicken.class, new Aspect[] { Aspect.CROP, Aspect.FLIGHT, Aspect.BEAST }, 1.0f),
Pig(EntityPig.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.TRAVEL }),
PigZombie(EntityPigZombie.class, new Aspect[] { Aspect.UNDEAD, Aspect.FLESH, Aspect.FIRE }),
Sheep(EntitySheep.class, new Aspect[] { Aspect.EARTH, Aspect.CLOTH, Aspect.BEAST }),
Silverfish(EntitySilverfish.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.EARTH }),
Skeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.MAN, Aspect.UNDEAD }),
Slime(EntitySlime.class, new Aspect[] { Aspect.SLIME, Aspect.SLIME, Aspect.BEAST }, 0.6f, 0.0f) {
/// Must be before Cow because EntityMooshroom extends EntityCow
MushroomCow(EntityMooshroom.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.CROP }, 0.9f),
Cow(EntityCow.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.BEAST }, 0.9f),
Sheep(EntitySheep.class, new Aspect[] { Aspect.EARTH, Aspect.CLOTH, Aspect.BEAST }, 0.9f),
Ozelot(EntityOcelot.class, new Aspect[] { Aspect.BEAST, Aspect.EARTH, Aspect.ELDRITCH }),
Wolf(EntityWolf.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.BEAST }),
EntityHorse(EntityHorse.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.TRAVEL }, 0.8f),
SnowMan(EntitySnowman.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.MAN }, 0.8f),
VillagerGolem(EntityIronGolem.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.MAN }, 0.6f),
Villager(EntityVillager.class, new Aspect[] { Aspect.MAN, Aspect.MAN, Aspect.MAN }, 0.8f),
Squid(EntitySquid.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.WATER }, 0.6f, 0.75f),
Bat(EntityBat.class, new Aspect[] { Aspect.AIR, Aspect.AIR, Aspect.FLIGHT }, 1.9f),
// Hostiles
Blaze(EntityBlaze.class, new Aspect[] { Aspect.FIRE, Aspect.FIRE, Aspect.FIRE }, 0.8f),
PigZombie(EntityPigZombie.class, new Aspect[] { Aspect.UNDEAD, Aspect.FLESH, Aspect.FIRE }, 0.8f),
/// Must be before Slime because EntityMagmaCube extends EntitySlime
LavaSlime(EntityMagmaCube.class, new Aspect[] { Aspect.FIRE, Aspect.SLIME, Aspect.SLIME }, 1.5f) {
@Override
protected Entity createEntity(World worldObj) {
public EntityLiving createEntity(World worldObj) {
return setSlimeSize(super.createEntity(worldObj), 1);
}
},
Spider(EntitySpider.class, new Aspect[] { Aspect.BEAST, Aspect.UNDEAD, Aspect.UNDEAD }),
Squid(EntitySquid.class, new Aspect[] { Aspect.WATER, Aspect.WATER, Aspect.WATER }, 0.3f, 0.5f),
Villager(EntityVillager.class, new Aspect[] { Aspect.MAN, Aspect.MAN, Aspect.MAN }),
Wisp(EntityWisp.class, new Aspect[] { Aspect.AIR, Aspect.MAGIC, Aspect.MAGIC }, "Thaumcraft."),
Witch(EntityWitch.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.ELDRITCH }, 0.35f, 0.0f),
Wolf(EntityWolf.class, new Aspect[] { Aspect.BEAST, Aspect.BEAST, Aspect.BEAST }),
Zombie(EntityZombie.class, new Aspect[] { Aspect.FLESH, Aspect.FLESH, Aspect.UNDEAD });
Ghast(EntityGhast.class, new Aspect[] { Aspect.FIRE, Aspect.FLIGHT, Aspect.FLIGHT }, 0.2f, 0.6f),
Firebat(EntityFireBat.class, new Aspect[] { Aspect.FLIGHT, Aspect.FIRE, Aspect.MAGIC }, 1.9f, 0f),
/// Must be before Zombie because EntityBrainyZombie extends EntityZombie
BrainyZombie(EntityBrainyZombie.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.FLESH }, 0.8f, 0),
Zombie(EntityZombie.class, new Aspect[] { Aspect.FLESH, Aspect.FLESH, Aspect.UNDEAD }, 0.8f),
Skeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.MAN, Aspect.UNDEAD }, 0.8f) {
public static Map<EnumMobAspect, Entity> entityCache = Maps.newHashMap();
public Aspect[] aspects;
public Class entity;
public String prefix;
private float scale;
private float offset;
@Override
public boolean matches(EntityLiving e) {
if (e instanceof EntitySkeleton skeleton) {
return skeleton.getSkeletonType() == 0;
}
return false;
}
},
WitherSkeleton(EntitySkeleton.class, new Aspect[] { Aspect.UNDEAD, Aspect.POISON, Aspect.FIRE }, 0.8f) {
EnumMobAspect(Class entity, Aspect[] aspects, float scale, float offset) {
@Override
public EntityLiving createEntity(World worldObj) {
return setWither(super.createEntity(worldObj));
}
@Override
public boolean matches(EntityLiving e) {
if (e instanceof EntitySkeleton skeleton) {
return skeleton.getSkeletonType() == 1;
}
return false;
}
},
Creeper(EntityCreeper.class, new Aspect[] { Aspect.MAGIC, Aspect.BEAST, Aspect.ELDRITCH }, 0.8f),
Witch(EntityWitch.class, new Aspect[] { Aspect.MAGIC, Aspect.UNDEAD, Aspect.ELDRITCH }, 0.8f),
/// Must be before Spider because EntityCaveSpider extends EntitySpider
CaveSpider(EntityCaveSpider.class, new Aspect[] { Aspect.BEAST, Aspect.POISON, Aspect.POISON }, 0.8f),
Spider(EntitySpider.class, new Aspect[] { Aspect.BEAST, Aspect.UNDEAD, Aspect.UNDEAD }, 0.8f),
Slime(EntitySlime.class, new Aspect[] { Aspect.SLIME, Aspect.SLIME, Aspect.BEAST }, 1.5f) {
@Override
public EntityLiving createEntity(World worldObj) {
return setSlimeSize(super.createEntity(worldObj), 1);
}
},
Silverfish(EntitySilverfish.class, new Aspect[] { Aspect.METAL, Aspect.METAL, Aspect.EARTH }, 1.2f),
Enderman(EntityEnderman.class, new Aspect[] { Aspect.ELDRITCH, Aspect.ELDRITCH, Aspect.MAN }, 0.7f),
Wisp(EntityWisp.class, new Aspect[] { Aspect.AIR, Aspect.MAGIC, Aspect.MAGIC });
private static final Map<String, EnumMobAspect> LOOKUP = Arrays.stream(values())
.collect(Collectors.toMap(Enum::name, Function.identity()));
public final Aspect[] aspects;
public final Class<? extends EntityLiving> entity;
private final float scale;
private final float offset;
private final MethodHandle ctor;
private String langKey;
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects, float scale) {
this(entity, aspects, scale, 0);
}
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects, float scale, float offset) {
this.aspects = aspects;
this.entity = entity;
this.scale = scale;
this.offset = offset;
}
EnumMobAspect(Class entity, Aspect[] aspects, float scale, float offset, String prefix) {
this(entity, aspects, scale, offset);
this.prefix = prefix;
}
EnumMobAspect(Class entity, Aspect[] aspects) {
this.aspects = aspects;
this.entity = entity;
this.scale = 1.1f;
this.offset = 0.0f;
}
EnumMobAspect(Class entity, Aspect[] aspects, String prefix) {
this(entity, aspects);
this.prefix = prefix;
}
public static Entity getEntityFromCache(EnumMobAspect ent, World worldObj) {
Entity entity = entityCache.get(ent);
if (entity == null) {
entity = ent.createEntity(worldObj);
entityCache.put(ent, entity);
MethodHandles.Lookup lookup = MethodHandles.lookup();
try {
this.ctor = lookup.findConstructor(entity, MethodType.methodType(void.class, World.class));
} catch (NoSuchMethodException | IllegalAccessException e) {
throw new RuntimeException(e);
}
return entity;
}
private static Entity setSlimeSize(Entity entity, int size) {
EnumMobAspect(Class<? extends EntityLiving> entity, Aspect[] aspects) {
this(entity, aspects, 1.0f);
}
if (entity instanceof EntitySlime) {
((EntitySlime) entity).setSlimeSize(1);
public static EnumMobAspect get(String name) {
return LOOKUP.get(name);
}
private static EntityLiving setSlimeSize(EntityLiving entity, int size) {
if (entity instanceof EntitySlime slime) {
slime.setSlimeSize(size);
}
return entity;
}
public static Aspect[] getAspectsForEntity(Entity e) {
return getAspectsForEntity(e.getClass());
private static EntityLiving setWither(EntityLiving entity) {
if (entity instanceof EntitySkeleton skeleton) {
skeleton.setSkeletonType(1);
skeleton.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
}
return entity;
}
public static EnumMobAspect getMobAspectForType(String name) {
if (name.isEmpty()) return null;
Class clazz = (Class) EntityList.stringToClassMapping.get(name);
for (EnumMobAspect e : EnumMobAspect.values()) {
if (e.entity.isAssignableFrom(clazz)) {
return e;
public static Aspect[] getAspectsForEntity(EntityLiving e) {
for (EnumMobAspect aspect : EnumMobAspect.values()) {
if (aspect.matches(e)) {
return aspect.aspects;
}
}
return null;
}
public static Aspect[] getAspectsForEntity(Class clazz) {
for (EnumMobAspect e : EnumMobAspect.values()) {
if (e.entity.isAssignableFrom(clazz)) {
return e.aspects;
}
}
return null;
public boolean matches(EntityLiving e) {
return this.entity.isInstance(e);
}
public float getVerticalOffset() {
@@ -173,38 +191,19 @@ public enum EnumMobAspect {
return scale;
}
public Class getEntityClass() {
return entity;
}
public Entity getEntity(World worldObj) {
return getEntityFromCache(this, worldObj);
}
protected Entity createEntity(World worldObj) {
return EntityList.createEntityByName(toString(), worldObj);
}
public ResearchPage GetRecepiePage() {
ItemStack output = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobAspect.class));
((ItemMobDisplay) output.getItem()).setEntityType(output, toString());
ItemStack[] inputs = new ItemStack[this.aspects.length];
int i = 0;
for (Aspect a : this.aspects) {
inputs[i++] = ItemMobAspect.getStackFromAspect(a);
public String getDisplayName() {
if (langKey == null) {
String name = EntityList.classToStringMapping.get(entity);
langKey = "entity." + (name == null ? "generic" : name) + ".name";
}
InfusionRecipe recepie = new InfusionRecipe(
LibResearch.KEY_SUMMON,
output,
0,
new AspectList(),
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class)),
inputs);
return new ResearchPage(recepie);
return StatCollector.translateToLocal(langKey);
}
@Override
public String toString() {
return prefix == null ? super.toString() : prefix + super.toString();
public EntityLiving createEntity(World worldObj) {
try {
return (EntityLiving) ctor.invoke(worldObj);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
@@ -11,29 +11,36 @@
*/
package thaumic.tinkerer.common.core.proxy;
import java.util.Arrays;
import net.minecraft.command.ICommandManager;
import net.minecraft.command.ServerCommandManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
import codechicken.nei.recipe.HandlerInfo;
import codechicken.nei.recipe.RecipeCatalysts;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import dan200.computercraft.api.ComputerCraftAPI;
import li.cil.oc.api.Driver;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumcraft.api.wands.WandCap;
import thaumcraft.api.wands.WandRod;
@@ -50,13 +57,17 @@ import thaumcraft.common.tiles.TileNode;
import thaumcraft.common.tiles.TileSensor;
import thaumcraft.common.tiles.TileTubeFilter;
import thaumcraft.common.tiles.TileWandPedestal;
import thaumic.tinkerer.client.nei.NEIInfusedSeedRecipeHandler;
import thaumic.tinkerer.client.nei.NEINecromancyHandler;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.BlockSummon;
import thaumic.tinkerer.common.block.tile.TileFunnel;
import thaumic.tinkerer.common.block.tile.TileRepairer;
import thaumic.tinkerer.common.block.tile.transvector.TileTransvectorInterface;
import thaumic.tinkerer.common.compat.EMTCompat;
import thaumic.tinkerer.common.compat.EnderIO;
import thaumic.tinkerer.common.compat.FumeTool;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.commands.KamiUnlockedCommand;
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
@@ -71,10 +82,13 @@ import thaumic.tinkerer.common.core.helper.BonemealEventHandler;
import thaumic.tinkerer.common.core.helper.NumericAspectHelper;
import thaumic.tinkerer.common.enchantment.ModEnchantments;
import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
import thaumic.tinkerer.common.item.ItemBloodSword;
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
import thaumic.tinkerer.common.item.SpellClothCraftingHandler;
import thaumic.tinkerer.common.item.foci.ItemFocusDeflect;
import thaumic.tinkerer.common.item.kami.wand.CapIchor;
import thaumic.tinkerer.common.item.kami.wand.RodIchorcloth;
import thaumic.tinkerer.common.lib.LibMisc;
import thaumic.tinkerer.common.network.GuiHandler;
import thaumic.tinkerer.common.network.PlayerTracker;
import thaumic.tinkerer.common.network.packet.PacketEnchanterAddEnchant;
@@ -118,7 +132,7 @@ public class TTCommonProxy {
ModCreativeTab.INSTANCE.addWand();
if (Loader.isModLoaded("ComputerCraft")) {
if (LoadedMods.computerCraftLoaded) {
initCCPeripherals();
}
@@ -147,14 +161,14 @@ public class TTCommonProxy {
MinecraftForge.EVENT_BUS.register(new SoulHeartHandler());
}
if (Loader.isModLoaded("OpenComputers")) {
if (LoadedMods.openComputersLoaded) {
initOpenCDrivers();
}
if (Loader.isModLoaded("EnderIO")) {
if (LoadedMods.enderIOLoaded) {
InitEnderIO();
}
if (Loader.isModLoaded("ForgeMultipart")) {
if (LoadedMods.forgeMultipartLoaded) {
ThaumicTinkerer.log.trace("Attempting to load Multiparts");
try {
Class<?> clazz = Class.forName("thaumic.tinkerer.common.multipart.MultipartHandler");
@@ -166,6 +180,10 @@ public class TTCommonProxy {
ThaumicTinkerer.log.info("Skipping TC Multipart integration");
}
if (LoadedMods.NEILoaded && LoadedMods.aspectRecipeIndexLoaded) {
MinecraftForge.EVENT_BUS.register(new NEIEventHandler());
}
EMTCompat.init();
}
@@ -259,4 +277,26 @@ public class TTCommonProxy {
public void shadowSparkle(World world, float x, float y, float z, int size) {
// NO-OP
}
public static class NEIEventHandler {
@SubscribeEvent
public void registerHandler(NEIRegisterHandlerInfosEvent event) {
ItemStack necromancyTablet = new ItemStack(
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class));
event.registerHandlerInfo(
new HandlerInfo.Builder(NEINecromancyHandler.class, LibMisc.MOD_NAME, LibMisc.MOD_ID).setHeight(88)
.setDisplayStack(necromancyTablet).build());
RecipeCatalysts.putRecipeCatalysts(
NEINecromancyHandler.OVERLAY,
Arrays.asList(
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBloodSword.class)),
necromancyTablet));
event.registerHandlerInfo(
new HandlerInfo.Builder(NEIInfusedSeedRecipeHandler.class, LibMisc.MOD_NAME, LibMisc.MOD_ID)
.setDisplayStack(ItemInfusedSeeds.getStackFromAspect(Aspect.AIR))
.setShowFavoritesButton(false).setShowOverlayButton(false).build());
}
}
}
@@ -13,6 +13,7 @@ package thaumic.tinkerer.common.item;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
@@ -88,8 +89,8 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap<Object, Object> multimap = HashMultimap.create();
public Multimap<String, AttributeModifier> getItemAttributeModifiers() {
Multimap<String, AttributeModifier> multimap = HashMultimap.create();
multimap.put(
SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(field_111210_e, "Weapon modifier", DAMAGE, 0));
@@ -183,24 +184,21 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
if (event.source.damageType.equals("player")) {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == ItemBloodSword.this
&& stack.stackTagCompound != null
&& stack.stackTagCompound.getInteger("Activated") == 1) {
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
// if(as!=null && as.size()!=0){
if (aspects != null) {
event.drops.removeAll(event.drops);
// for(Aspect a:as.getAspects()){
for (Aspect a : aspects) {
addDrops(event, ItemMobAspect.getStackFromAspect(a));
}
}
if (!event.source.damageType.equals("player") || !(event.entity instanceof EntityLiving entity)) {
return;
}
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack == null || stack.getItem() != ItemBloodSword.this
|| stack.stackTagCompound == null
|| stack.stackTagCompound.getInteger("Activated") != 1) {
return;
}
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(entity);
if (aspects != null) {
event.drops.clear();
for (Aspect a : aspects) {
addDrops(event, ItemMobAspect.getStackFromAspect(a));
}
}
}
@@ -214,8 +212,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
boolean handle = handleNext == 0;
if (!handle) handleNext--;
if (event.entityLiving instanceof EntityPlayer && handle) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (event.entityLiving instanceof EntityPlayer player && handle) {
ItemStack itemInUse = player.itemInUse;
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this) {
@@ -227,8 +224,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
if (handle) {
Entity source = event.source.getSourceOfDamage();
if (source != null && source instanceof EntityLivingBase) {
EntityLivingBase attacker = (EntityLivingBase) source;
if (source instanceof EntityLivingBase attacker) {
ItemStack itemInUse = attacker.getHeldItem();
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this)
attacker.attackEntityFrom(DamageSource.magic, 2);
@@ -21,6 +21,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
@@ -256,8 +257,7 @@ public class ItemCleansingTalisman extends ItemBase implements IBauble {
par1ItemStack.damageItem(damage, player);
if (par1ItemStack.stackSize <= 0) {
// Slot 0 = talisman slot.
BaublesApi.getBaubles((EntityPlayer) player).setInventorySlotContents(0, null);
removeFromBaubles((EntityPlayer) player, par1ItemStack);
}
}
@@ -300,4 +300,19 @@ public class ItemCleansingTalisman extends ItemBase implements IBauble {
return true;
return super.getIsRepairable(talisman, material);
}
private void removeFromBaubles(EntityPlayer player, ItemStack itemStack) {
IInventory baubles = BaublesApi.getBaubles(player);
for (int i = 0; i < baubles.getSizeInventory(); i++) {
// BaublesApi calls "onWornTick" with a reference to the ItemStack, so != is correct here
if (baubles.getStackInSlot(i) != itemStack) {
continue;
}
baubles.setInventorySlotContents(i, null);
return;
}
// It shouldn't ever get to this point, because for the item to work at all, it needs to be in a bauble slot,
// therefore I don't handle that edge case
}
}
@@ -3,7 +3,6 @@ package thaumic.tinkerer.common.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityList;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -11,7 +10,6 @@ import thaumic.tinkerer.common.core.helper.EnumMobAspect;
import thaumic.tinkerer.common.core.helper.ItemNBTHelper;
import thaumic.tinkerer.common.lib.LibItemNames;
import thaumic.tinkerer.common.registry.ItemBase;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
/**
@@ -23,10 +21,8 @@ public class ItemMobDisplay extends ItemBase {
public ItemMobDisplay() {
super();
setHasSubtypes(true); // This allows the item to be marked as a metadata item.
setMaxDamage(0); // This makes it so your item doesn't have the damage bar at the bottom of its icon, when
// "damaged"
// similar to the Tools.
setHasSubtypes(true);
setMaxDamage(0);
}
@Override
@@ -34,37 +30,24 @@ public class ItemMobDisplay extends ItemBase {
return false;
}
@Override
public boolean shouldRegister() {
return false;
}
@Override
public IRegisterableResearch getResearchItem() {
return null;
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
return null;
}
public EnumMobAspect getEntityType(ItemStack stack) {
return EnumMobAspect.getMobAspectForType(ItemNBTHelper.getString(stack, TAG_TYPE, ""));
return EnumMobAspect.get(ItemNBTHelper.getString(stack, TAG_TYPE, ""));
}
public void setEntityType(ItemStack stack, String type) {
ItemNBTHelper.setString(stack, TAG_TYPE, type);
public void setEntityType(ItemStack stack, EnumMobAspect type) {
ItemNBTHelper.setString(stack, TAG_TYPE, type.name());
}
@Override
public void getSubItems(Item par1Item, CreativeTabs par2CreativeTabs, List list) {
super.getSubItems(par1Item, par2CreativeTabs, list);
public void getSubItems(Item par1Item, CreativeTabs par2CreativeTabs, List<ItemStack> list) {
for (EnumMobAspect aspect : EnumMobAspect.values()) {
Class aspClass = aspect.getEntityClass();
String name = (String) EntityList.classToStringMapping.get(aspClass);
ItemStack item = new ItemStack(this);
this.setEntityType(item, name);
this.setEntityType(item, aspect);
list.add(item);
}
}
@@ -73,4 +56,13 @@ public class ItemMobDisplay extends ItemBase {
public String getItemName() {
return LibItemNames.MOB_DISPLAY;
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
String mob = ItemNBTHelper.getString(stack, TAG_TYPE, "");
if (mob == null || mob.isEmpty()) return super.getItemStackDisplayName(stack);
EnumMobAspect aspect = EnumMobAspect.get(mob);
if (aspect == null) return super.getItemStackDisplayName(stack);
return aspect.getDisplayName();
}
}
@@ -21,7 +21,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import cpw.mods.fml.common.Loader;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
@@ -34,6 +33,7 @@ import thaumcraft.common.items.wands.ItemWandCasting;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.compat.BloodMagic;
import thaumic.tinkerer.common.compat.BotaniaFunctions;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.helper.ProjectileHelper;
import thaumic.tinkerer.common.lib.LibItemNames;
import thaumic.tinkerer.common.lib.LibResearch;
@@ -52,7 +52,7 @@ public class ItemFocusDeflect extends ItemModFocus {
public static void setupBlackList() {
DeflectBlacklist.add(EntityExpBottle.class);
if (Loader.isModLoaded("BloodMagic")) {
if (LoadedMods.bloodMagicLoaded) {
BloodMagic.setupClass();
}
}
@@ -96,7 +96,7 @@ public class ItemFocusDeflect extends ItemModFocus {
}
private static void checkBotaniaMagicMissile(Entity e) {
if (!Loader.isModLoaded("Botania")) return;
if (!LoadedMods.botaniaLoaded) return;
if (e instanceof EntityMagicMissile) {
e.setDead();
}
@@ -114,7 +114,7 @@ public class ItemFocusDeflect extends ItemModFocus {
private static boolean CheckBlackList(Entity entity) {
Class<? extends Entity> aClass = entity.getClass();
if (DeflectBlacklist.contains(aClass)) return true;
if (Loader.isModLoaded("Botania") && entity instanceof IManaBurst) {
if (LoadedMods.botaniaLoaded && entity instanceof IManaBurst) {
return BotaniaFunctions.isEntityHarmless(entity);
}
for (Class<?> testClass : DeflectBlacklist) {
@@ -19,7 +19,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.Loader;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
@@ -29,6 +28,7 @@ import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumic.tinkerer.common.compat.EnderStorageFunctions;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.lib.LibItemNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ThaumicTinkererArcaneRecipe;
@@ -44,14 +44,14 @@ public class ItemFocusEnderChest extends ItemModFocus {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
super.addInformation(stack, player, list, par4);
if (Loader.isModLoaded("EnderStorage")) {
if (LoadedMods.enderStorageLoaded) {
EnderStorageFunctions.addFocusInformation(stack, player, list, par4);
}
}
@Override
public ItemStack onFocusRightClick(ItemStack stack, World world, EntityPlayer p, MovingObjectPosition pos) {
if (Loader.isModLoaded("EnderStorage")) {
if (LoadedMods.enderStorageLoaded) {
return EnderStorageFunctions.onFocusRightClick(stack, world, p, pos);
}
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
@@ -76,7 +76,7 @@ public class ItemFocusEnderChest extends ItemModFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
if (Loader.isModLoaded("EnderStorage")) {
if (LoadedMods.enderStorageLoaded) {
return EnderStorageFunctions.getSortingHelper(itemstack);
}
return "TTEC" + super.getSortingHelper(itemstack);
@@ -122,7 +122,7 @@ public class ItemFocusEnderChest extends ItemModFocus {
-2,
2,
new ItemStack(this)).setWarp(1).setParents(LibResearch.KEY_FOCUS_DEFLECT).setConcealed();
if (Loader.isModLoaded("EnderStorage")) {
if (LoadedMods.enderStorageLoaded) {
((TTResearchItem) research).setPages(
new ResearchPage("ES"),
ResearchHelper.arcaneRecipePage(LibResearch.KEY_FOCUS_ENDER_CHEST));
@@ -29,7 +29,6 @@ import baubles.api.BaubleType;
import baubles.api.IBauble;
import baubles.api.expanded.BaubleItemHelper;
import baubles.api.expanded.IBaubleExpanded;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -41,6 +40,7 @@ import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.items.wands.ItemFocusPouch;
import thaumic.tinkerer.client.core.helper.IconHelper;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
@@ -57,8 +57,6 @@ import thaumic.tinkerer.common.research.ResearchHelper;
@Optional.Interface(iface = "baubles.api.expanded.IBaubleExpanded", modid = "Baubles|Expanded")
public class ItemIchorPouch extends ItemFocusPouch implements IBauble, IBaubleExpanded, ITTinkererItem {
private static final boolean baublesExpandedLoaded = Loader.isModLoaded("Baubles|Expanded");
public ItemIchorPouch() {
super();
setCreativeTab(ModCreativeTab.INSTANCE);
@@ -111,7 +109,7 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, IBaubleEx
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack is, EntityPlayer player, List textLines, boolean showAdvancedInfo) {
if (baublesExpandedLoaded) {
if (LoadedMods.baublesExpandedLoaded) {
BaubleItemHelper.addSlotInformation(textLines, getBaubleTypes(null));
}
}
@@ -38,6 +38,7 @@ import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.item.kami.ItemKamiResource;
import thaumic.tinkerer.common.lib.LibItemNames;
@@ -139,7 +140,7 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
player.motionZ *= 0.5;
}
boolean omniMode = false;
if (ThaumicTinkerer.isBootsActive) {
if (LoadedMods.thaumicBootsLoaded) {
omniMode = isOmniEnabled(itemStack);
if ((player.moveForward == 0F && player.moveStrafing == 0F && omniMode)
|| (player.moveForward <= 0F && !omniMode)) {
@@ -164,7 +165,7 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
bonus /= 2.0F;
}
bonus *= speedMod;
if (ThaumicTinkerer.isBootsActive) {
if (LoadedMods.thaumicBootsLoaded) {
applyOmniState(player, bonus, itemStack);
} else if (player.moveForward > 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
@@ -105,15 +105,20 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
int fortune = EnchantmentHelper.getFortuneModifier(player);
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock
&& ((world.provider.isSurfaceWorld() && y < 5)
|| (y > 253 && world.provider instanceof WorldProviderBedrock))) {
world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
}
if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock
&& (y <= 253 && world.provider instanceof WorldProviderBedrock)) {
world.setBlock(x, y, z, Blocks.air);
if (player.isSneaking() && ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock) {
// Bedrock -> Portal (Overworld low Y OR Bedrock dimension high Y)
if ((world.provider.isSurfaceWorld() && y < 5)
|| (y > 253 && world.provider instanceof WorldProviderBedrock)) {
world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
}
// Bedrock -> Air (Bedrock dimension normal Y)
if (y <= 253 && world.provider instanceof WorldProviderBedrock) {
world.setBlock(x, y, z, Blocks.air);
}
}
switch (ToolHandler.getMode(stack)) {
case 0:
break;
@@ -122,22 +127,24 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
boolean doY = direction.offsetY == 0;
boolean doZ = direction.offsetZ == 0;
ToolHandler.removeBlocksInIteration(
player,
world,
x,
y,
z,
doX ? -2 : 0,
doY ? -1 : 0,
doZ ? -2 : 0,
doX ? 3 : 1,
doY ? 4 : 1,
doZ ? 3 : 1,
null,
ToolHandler.materialsPick,
silk,
fortune);
if (!player.isSneaking()) {
ToolHandler.removeBlocksInIteration(
player,
world,
x,
y,
z,
doX ? -2 : 0,
doY ? -1 : 0,
doZ ? -2 : 0,
doX ? 3 : 1,
doY ? 4 : 1,
doZ ? 3 : 1,
null,
ToolHandler.materialsPick,
silk,
fortune);
}
break;
}
@@ -146,22 +153,24 @@ public class ItemIchorPickAdv extends ItemIchorPick implements IAdvancedTool {
int yo = -direction.offsetY;
int zo = -direction.offsetZ;
ToolHandler.removeBlocksInIteration(
player,
world,
x,
y,
z,
xo >= 0 ? 0 : -10,
yo >= 0 ? 0 : -10,
zo >= 0 ? 0 : -10,
xo > 0 ? 10 : 1,
yo > 0 ? 10 : 1,
zo > 0 ? 10 : 1,
null,
ToolHandler.materialsPick,
silk,
fortune);
if (!player.isSneaking()) {
ToolHandler.removeBlocksInIteration(
player,
world,
x,
y,
z,
xo >= 0 ? 0 : -10,
yo >= 0 ? 0 : -10,
zo >= 0 ? 0 : -10,
xo > 0 ? 10 : 1,
yo > 0 ? 10 : 1,
zo > 0 ? 10 : 1,
null,
ToolHandler.materialsPick,
silk,
fortune);
}
break;
}
}
@@ -11,7 +11,9 @@
*/
package thaumic.tinkerer.common.item.kami.tool;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -40,11 +42,14 @@ import thaumic.tinkerer.common.dim.WorldProviderBedrock;
public final class ToolHandler {
public static Material[] materialsPick = new Material[] { Material.rock, Material.iron, Material.ice,
Material.glass, Material.piston, Material.anvil };
public static Material[] materialsShovel = new Material[] { Material.grass, Material.ground, Material.sand,
public final static Material[] materialsShovel = new Material[] { Material.grass, Material.ground, Material.sand,
Material.snow, Material.craftedSnow, Material.clay };
public static Material[] materialsAxe = new Material[] { Material.coral, Material.leaves, Material.plants,
public final static Material[] materialsPick = Stream.concat(
Arrays.stream(
new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston,
Material.anvil }),
Arrays.stream(materialsShovel)).toArray(Material[]::new);
public final static Material[] materialsAxe = new Material[] { Material.coral, Material.leaves, Material.plants,
Material.wood };
public static int getMode(ItemStack tool) {
@@ -74,7 +79,6 @@ public final class ToolHandler {
for (int x1 = xs; x1 < xe; x1++) {
for (int y1 = ys; y1 < ye; y1++) {
for (int z1 = zs; z1 < ze; z1++) {
if (x == x1 + x && y == y1 + y && z == z1 + z) continue;
Block lock2 = world.getBlock(x1 + x, y1 + y, z1 + z);
breakExtraBlock(player.worldObj, x1 + x, y1 + y, z1 + z, player, x, y, z, materialsListing);
@@ -102,6 +106,15 @@ public final class ToolHandler {
// only effective materials
if (!block.canHarvestBlock(player, meta) || !isRightMaterial(block.getMaterial(), materialsListing)) return;
if (block == Blocks.bedrock) {
// Ignore top & bottom 2 bedrock layers (Bedrock dimension only)
if (y > 253 && world.provider instanceof WorldProviderBedrock) return;
// Ignore bedrock in all other dimensions
if (!(world.provider instanceof WorldProviderBedrock)) return;
}
Block refBlock = world.getBlock(refX, refY, refZ);
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
@@ -45,66 +45,44 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) {
case LibGuiIDs.GUI_ID_TABLET:
return new ContainerAnimationTablet((TileAnimationTablet) tile, player.inventory);
case LibGuiIDs.GUI_ID_MOB_MAGNET:
return new ContainerMobMagnet((TileMobMagnet) tile, player.inventory);
case LibGuiIDs.GUI_ID_ENCHANTER:
return new ContainerEnchanter((TileEnchanter) tile, player.inventory);
case LibGuiIDs.GUI_ID_ASPECT_ANALYZER:
return new ContainerAspectAnalyzer((TileAspectAnalyzer) tile, player.inventory);
case LibGuiIDs.GUI_ID_ICHOR_POUCH:
if (!isDimensionAllowed(player)) return null;
return new ContainerIchorPouch(player, player.getCurrentEquippedItem());
case LibGuiIDs.GUI_ID_WARP_GATE:
return new ContainerWarpGate((TileWarpGate) tile, player.inventory);
case LibGuiIDs.GUI_ID_REMOTE_PLACER:
return new ContainerRemotePlacer((TileRPlacer) tile, player.inventory);
}
return null;
return switch (ID) {
case LibGuiIDs.GUI_ID_TABLET -> new ContainerAnimationTablet((TileAnimationTablet) tile, player.inventory);
case LibGuiIDs.GUI_ID_MOB_MAGNET -> new ContainerMobMagnet((TileMobMagnet) tile, player.inventory);
case LibGuiIDs.GUI_ID_ENCHANTER -> new ContainerEnchanter((TileEnchanter) tile, player.inventory);
case LibGuiIDs.GUI_ID_ASPECT_ANALYZER -> new ContainerAspectAnalyzer(
(TileAspectAnalyzer) tile,
player.inventory);
case LibGuiIDs.GUI_ID_ICHOR_POUCH -> isDimensionAllowed(player)
? new ContainerIchorPouch(player, player.getCurrentEquippedItem())
: null;
case LibGuiIDs.GUI_ID_WARP_GATE -> new ContainerWarpGate((TileWarpGate) tile, player.inventory);
case LibGuiIDs.GUI_ID_REMOTE_PLACER -> new ContainerRemotePlacer((TileRPlacer) tile, player.inventory);
default -> null;
};
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) {
case LibGuiIDs.GUI_ID_TABLET:
return new GuiAnimationTablet((TileAnimationTablet) tile, player.inventory);
case LibGuiIDs.GUI_ID_MOB_MAGNET:
return new GuiMobMagnet((TileMobMagnet) tile, player.inventory);
case LibGuiIDs.GUI_ID_ENCHANTER:
return new GuiEnchanting((TileEnchanter) tile, player.inventory);
case LibGuiIDs.GUI_ID_ASPECT_ANALYZER:
return new GuiAspectAnalyzer((TileAspectAnalyzer) tile, player.inventory);
case LibGuiIDs.GUI_ID_ICHOR_POUCH:
if ((!isDimensionAllowed(player))) return null;
return new GuiIchorPouch(new ContainerIchorPouch(player, player.getCurrentEquippedItem()));
case LibGuiIDs.GUI_ID_WARP_GATE:
return new GuiWarpGate((TileWarpGate) tile, player.inventory);
case LibGuiIDs.GUI_ID_WARP_GATE_DESTINATIONS:
return new GuiWarpGateDestinations((TileWarpGate) tile);
case LibGuiIDs.GUI_ID_REMOTE_PLACER:
return new GuiRemotePlacer((TileRPlacer) tile, player.inventory);
}
return null;
return switch (ID) {
case LibGuiIDs.GUI_ID_TABLET -> new GuiAnimationTablet((TileAnimationTablet) tile, player.inventory);
case LibGuiIDs.GUI_ID_MOB_MAGNET -> new GuiMobMagnet((TileMobMagnet) tile, player.inventory);
case LibGuiIDs.GUI_ID_ENCHANTER -> new GuiEnchanting((TileEnchanter) tile, player.inventory);
case LibGuiIDs.GUI_ID_ASPECT_ANALYZER -> new GuiAspectAnalyzer((TileAspectAnalyzer) tile, player.inventory);
case LibGuiIDs.GUI_ID_ICHOR_POUCH -> isDimensionAllowed(player)
? new GuiIchorPouch(new ContainerIchorPouch(player, player.getCurrentEquippedItem()))
: null;
case LibGuiIDs.GUI_ID_WARP_GATE -> new GuiWarpGate((TileWarpGate) tile, player.inventory);
case LibGuiIDs.GUI_ID_WARP_GATE_DESTINATIONS -> new GuiWarpGateDestinations((TileWarpGate) tile);
case LibGuiIDs.GUI_ID_REMOTE_PLACER -> new GuiRemotePlacer((TileRPlacer) tile, player.inventory);
default -> null;
};
}
public static boolean isDimensionAllowed(EntityPlayer player) {
Integer currentDimID = (player.worldObj.provider.dimensionId);
String currentDimID = Integer.toString(player.worldObj.provider.dimensionId);
for (String id : ConfigHandler.forbiddenDimensions) {
if (id.equals(currentDimID.toString())) return false;
if (id.equals(currentDimID)) return false;
}
return true;
}
@@ -12,82 +12,74 @@
package thaumic.tinkerer.common.network.packet;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
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 io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.TileEnchanter;
import thaumic.tinkerer.common.block.tile.container.ContainerEnchanter;
import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
public class PacketEnchanterAddEnchant extends PacketTile<TileEnchanter>
implements IMessageHandler<PacketEnchanterAddEnchant, IMessage> {
public class PacketEnchanterAddEnchant implements IMessage, IMessageHandler<PacketEnchanterAddEnchant, IMessage> {
private static final long serialVersionUID = -2182522429849764376L;
int enchant;
int level;
public PacketEnchanterAddEnchant() {
super();
}
public PacketEnchanterAddEnchant() {}
public PacketEnchanterAddEnchant(TileEnchanter tile, int enchant, int level) {
super(tile);
public PacketEnchanterAddEnchant(int enchant, int level) {
this.enchant = enchant;
this.level = level;
}
@Override
public void toBytes(ByteBuf byteBuf) {
super.toBytes(byteBuf);
byteBuf.writeInt(enchant);
byteBuf.writeInt(level);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
super.fromBytes(byteBuf);
enchant = byteBuf.readInt();
level = byteBuf.readInt();
}
@Override
public IMessage onMessage(PacketEnchanterAddEnchant message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketEnchanterAddEnchant " + message + "on client side!");
if (message.tile.working) return null;
final var player = ctx.getServerHandler().playerEntity;
if (!(player.openContainer instanceof ContainerEnchanter container)) return null;
final var tile = container.enchanter;
if (tile.working) return null;
if (message.level == -1) {
int index = message.tile.enchantments.indexOf(message.enchant);
int index = tile.enchantments.indexOf(message.enchant);
if (index != -1) {
message.tile.removeLevel(index);
message.tile.removeEnchant(index);
tile.removeLevel(index);
tile.removeEnchant(index);
}
} else {
if (!message.tile.enchantments.contains(message.enchant)) {
if (message.player != null
&& EnchantmentManager.canApply(
message.tile.getStackInSlot(0),
Enchantment.enchantmentsList[message.enchant],
message.tile.enchantments)
if (!tile.enchantments.contains(message.enchant)) {
if (EnchantmentManager.canApply(
tile.getStackInSlot(0),
Enchantment.enchantmentsList[message.enchant],
tile.enchantments)
&& EnchantmentManager.canEnchantmentBeUsed(
((EntityPlayer) message.player).getGameProfile().getName(),
player.getGameProfile().getName(),
Enchantment.enchantmentsList[message.enchant])) {
message.tile.appendEnchant(message.enchant);
message.tile.appendLevel(1);
tile.appendEnchant(message.enchant);
tile.appendLevel(1);
}
} else {
int maxLevel = Enchantment.enchantmentsList[message.enchant].getMaxLevel();
message.tile.setLevel(
message.tile.enchantments.indexOf(message.enchant),
tile.setLevel(
tile.enchantments.indexOf(message.enchant),
Math.max(1, Math.min(maxLevel, message.level)));
}
}
message.tile.updateAspectList();
tile.updateAspectList();
message.tile.getWorldObj().markBlockForUpdate(message.tile.xCoord, message.tile.yCoord, message.tile.zCoord);
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
return null;
}
}
@@ -14,32 +14,29 @@ package thaumic.tinkerer.common.network.packet;
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 thaumic.tinkerer.common.block.tile.TileEnchanter;
import io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.container.ContainerEnchanter;
public class PacketEnchanterStartWorking extends PacketTile<TileEnchanter>
implements IMessageHandler<PacketEnchanterStartWorking, IMessage> {
public class PacketEnchanterStartWorking implements IMessage, IMessageHandler<PacketEnchanterStartWorking, IMessage> {
private static final long serialVersionUID = -9086252088394185376L;
public PacketEnchanterStartWorking() {}
public PacketEnchanterStartWorking() {
super();
}
@Override
public void fromBytes(ByteBuf buf) {}
public PacketEnchanterStartWorking(TileEnchanter tile) {
super(tile);
}
public void handle() {}
@Override
public void toBytes(ByteBuf buf) {}
@Override
public IMessage onMessage(PacketEnchanterStartWorking message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketEnchanterStartWorking " + message + "on client side!");
if (!message.tile.working && !message.tile.enchantments.isEmpty() && !message.tile.levels.isEmpty()) {
message.tile.working = true;
message.tile.getWorldObj()
.markBlockForUpdate(message.tile.xCoord, message.tile.yCoord, message.tile.zCoord);
final var player = ctx.getServerHandler().playerEntity;
if (!(player.openContainer instanceof ContainerEnchanter container)) return null;
final var tile = container.enchanter;
if (!tile.working && !tile.enchantments.isEmpty() && !tile.levels.isEmpty()) {
tile.working = true;
tile.markDirty();
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
}
return null;
}
@@ -16,41 +16,34 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.TileMobMagnet;
import thaumic.tinkerer.common.block.tile.container.ContainerMobMagnet;
public class PacketMobMagnetButton extends PacketTile<TileMobMagnet>
implements IMessageHandler<PacketMobMagnetButton, IMessage> {
public class PacketMobMagnetButton implements IMessage, IMessageHandler<PacketMobMagnetButton, IMessage> {
private static final long serialVersionUID = 7613980953987386713L;
public boolean adult;
public PacketMobMagnetButton() {
super();
}
public PacketMobMagnetButton() {}
public PacketMobMagnetButton(TileMobMagnet tile) {
super(tile);
adult = tile.adult;
}
@Override
public void toBytes(ByteBuf byteBuf) {
super.toBytes(byteBuf);
byteBuf.writeBoolean(adult);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
super.fromBytes(byteBuf);
adult = byteBuf.readBoolean();
}
@Override
public IMessage onMessage(PacketMobMagnetButton message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketTabletbutton " + message + "on client side!");
message.tile.adult = message.adult;
final var player = ctx.getServerHandler().playerEntity;
if (player.openContainer instanceof ContainerMobMagnet container) {
container.mobMagnet.setAdult(adult);
}
return null;
}
}
@@ -5,42 +5,38 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.TileRPlacer;
import thaumic.tinkerer.common.block.tile.container.ContainerRemotePlacer;
/**
* Created by nekosune on 30/06/14.
*/
public class PacketPlacerButton extends PacketTile<TileRPlacer>
implements IMessageHandler<PacketPlacerButton, IMessage> {
public class PacketPlacerButton implements IMessage, IMessageHandler<PacketPlacerButton, IMessage> {
public int blocks;
public PacketPlacerButton() {
super();
}
public PacketPlacerButton() {}
public PacketPlacerButton(TileRPlacer tile) {
super(tile);
blocks = tile.blocks;
}
@Override
public void toBytes(ByteBuf byteBuf) {
super.toBytes(byteBuf);
byteBuf.writeInt(blocks);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
super.fromBytes(byteBuf);
blocks = byteBuf.readInt();
}
@Override
public IMessage onMessage(PacketPlacerButton message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketPlacerbutton " + message + "on client side!");
message.tile.blocks = message.blocks;
final var player = ctx.getServerHandler().playerEntity;
if (!(player.openContainer instanceof ContainerRemotePlacer container)) return null;
final var tile = container.placer;
tile.setDistance(blocks);
return null;
}
}
@@ -15,45 +15,43 @@ 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 io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.container.ContainerAnimationTablet;
import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
public class PacketTabletButton extends PacketTile<TileAnimationTablet>
implements IMessageHandler<PacketTabletButton, IMessage> {
public class PacketTabletButton implements IMessage, IMessageHandler<PacketTabletButton, IMessage> {
private static final long serialVersionUID = -6507755382924554527L;
boolean leftClick, redstone;
public PacketTabletButton() {
super();
}
public PacketTabletButton() {}
public PacketTabletButton(TileAnimationTablet tile) {
super(tile);
leftClick = tile.leftClick;
redstone = tile.redstone;
}
@Override
public void toBytes(ByteBuf byteBuf) {
super.toBytes(byteBuf);
byteBuf.writeBoolean(leftClick);
byteBuf.writeBoolean(redstone);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
super.fromBytes(byteBuf);
leftClick = byteBuf.readBoolean();
redstone = byteBuf.readBoolean();
}
@Override
public IMessage onMessage(PacketTabletButton message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketTabletbutton " + message + "on client side!");
message.tile.leftClick = message.leftClick;
message.tile.redstone = message.redstone;
final var player = ctx.getServerHandler().playerEntity;
if (!(player.openContainer instanceof ContainerAnimationTablet container)) return null;
final var tile = container.tablet;
tile.leftClick = message.leftClick;
tile.redstone = message.redstone;
tile.markDirty();
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
return null;
}
}
@@ -1,80 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as part of the ThaumicTinkerer Mod.
*
* ThaumicTinkerer is Open Source and distributed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0
* License (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4. Thaumcraft 4 (c) Azanor 2012
* (http://www.minecraftforum.net/topic/1585216-)
*
* File Created @ [9 Sep 2013, 17:00:10 (GMT)]
*/
package thaumic.tinkerer.common.network.packet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import thaumic.tinkerer.client.core.proxy.TTClientProxy;
import thaumic.tinkerer.common.core.helper.MiscHelper;
public abstract class PacketTile<T extends TileEntity> implements IMessage {
private static final long serialVersionUID = -1447633008013055477L;
protected int dim, x, y, z;
protected transient T tile;
protected transient EntityPlayer player;
public PacketTile() {}
public PacketTile(T tile) {
this.tile = tile;
this.x = tile.xCoord;
this.y = tile.yCoord;
this.z = tile.zCoord;
this.dim = tile.getWorldObj().provider.dimensionId;
}
@Override
public void toBytes(ByteBuf byteBuf) {
byteBuf.writeInt(x);
byteBuf.writeInt(y);
byteBuf.writeInt(z);
byteBuf.writeInt(dim);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
x = byteBuf.readInt();
y = byteBuf.readInt();
z = byteBuf.readInt();
dim = byteBuf.readInt();
}
public IMessage onMessage(PacketTile message, MessageContext ctx) {
MinecraftServer server = MiscHelper.server();
if (ctx.side.isClient()) message.player = TTClientProxy.getPlayer();
else {
message.player = ctx.getServerHandler().playerEntity;
}
if (server != null) {
World world = server.worldServerForDimension(message.dim);
if (world == null) {
MiscHelper.printCurrentStackTrace("No world found for dimension " + message.dim + "!");
return null;
}
TileEntity tile = world.getTileEntity(message.x, message.y, message.z);
if (tile != null) {
message.tile = (T) tile;
}
}
return null;
}
}
@@ -15,42 +15,35 @@ 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 io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.container.kami.ContainerWarpGate;
import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
import thaumic.tinkerer.common.network.packet.PacketTile;
public class PacketWarpGateButton extends PacketTile<TileWarpGate>
implements IMessageHandler<PacketWarpGateButton, IMessage> {
public class PacketWarpGateButton implements IMessage, IMessageHandler<PacketWarpGateButton, IMessage> {
private static final long serialVersionUID = 1497188581985763661L;
boolean locked;
public PacketWarpGateButton() {
super();
}
public PacketWarpGateButton() {}
public PacketWarpGateButton(TileWarpGate tile) {
super(tile);
locked = tile.locked;
}
@Override
public void toBytes(ByteBuf byteBuf) {
super.toBytes(byteBuf);
byteBuf.writeBoolean(locked);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
super.fromBytes(byteBuf);
locked = byteBuf.readBoolean();
}
@Override
public IMessage onMessage(PacketWarpGateButton message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketWarpgateButton " + message + "on client side!");
message.tile.locked = message.locked;
final var player = ctx.getServerHandler().playerEntity;
if (player.openContainer instanceof ContainerWarpGate container) {
container.gate.setLocked(locked);
}
return null;
}
}
@@ -11,49 +11,53 @@
*/
package thaumic.tinkerer.common.network.packet.kami;
import net.minecraft.entity.player.EntityPlayer;
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 io.netty.buffer.ByteBuf;
import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
import thaumic.tinkerer.common.network.packet.PacketTile;
public class PacketWarpGateTeleport extends PacketTile<TileWarpGate>
implements IMessageHandler<PacketWarpGateTeleport, IMessage> {
public class PacketWarpGateTeleport implements IMessage, IMessageHandler<PacketWarpGateTeleport, IMessage> {
private static final long serialVersionUID = 2247241734524685744L;
int x, y, z;
int index;
public PacketWarpGateTeleport() {
super();
}
public PacketWarpGateTeleport() {}
public PacketWarpGateTeleport(TileWarpGate tile, int index) {
super(tile);
this.x = tile.xCoord;
this.y = tile.yCoord;
this.z = tile.zCoord;
this.index = index;
}
@Override
public void toBytes(ByteBuf byteBuf) {
super.toBytes(byteBuf);
byteBuf.writeInt(x);
byteBuf.writeInt(y);
byteBuf.writeInt(z);
byteBuf.writeInt(index);
}
@Override
public void fromBytes(ByteBuf byteBuf) {
super.fromBytes(byteBuf);
x = byteBuf.readInt();
y = byteBuf.readInt();
z = byteBuf.readInt();
index = byteBuf.readInt();
}
@Override
public IMessage onMessage(PacketWarpGateTeleport message, MessageContext ctx) {
super.onMessage(message, ctx);
if (!ctx.side.isServer())
throw new IllegalStateException("received PacketTabletbutton " + message + "on client side!");
if (message.player instanceof EntityPlayer)
message.tile.teleportPlayer((EntityPlayer) message.player, message.index);
final var player = ctx.getServerHandler().playerEntity;
final var world = player.worldObj;
if (world.blockExists(message.x, message.y, message.z)
&& world.getTileEntity(message.x, message.y, message.z) instanceof TileWarpGate warpGate
&& player.boundingBox.intersectsWith(warpGate.getTeleportRange().expand(0.1, 0.1, 0.1))) {
warpGate.teleportPlayer(player, message.index);
}
return null;
}
}
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.common.Loader;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.CrucibleRecipe;
@@ -34,6 +33,7 @@ import thaumic.tinkerer.client.lib.LibResources;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.mobilizer.BlockMobilizer;
import thaumic.tinkerer.common.block.mobilizer.BlockMobilizerRelay;
import thaumic.tinkerer.common.compat.LoadedMods;
import thaumic.tinkerer.common.lib.LibResearch;
public final class ResearchHelper {
@@ -174,7 +174,7 @@ public final class ResearchHelper {
new ResourceLocation(LibResources.ENCHANT_VALIANCE)).setParents(LibResearch.KEY_ENCHANT_VAMPIRISM);
research.setPages(new ResearchPage("0")).setSecondary().registerResearchItem();
// Peripheral documentation research
if (Loader.isModLoaded("ComputerCraft")) {
if (LoadedMods.computerCraftLoaded) {
research = new TTResearchItem(
LibResearch.KEY_PERIPHERALS,
new AspectList(),
@@ -107,6 +107,7 @@ item.infusedPotion.Ignis.name=Potion of Ignis
item.infusedPotion.Terra.name=Potion of Terra
item.infusedPotion.Aqua.name=Potion of Aqua
item.infusedGrain.name=Imbued Grain
item.mobDisplay.name=Unknown Mob
# KAMI ITEM NAMES
item.kamiResource.name=Kami Resource
item.ichor.name=Ichor
@@ -446,7 +447,7 @@ ttresearch.page.REVEALING_HELM.0=As it turns out, goggles don't offer much prote
# -- THAUMIC REHABILITATOR
ttresearch.name.REPAIRER=Thaumic Restorer
ttresearch.lore.REPAIRER=Undoing the damage you've done
ttresearch.page.REPAIRER.0=You created a new contraption to restore broken tools. By right clicking this block with a broken tool and hooking it to essentia tubes, it'll gather essentia to repair the tool.<BR><BR>The essentia that will repair items is Instrumentum.<BR><BR>Looking at the block with goggles of revealing also shows how worn down the item in it still is. Redstone current will be emitted while an item is being repaired.
ttresearch.page.REPAIRER.0=You created a new contraption to restore broken tools. By right clicking this block with a broken tool and hooking it to essentia tubes, it'll gather essentia to repair the tool.<BR><BR>The essentia that will repair items is Instrumentum.<BR><BR>Looking at the block with goggles of revealing also shows how worn down the item in it still is. Redstone current will be emitted while an item is being repaired.<BR><BR>Items can be inserted and extracted with automation. It will only extract the item when repairing is done.
# -- WAND FOCUS: DISTORTION
ttresearch.name.FOCUS_DEFLECT=Wand Focus: Distortion
@@ -653,3 +654,7 @@ ttwaila.pullingAdultType=Pulling: Adult %s
ttwaila.pullingChildType=Pulling: Child %s
ttwaila.pushingAdultType=Pushing: Adult %s
ttwaila.pushingChildType=Pushing: Child %s
# -- NEI
tt.nei.category.infusedseeds=Infused Seed Drops
tt.nei.chance=Drop Chance
@@ -443,7 +443,7 @@ ttresearch.page.REVEALING_HELM.0=Очки откровения не дают в
# -- THAUMIC REHABILITATOR
ttresearch.name.REPAIRER=Таум-восстановитель
ttresearch.lore.REPAIRER=Меньше трещин, чем в чипсах
ttresearch.page.REPAIRER.0=Вы открыли новый способ починки вещей. Используйте поломанный инструмент на этом блоке, подцепленном к трубам с эссенцией. Специальный механизм возьмет нужную для починки эссенцию.<BR><BR>Нужные эссенции, в основном, это Ordo, Fabrico и Instrumentum.<BR><BR>Через очки в восстановителе можно увидеть, насколько инструмент еще поломан.
ttresearch.page.REPAIRER.0=Вы открыли новый способ починки вещей. Используйте поломанный инструмент на этом блоке, подцепленном к трубам с эссенцией. Специальный механизм возьмет нужную для починки эссенцию.<BR><BR>Нужная эссенция - Instrumentum.<BR><BR>Через очки в восстановителе можно увидеть, насколько инструмент еще поломан.<BR><BR>Предметы можно класть и доставать с помощью автоматизации. Доставаться будут только полностью починенные предметы.
# -- WAND FOCUS: DISTORTION
ttresearch.name.FOCUS_DEFLECT=Набалдашник: Искажение
Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB