mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-15 09:45:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9f605f243 | ||
|
|
fc15fb492a | ||
|
|
b3a23f53db | ||
|
|
28f4def938 | ||
|
|
5e12defde0 |
No files matched your search
@@ -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
-15
@@ -1,27 +1,27 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-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-994-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.12:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.13:dev') {transitive=false}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.25-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.14:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.31:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.30:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.93-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.10:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.16:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.47-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.54.01: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.24:dev")
|
||||
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.25:dev")
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:AspectRecipeIndex:1.1.3:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:AspectRecipeIndex:1.1.5:dev')
|
||||
}
|
||||
@@ -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],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/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
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -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
|
||||
@@ -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
@@ -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
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.26"
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.34"
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,9 @@ 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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+24
-32
@@ -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;
|
||||
}
|
||||
}
|
||||
+16
-19
@@ -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;
|
||||
}
|
||||
}
|
||||
+7
-14
@@ -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;
|
||||
}
|
||||
}
|
||||
+21
-17
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user