mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef3e0a8d6e | ||
|
|
f386ed77ac | ||
|
|
fe6105ae82 | ||
|
|
70874f7801 | ||
|
|
cfb6632c9b |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
//version: 1707058017
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhconvention")
|
||||
}
|
||||
+14
-17
@@ -1,32 +1,29 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.9-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-752-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.2:dev') {
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-660-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.4.9:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
|
||||
exclude module: 'Baubles'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.6-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.6:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.9.15:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.14-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.10:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.6-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.12.18-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.19:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.7.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.12:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.13.40-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.7:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.16-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.134:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.395:dev") {transitive=false}
|
||||
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.6:dev")
|
||||
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.4:dev') {
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.1:dev') {
|
||||
exclude module: 'Baubles'
|
||||
}
|
||||
}
|
||||
+3
-15
@@ -41,15 +41,11 @@ developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
enableGenericInjection = false
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
@@ -100,9 +96,7 @@ usesMixinDebug = true
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage = mixins
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
@@ -178,12 +172,6 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e1118b4c7c2858d28154d086dbff010e/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/59a9771cad43219260d9aac9a8ec4d6a/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/832229f0f6f0be60ed817c5a5e5848eb/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/b96cb7670c095245220e7d01d5927b58/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -114,6 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -171,6 +172,7 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -210,7 +212,8 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+2
-1
@@ -70,10 +70,11 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@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" %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'glease'
|
||||
url = 'https://maven.glease.net/repos/releases/'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup('net.glease')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name = "GTNH Maven"
|
||||
url = uri("https://nexus.gtnewhorizons.com/repository/public/")
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.5"
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
|
||||
}
|
||||
|
||||
|
||||
+29
-19
@@ -8,6 +8,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
@@ -16,54 +17,63 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
import thaumic.tinkerer.common.registry.TTRegistry;
|
||||
|
||||
public final class PlacementMirrorPredictionRenderer {
|
||||
|
||||
private final RenderBlocks blockRender;
|
||||
|
||||
public PlacementMirrorPredictionRenderer() {
|
||||
this.blockRender = new RenderBlocks();
|
||||
blockRender.useInventoryTint = false;
|
||||
}
|
||||
RenderBlocks blockRender = new RenderBlocks();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
List<EntityPlayer> playerEntities = world.playerEntities;
|
||||
for (EntityPlayer player : playerEntities) {
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack != null && currentStack.getItem() == TTRegistry.itemPlacementMirror) {
|
||||
if (currentStack != null
|
||||
&& currentStack.getItem()
|
||||
== ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class)
|
||||
&& ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
Block requiredBlock = ItemPlacementMirror.getBlock(stack);
|
||||
if (requiredBlock == null) return;
|
||||
int requiredMetadata = ItemPlacementMirror.getBlockMeta(stack);
|
||||
List<ChunkCoordinates> coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if (ItemPlacementMirror.hasBlocks(player, requiredBlock, requiredMetadata, coords.size())) {
|
||||
ChunkCoordinates[] coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if (ItemPlacementMirror.hasBlocks(stack, player, coords)) {
|
||||
ItemStack block = new ItemStack(
|
||||
ItemPlacementMirror.getBlock(stack),
|
||||
1,
|
||||
ItemPlacementMirror.getBlockMeta(stack));
|
||||
ChunkCoordinates lastCoords = new ChunkCoordinates(0, 0, 0);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
for (ChunkCoordinates coord : coords) {
|
||||
renderBlockAt(requiredBlock, requiredMetadata, coord);
|
||||
renderBlockAt(block, coord, lastCoords);
|
||||
lastCoords = coord;
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlockAt(Block block, int metadata, ChunkCoordinates pos) {
|
||||
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
|
||||
if (block.getItem() == null) return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(
|
||||
pos.posX + 0.5 - RenderManager.renderPosX,
|
||||
pos.posY + 0.5 - RenderManager.renderPosY,
|
||||
pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
blockRender.renderBlockAsItem(block, metadata, 1F);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
blockRender.useInventoryTint = false;
|
||||
blockRender.renderBlockAsItem(Block.getBlockFromItem(block.getItem()), block.getItemDamage(), 1F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public class GuiAnimationTablet extends GuiContainer {
|
||||
int x, y;
|
||||
|
||||
TileAnimationTablet tablet;
|
||||
List<GuiButtonAT> buttonListAT = new ArrayList<>();
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
|
||||
public GuiAnimationTablet(TileAnimationTablet tablet, InventoryPlayer playerInv) {
|
||||
@@ -50,26 +51,25 @@ public class GuiAnimationTablet extends GuiContainer {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListAT.clear();
|
||||
addButton(new GuiButtonAT(0, x + xSize / 2 - 7, y + 60, tablet.redstone));
|
||||
addButton(new GuiButtonATRadio(1, x + 52, y + 15, tablet.leftClick, radioButtons));
|
||||
addButton(new GuiButtonATRadio(2, x + 111, y + 15, !tablet.leftClick, radioButtons));
|
||||
buttonList = buttonListAT;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonAT button) {
|
||||
buttonList.add(button);
|
||||
buttonListAT.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
var button0 = (GuiButtonAT) buttonList.get(0);
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else {
|
||||
button0.buttonEnabled = !button0.buttonEnabled;
|
||||
}
|
||||
else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
tablet.leftClick = ((GuiButtonAT) buttonList.get(1)).buttonEnabled;
|
||||
tablet.redstone = button0.buttonEnabled;
|
||||
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
|
||||
tablet.redstone = buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
ItemStack stack = null;
|
||||
TileMobMagnet mobMagnet;
|
||||
|
||||
List<GuiButtonMM> buttonListMM = new ArrayList<>();
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
|
||||
public GuiMobMagnet(TileMobMagnet tile, InventoryPlayer playerInv) {
|
||||
@@ -54,21 +55,23 @@ public class GuiMobMagnet extends GuiContainer {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListMM.clear();
|
||||
addButton(new GuiButtonMMRadio(0, x + 100, y + 28, mobMagnet.adult, radioButtons));
|
||||
addButton(new GuiButtonMMRadio(1, x + 100, y + 48, !mobMagnet.adult, radioButtons));
|
||||
buttonList = buttonListMM;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonMM button) {
|
||||
buttonList.add(button);
|
||||
buttonListMM.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonList.get(0).enabled = !buttonList.get(0).enabled;
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
|
||||
mobMagnet.adult = buttonList.get(0).enabled;
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
|
||||
int x, y;
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
List<GuiButtonRP> buttonListRP = new ArrayList<>();
|
||||
TileRPlacer placer;
|
||||
Aspect aspectHovered = null;
|
||||
|
||||
@@ -42,24 +43,23 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListRP.clear();
|
||||
addButton(new GuiButtonRPRadio(0, x + 100, y + 0, placer.blocks == 1, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(1, x + 100, y + 13, placer.blocks == 2, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(2, x + 100, y + 26, placer.blocks == 3, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(3, x + 100, y + 39, placer.blocks == 4, radioButtons));
|
||||
buttonList = buttonListRP;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonRP button) {
|
||||
buttonList.add(button);
|
||||
buttonListRP.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton iRadioButton) iRadioButton.enableFromClick();
|
||||
else {
|
||||
var button0 = (GuiButtonRP) buttonList.get(0);
|
||||
button0.buttonEnabled = !button0.buttonEnabled;
|
||||
}
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListRP.get(0).buttonEnabled = !buttonListRP.get(0).buttonEnabled;
|
||||
|
||||
placer.blocks = par1GuiButton.id + 1;
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
|
||||
Aspect aspect = BlockInfusedGrain.getAspect(world, x, y, z);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
if (aspect != null && !aspect.isPrimal()) {
|
||||
// Hex to RGB code from vanilla tesselator
|
||||
float r = (aspect.getColor() >> 16 & 0xFF) / 255.0F;
|
||||
@@ -35,14 +34,15 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
|
||||
float b = (aspect.getColor() & 0xFF) / 255.0F;
|
||||
|
||||
GL11.glColor4f(r, g, b, 1F);
|
||||
tess.setColorRGBA_I(aspect.getColor(), 255);
|
||||
Tessellator.instance.setColorRGBA_I(aspect.getColor(), 255);
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture(block.getIcon(world, x, y, z, world.getBlockMetadata(x, y, z)));
|
||||
tess.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
renderer.renderBlockCropsImpl(block, world.getBlockMetadata(x, y, z), x, y - 0.0625F, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
// tess.setColorOpaque_I(0xFFFFFF);
|
||||
// Tessellator.instance.setColorOpaque_I(0xFFFFFF);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -3,6 +3,7 @@ package thaumic.tinkerer.client.render.item;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -18,6 +19,8 @@ import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
*/
|
||||
public class RenderGenericSeeds implements IItemRenderer {
|
||||
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (type == ItemRenderType.INVENTORY) return true;
|
||||
|
||||
@@ -2,6 +2,7 @@ package thaumic.tinkerer.client.render.item;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -15,6 +16,8 @@ import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
|
||||
public class RenderMobDisplay implements IItemRenderer {
|
||||
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||
return true;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package thaumic.tinkerer.client.render.item.kami;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
@@ -13,6 +15,9 @@ import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
|
||||
public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
RenderItem render = new RenderItem();
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
@@ -64,7 +69,6 @@ public class RenderPlacementMirror implements IItemRenderer {
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(45f, 0f, 1f, 0f);
|
||||
GL11.glScalef(1.5f, 1.8f, 1.8f);
|
||||
@@ -73,7 +77,6 @@ public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -47,18 +47,12 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
|
||||
int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
renderOverlay(tile, overlayCenter, -1, false, 0.65, 0.13F, partialTicks);
|
||||
if (tile.leftClick) renderOverlay(tile, overlayLeft, 1, true, 1, 0.13F, partialTicks);
|
||||
else renderOverlay(tile, overlayRight, 1, true, 1, 0.131F, partialTicks);
|
||||
renderIndents(tile, rotation + 90F);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(true);
|
||||
renderOverlay(tile, overlayCenter, -1, false, false, 0.65, 0.13F, 0F);
|
||||
if (tile.leftClick) renderOverlay(tile, overlayLeft, 1, false, true, 1, 0.13F, 0F);
|
||||
else renderOverlay(tile, overlayRight, 1, false, true, 1, 0.131F, 0F);
|
||||
renderOverlay(tile, overlayIndent, 0, false, false, 0.5F, 0.13F, rotation + 90F);
|
||||
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.1, 0.2 + Math.cos(System.currentTimeMillis() / 600D) / 18F, 0.5);
|
||||
@@ -66,10 +60,9 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(translations[0], translations[1], translations[2]);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
GL11.glTranslatef(0.5F, 0F, 0.5F);
|
||||
float swingProgress = tile.getRenderSwingProgress(partialTicks);
|
||||
GL11.glRotatef(swingProgress, 0F, 0F, 1F);
|
||||
GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
GL11.glTranslatef(-swingProgress / 250F, swingProgress / 1000F, 0F);
|
||||
GL11.glTranslatef(-tile.swingProgress / 250F, tile.swingProgress / 1000F, 0F);
|
||||
GL11.glRotatef((float) Math.cos(System.currentTimeMillis() / 400F) * 5F, 1F, 0F, 1F);
|
||||
renderItem(tile);
|
||||
GL11.glPopMatrix();
|
||||
@@ -79,8 +72,6 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
ItemStack stack = tablet.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.worldObj = tablet.getWorldObj();
|
||||
int stackSize = entityitem.getEntityItem().stackSize;
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
@@ -90,24 +81,25 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
entityitem.getEntityItem().stackSize = stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useBlend,
|
||||
double size, float height, float partialTicks) {
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod,
|
||||
boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
if (!useLighting) GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if (useBlend) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GL11.glTranslatef(0.5F, height, 0.5F);
|
||||
float deg = (tablet.getTicksExisted(partialTicks) * rotationMod % 360F);
|
||||
float deg = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
double size1 = size / 2;
|
||||
double size2 = -size1;
|
||||
@@ -117,33 +109,8 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderIndents(TileAnimationTablet tablet, float forceDeg) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(overlayIndent);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, (float) 0.13, 0.5F);
|
||||
GL11.glRotatef(forceDeg, 0F, 1F, 0F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
final double size1 = 0.25;
|
||||
final double size2 = -0.25;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(size2, 0, size1, 0, 1);
|
||||
tess.addVertexWithUV(size1, 0, size1, 1, 1);
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
int acceleration = tablet.getWorldAcceleratorBonus();
|
||||
if (acceleration != 0) {
|
||||
GL11.glRotatef(90, -1, 0, 0);
|
||||
GL11.glScalef(0.02f, -0.02f, 0.02f);
|
||||
final String s = 'x' + Integer.toString(acceleration);
|
||||
final int width = mc.fontRenderer.getStringWidth(s);
|
||||
GL11.glTranslatef(-width / 2f, 10f + mc.fontRenderer.FONT_HEIGHT / 2f, 0);
|
||||
mc.fontRenderer.drawString(s, 0, 0, 0xFFFFFF);
|
||||
}
|
||||
GL11.glDepthMask(true);
|
||||
if (!useLighting) GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,6 @@ public class ThaumicTinkerer {
|
||||
public static TTCommonProxy proxy;
|
||||
|
||||
public static boolean isBootsActive = false;
|
||||
public static boolean gtLoaded;
|
||||
public static final String BOOTS = "thaumicboots";
|
||||
|
||||
public static CommonProxy tcProxy;
|
||||
@@ -81,7 +80,6 @@ public class ThaumicTinkerer {
|
||||
if (Loader.isModLoaded(BOOTS)) {
|
||||
isBootsActive = true;
|
||||
}
|
||||
gtLoaded = Loader.isModLoaded("gregtech");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -43,7 +44,6 @@ import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibGuiIDs;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.TTRegistry;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererArcaneRecipe;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
@@ -98,32 +98,37 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tablet != null) {
|
||||
ItemStack itemstack = tablet.heldItem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (tablet.getIsBreaking()) {}
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
|
||||
.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
|
||||
if (k1 > itemstack.stackSize) k1 = itemstack.stackSize;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(
|
||||
par1World,
|
||||
par2 + f,
|
||||
par3 + f1,
|
||||
par4 + f2,
|
||||
new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
|
||||
.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
if (k1 > itemstack.stackSize) k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(
|
||||
par1World,
|
||||
par2 + f,
|
||||
par3 + f1,
|
||||
par4 + f2,
|
||||
new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound()) entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,8 +142,6 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if (par1World.isRemote) return;
|
||||
TileEntity te = par1World.getTileEntity(par2, par3, par4);
|
||||
if (!(te instanceof TileAnimationTablet tablet) || !tablet.redstone) return;
|
||||
|
||||
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)
|
||||
|| par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
|
||||
@@ -146,10 +149,9 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
boolean on = (meta & 8) != 0;
|
||||
|
||||
if (power && !on) {
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta | 8, 4);
|
||||
} else if (!power && on) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
|
||||
}
|
||||
} else if (!power && on) par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,17 +159,37 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@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 TileAnimationTablet) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (tablet.redstone && tablet.swingProgress == 0) {
|
||||
tablet.findEntities(tablet.getTargetLoc());
|
||||
tablet.initiateSwing();
|
||||
par1World.addBlockEvent(
|
||||
par2,
|
||||
par3,
|
||||
par4,
|
||||
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class),
|
||||
0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer,
|
||||
int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileAnimationTablet tablet) {
|
||||
if (tile != null) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null
|
||||
&& par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean activated = (meta & 8) != 0;
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.isIdle()) {
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F);
|
||||
} else par5EntityPlayer
|
||||
@@ -207,6 +229,11 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return new TileAnimationTablet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ANIMATION_TABLET;
|
||||
@@ -241,9 +268,10 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
-8,
|
||||
2,
|
||||
4,
|
||||
new ItemStack(TTRegistry.dynamismTablet)).setWarp(1).setParents(LibResearch.KEY_MAGNETS).setPages(
|
||||
new ResearchPage("0"),
|
||||
ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class))).setWarp(1)
|
||||
.setParents(LibResearch.KEY_MAGNETS).setPages(
|
||||
new ResearchPage("0"),
|
||||
ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,7 +279,7 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return new ThaumicTinkererArcaneRecipe(
|
||||
LibResearch.KEY_ANIMATION_TABLET,
|
||||
LibResearch.KEY_ANIMATION_TABLET,
|
||||
new ItemStack(TTRegistry.dynamismTablet),
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class)),
|
||||
new AspectList().add(Aspect.AIR, 25).add(Aspect.ORDER, 15).add(Aspect.FIRE, 10),
|
||||
"GIG",
|
||||
"ICI",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -134,6 +135,11 @@ public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
return new TileAspectAnalyzer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -152,6 +153,11 @@ public class BlockEnchanter extends BlockModContainer {
|
||||
return new TileEnchanter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -178,6 +179,11 @@ public class BlockFunnel extends BlockModContainer {
|
||||
return new TileFunnel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
|
||||
@@ -136,6 +136,11 @@ public abstract class BlockGas extends BlockMod implements ITTinkererBlock {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -46,6 +48,11 @@ public class BlockGolemConnector extends BlockCamo {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GOLEMCONNECTOR;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
@@ -52,6 +53,11 @@ public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlo
|
||||
return new TileInfusedFarmland();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.BLOCK_INFUSED_FARMLAND;
|
||||
|
||||
@@ -200,6 +200,11 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return currentAspect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.INFUSED_GRAIN_BLOCK;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -190,6 +191,11 @@ public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBl
|
||||
return (metadata & 2) == 2 ? new TileMobMagnet() : new TileMagnet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -40,6 +42,11 @@ public abstract class BlockMod extends Block implements ITTinkererBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -64,6 +65,11 @@ public class BlockPlatform extends BlockCamo {
|
||||
return new TileCamo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PLATFORM;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -82,6 +83,11 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
|
||||
return new TileRPlacer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REMOTE_PLACER;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -181,6 +182,11 @@ public class BlockRepairer extends BlockModContainer {
|
||||
return new TileRepairer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -93,6 +94,11 @@ public class BlockSummon extends Block implements ITTinkererBlock {
|
||||
: par1 == ForgeDirection.DOWN.ordinal() ? Block.getBlockFromName("obsidian").getIcon(0, 0) : iconSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.SPAWNER;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -81,8 +81,10 @@ public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockTravelSlab(true) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -30,6 +32,11 @@ public class BlockTravelStairs extends BlockStairs implements ITTinkererBlock {
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.TRAVEL_STAIRS;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -88,8 +88,10 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock, ITileEn
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockWardSlab(true) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -388,6 +389,11 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
|
||||
return MapColor.tntColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.kami;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -150,6 +151,11 @@ public class BlockWarpGate extends BlockModContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -129,6 +130,11 @@ public class BlockDarkQuartz extends BlockMod {
|
||||
pillarDarkQuartzIcon = IconHelper.forName(par1IconRegister, "pillarDarkQuartz1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -83,8 +83,10 @@ public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockDarkQuartzSlab(true) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -33,6 +35,11 @@ public class BlockDarkQuartzStairs extends BlockStairs implements ITTinkererBloc
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ_STAIRS;
|
||||
|
||||
@@ -13,180 +13,76 @@ package thaumic.tinkerer.common.block.tile.tablet;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public final class TabletFakePlayer extends FakePlayer {
|
||||
import thaumcraft.common.lib.FakeThaumcraftPlayer;
|
||||
|
||||
private final TileAnimationTablet tablet;
|
||||
public class TabletFakePlayer extends FakeThaumcraftPlayer {
|
||||
|
||||
public TabletFakePlayer(TileAnimationTablet tablet) {
|
||||
TileAnimationTablet tablet;
|
||||
|
||||
public TabletFakePlayer(TileAnimationTablet tablet) { // ,String name) {
|
||||
super(
|
||||
(WorldServer) tablet.getWorldObj(),
|
||||
tablet.getWorldObj(),
|
||||
new GameProfile(UUID.fromString("a8f026a0-135b-11e4-9191-0800200c9a66"), "[ThaumcraftTablet]"));
|
||||
// super(tablet.getWorldObj(),"[ThaumcraftTablet]");
|
||||
this.tablet = tablet;
|
||||
this.playerNetServerHandler = new DummyNetHandlerPlayServer(MinecraftServer.getServer(), this);
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
this.boundingBox.setBounds(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ);
|
||||
this.rotationPitch = -15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
inventory.clearInventory(null, -1);
|
||||
super.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.posX = tablet.xCoord + 0.5f;
|
||||
this.posY = tablet.yCoord + 0.5f;
|
||||
this.posZ = tablet.zCoord + 0.5f;
|
||||
this.inventory.currentItem = 0;
|
||||
motionX = motionY = motionZ = 0;
|
||||
capabilities.isCreativeMode = false;
|
||||
|
||||
this.capabilities.isCreativeMode = false;
|
||||
posX = tablet.xCoord + 0.5;
|
||||
posY = tablet.yCoord + 1.6;
|
||||
posZ = tablet.zCoord + 0.5;
|
||||
|
||||
if (riddenByEntity != null) riddenByEntity.ridingEntity = null;
|
||||
if (ridingEntity != null) ridingEntity.riddenByEntity = null;
|
||||
riddenByEntity = null;
|
||||
ridingEntity = null;
|
||||
|
||||
motionX = motionY = motionZ = 0;
|
||||
setHealth(20);
|
||||
isDead = false;
|
||||
|
||||
int meta = tablet.getBlockMetadata() & 7;
|
||||
int rotation = meta == 2 ? 180 : meta == 3 ? 0 : meta == 4 ? 90 : -90;
|
||||
|
||||
rotationYaw = rotationYawHead = rotation;
|
||||
// Drop everything except for held item
|
||||
for (int i = 1; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
entityDropItem(stack, 0);
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
rotationPitch = -15;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
if (i != inventory.currentItem) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
entityDropItem(stack, 1.0f);
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
syncSlots();
|
||||
}
|
||||
|
||||
public void syncSlots() {
|
||||
this.inventory.mainInventory[0] = tablet.heldItem;
|
||||
}
|
||||
|
||||
// Copied from Minecraft and PlayerControllerMP
|
||||
public boolean sendUseItem(ItemStack stack) {
|
||||
if (!ForgeEventFactory.onPlayerInteract(this, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1, worldObj)
|
||||
.isCanceled()) {
|
||||
int i = stack.stackSize;
|
||||
ItemStack itemstack1 = stack.useItemRightClick(worldObj, this);
|
||||
if (itemstack1 == stack && itemstack1.stackSize == i) {
|
||||
return false;
|
||||
}
|
||||
inventory.mainInventory[0] = itemstack1;
|
||||
|
||||
if (itemstack1.stackSize <= 0) {
|
||||
inventory.mainInventory[0] = null;
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this, itemstack1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// copied from PlayerController#onPlayerRightClick
|
||||
public boolean onPlayerRightClick(ItemStack stack, int x, int y, int z, int side, float f, float f1, float f2) {
|
||||
Item item = stack.getItem();
|
||||
if (item != null && item.onItemUseFirst(stack, this, worldObj, x, y, z, side, f, f1, f2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if (block.onBlockActivated(worldObj, x, y, z, this, side, f, f1, f2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!stack.tryPlaceItemIntoWorld(this, worldObj, x, y, z, side, f, f1, f2)) {
|
||||
return false;
|
||||
}
|
||||
if (stack.stackSize <= 0) {
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this, stack));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void addChatMessage(IChatComponent var1) {}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getPlayerCoordinates() {
|
||||
return new ChunkCoordinates(tablet.xCoord, tablet.yCoord, tablet.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMovementBlocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double x, double y, double z) {
|
||||
// NO-OP (the position is set at creation)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
// NO-OP (this should never happen...?)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mountEntity(Entity entityIn) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealth(float p_70606_1_) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLivingUpdate() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChatMessage(IChatComponent var1) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChatComponentMessage(IChatComponent chatmessagecomponent) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
private static final class DummyNetHandlerPlayServer extends NetHandlerPlayServer {
|
||||
|
||||
public DummyNetHandlerPlayServer(MinecraftServer server, FakePlayer player) {
|
||||
super(server, new NetworkManager(false), player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkTick() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacket(Packet packetIn) {
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
}
|
||||
+399
-418
File diff suppressed because it is too large.
Load diff
+6
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.transvector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -133,6 +134,11 @@ public class BlockTransvectorDislocator extends BlockCamo {
|
||||
return new TileTransvectorDislocator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DISLOCATOR;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.transvector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -47,6 +49,11 @@ public class BlockTransvectorInterface extends BlockCamo {
|
||||
return new TileTransvectorInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.INTERFACE;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package thaumic.tinkerer.common.compat;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class EMTCompat {
|
||||
|
||||
public static final boolean EMTLoaded = Loader.isModLoaded("EMT");
|
||||
public static Item electricHoe;
|
||||
|
||||
public static void init() {
|
||||
electricHoe = GameRegistry.findItem("EMT", "ElectricHoeGrowth");
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -29,8 +29,9 @@ public class DimensionalShardDropHandler {
|
||||
public void onEntityLivingDrops(LivingDropsEvent event) {
|
||||
if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
|
||||
if (event.entityLiving instanceof EntityEnderman
|
||||
&& event.entityLiving.dimension == ConfigHandler.endDimensionID)
|
||||
for (int i = 0; i <= event.lootingLevel; i++) if (Math.random() <= 1D / 32D) event.drops.add(
|
||||
&& event.entityLiving.dimension == ConfigHandler.endDimensionID
|
||||
&& Math.random() <= 1D / 32D)
|
||||
event.drops.add(
|
||||
new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
@@ -42,8 +43,9 @@ public class DimensionalShardDropHandler {
|
||||
7)));
|
||||
|
||||
if (event.entityLiving instanceof EntityPigZombie
|
||||
&& event.entityLiving.dimension == ConfigHandler.netherDimensionID)
|
||||
for (int i = 0; i <= event.lootingLevel; i++) if (Math.random() <= 1D / 32D) event.drops.add(
|
||||
&& event.entityLiving.dimension == ConfigHandler.netherDimensionID
|
||||
&& Math.random() <= 1D / 16D)
|
||||
event.drops.add(
|
||||
new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import static thaumic.tinkerer.common.compat.EMTCompat.EMTLoaded;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
@@ -10,7 +8,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
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.core.handler.ConfigHandler;
|
||||
|
||||
/**
|
||||
@@ -29,31 +26,26 @@ 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);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
var world = event.world;
|
||||
if (world.isRemote) return;
|
||||
if (!(world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain igrowable)) return;
|
||||
if (!event.world.isRemote) {
|
||||
if (event.world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain) {
|
||||
if (event.entityPlayer != null && event.entityPlayer.getCurrentEquippedItem() != null) {
|
||||
if (event.entityPlayer.getCurrentEquippedItem().getItem() == ConfigItems.itemHoeElemental) {
|
||||
IGrowable igrowable = (IGrowable) event.world.getBlock(event.x, event.y, event.z);
|
||||
|
||||
var player = event.entityPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
var hoeOfGrowth = player.getCurrentEquippedItem();
|
||||
if (!isMagicHoe(hoeOfGrowth)) return;
|
||||
|
||||
if (igrowable.func_149851_a(world, event.x, event.y, event.z, false)) {
|
||||
if (igrowable.func_149852_a(world, world.rand, event.x, event.y, event.z)) {
|
||||
igrowable.func_149853_b(world, world.rand, event.x, event.y, event.z);
|
||||
if (igrowable.func_149851_a(event.world, event.x, event.y, event.z, event.world.isRemote)) {
|
||||
if (!event.world.isRemote) {
|
||||
if (igrowable.func_149852_a(event.world, event.world.rand, event.x, event.y, event.z)) {
|
||||
igrowable.func_149853_b(event.world, event.world.rand, event.x, event.y, event.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.entityPlayer.getCurrentEquippedItem().damageItem(25, event.entityPlayer);
|
||||
Thaumcraft.proxy.blockSparkle(event.world, event.x, event.y, event.z, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hoeOfGrowth.damageItem(25, player);
|
||||
Thaumcraft.proxy.blockSparkle(world, event.x, event.y, event.z, 0, 2);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,6 @@ import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
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.core.handler.ConfigHandler;
|
||||
@@ -159,8 +158,6 @@ public class TTCommonProxy {
|
||||
} else {
|
||||
ThaumicTinkerer.log.info("Skipping TC Multipart integration");
|
||||
}
|
||||
|
||||
EMTCompat.init();
|
||||
}
|
||||
|
||||
protected void registerPackets() {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -30,6 +32,11 @@ public class ItemBlockFire extends ItemBlock implements ITTinkererItem {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return ((ITTinkererBlock) field_150939_a).getBlockName();
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -37,6 +39,11 @@ public class ItemBlockMagnet extends ItemBlock implements ITTinkererItem {
|
||||
return "tile." + (par1ItemStack.getItemDamage() == 0 ? LibBlockNames.MAGNET : LibBlockNames.MOB_MAGNET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -131,6 +133,11 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
return cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.BLOOD_SWORD;
|
||||
|
||||
@@ -292,12 +292,4 @@ public class ItemCleansingTalisman extends ItemBase implements IBauble {
|
||||
public String getItemName() {
|
||||
return LibItemNames.CLEANSING_TALISMAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack talisman, ItemStack material) {
|
||||
if (material != null
|
||||
&& material.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemDarkQuartz.class))
|
||||
return true;
|
||||
return super.getIsRepairable(talisman, material);
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,10 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -47,8 +48,10 @@ public class ItemGas extends ItemBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getMetaItems() {
|
||||
return new Item[] { new ItemGas(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockGaseousLight.class)) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList<Object> result = new ArrayList<>();
|
||||
result.add(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockGaseousLight.class));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -66,7 +65,6 @@ public class ItemGasRemover extends ItemBase {
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
Item[] gasTypes = ThaumicTinkerer.registry.getItemArrayFromClass(ItemGas.class);
|
||||
return new ThaumicTinkererArcaneRecipe(
|
||||
LibResearch.KEY_GAS_REMOVER,
|
||||
LibResearch.KEY_GAS_REMOVER,
|
||||
@@ -78,9 +76,9 @@ public class ItemGasRemover extends ItemBase {
|
||||
'D',
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemDarkQuartz.class)),
|
||||
'T',
|
||||
new ItemStack(gasTypes[0]),
|
||||
new ItemStack(ThaumicTinkerer.registry.getItemFromClass(ItemGas.class).get(0)),
|
||||
'G',
|
||||
new ItemStack(gasTypes[1]),
|
||||
new ItemStack(ThaumicTinkerer.registry.getItemFromClass(ItemGas.class).get(1)),
|
||||
'Q',
|
||||
new ItemStack(Items.quartz));
|
||||
}
|
||||
|
||||
@@ -118,6 +118,11 @@ public class ItemInfusedPotion extends ItemPotion implements ITTinkererItem {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.INFUSED_POTION;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
@@ -137,6 +138,11 @@ public class ItemInfusedSeeds extends ItemSeeds implements ITTinkererItem {
|
||||
: icons[BlockInfusedGrain.getNumberFromAspectForTexture(getAspect(stack))];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.INFUSED_SEEDS;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -111,6 +112,11 @@ public class ItemRevealingHelm extends ItemArmor
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.REVEALING_HELM;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
@@ -20,10 +22,15 @@ public class ItemTravelSlab extends ItemSlab implements ITTinkererItem {
|
||||
super(
|
||||
par1,
|
||||
(BlockSlab) ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockTravelSlab.class, 1),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockTravelSlab.class).get(1),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.TRAVEL_SLAB;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
@@ -20,10 +22,15 @@ public class ItemWardSlab extends ItemSlab implements ITTinkererItem {
|
||||
super(
|
||||
par1,
|
||||
(BlockSlab) ThaumicTinkerer.registry.getFirstBlockFromClass(BlockWardSlab.class),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockWardSlab.class, 1),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockWardSlab.class).get(1),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.WARD_SLAB;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemFocusDeflect extends ItemModFocus {
|
||||
range = wand.getFocusEnlarge(stack);
|
||||
}
|
||||
|
||||
var projectiles = p.worldObj.getEntitiesWithinAABB(
|
||||
List<Entity> projectiles = p.worldObj.getEntitiesWithinAABB(
|
||||
IProjectile.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
p.posX - (4 + range),
|
||||
@@ -74,9 +74,7 @@ public class ItemFocusDeflect extends ItemModFocus {
|
||||
p.posY + (3 + range),
|
||||
p.posZ + (3 + range)));
|
||||
|
||||
for (var projectile : projectiles) {
|
||||
if (!(projectile instanceof Entity e)) continue;
|
||||
|
||||
for (Entity e : projectiles) {
|
||||
if (CheckBlackList(e) || ProjectileHelper.getOwner(e) == p) continue;
|
||||
Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ).normalize().multiply(
|
||||
Math.sqrt(
|
||||
@@ -104,11 +102,19 @@ public class ItemFocusDeflect extends ItemModFocus {
|
||||
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack itemstack, int rank) {
|
||||
return switch (rank) {
|
||||
case 1, 3, 5 -> new FocusUpgradeType[] { FocusUpgradeType.frugal };
|
||||
case 2, 4 -> new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge };
|
||||
default -> null;
|
||||
};
|
||||
switch (rank) {
|
||||
case 1:
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.frugal };
|
||||
case 2:
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge };
|
||||
case 3:
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.frugal };
|
||||
case 4:
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge };
|
||||
case 5:
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.frugal };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean CheckBlackList(Entity entity) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.foci;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -57,6 +58,11 @@ public abstract class ItemModFocus extends ItemFocusBasic implements ITTinkererI
|
||||
if (hasDepth()) depth = IconHelper.forItem(par1IconRegister, this, "Depth");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -33,6 +35,11 @@ public class ItemBlockWarpGate extends ItemBlock implements ITTinkererItem {
|
||||
return TTCommonProxy.kamiRarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -27,10 +27,6 @@ import net.minecraftforge.common.util.Constants;
|
||||
|
||||
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;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -54,10 +50,7 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.KamiResearchItem;
|
||||
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 class ItemIchorPouch extends ItemFocusPouch implements IBauble, ITTinkererItem {
|
||||
|
||||
public ItemIchorPouch() {
|
||||
super();
|
||||
@@ -89,31 +82,17 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, IBaubleEx
|
||||
|
||||
@Override
|
||||
public ItemStack[] getInventory(ItemStack item) {
|
||||
ItemStack[] inventory = new ItemStack[13 * 9];
|
||||
if (!item.hasTagCompound()) {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
NBTTagList tagList = item.stackTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
int slot = tag.getByte("Slot") & 0xFF;
|
||||
|
||||
if (slot < inventory.length) {
|
||||
inventory[slot] = ItemStack.loadItemStackFromNBT(tag);
|
||||
ItemStack[] stackList = new ItemStack[13 * 9];
|
||||
if (item.hasTagCompound()) {
|
||||
NBTTagList var2 = item.stackTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
|
||||
for (int var3 = 0; var3 < var2.tagCount(); var3++) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
int var5 = var4.getByte("Slot") & 0xFF;
|
||||
if (var5 >= 0 && var5 < stackList.length) stackList[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List textLines, boolean showAdvancedInfo) {
|
||||
if (baublesExpandedLoaded) {
|
||||
BaubleItemHelper.addSlotInformation(textLines, getBaubleTypes(null));
|
||||
}
|
||||
return stackList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,12 +100,6 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, IBaubleEx
|
||||
return BaubleType.BELT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles|Expanded")
|
||||
public String[] getBaubleTypes(ItemStack itemstack) {
|
||||
return new String[] { "belt", "focus_pouch" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@@ -146,6 +119,11 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, IBaubleEx
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.ICHOR_POUCH;
|
||||
|
||||
@@ -34,7 +34,6 @@ import thaumic.tinkerer.common.item.kami.tool.ToolHandler;
|
||||
import thaumic.tinkerer.common.lib.LibItemNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ItemKamiBase;
|
||||
import thaumic.tinkerer.common.registry.TTRegistry;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererInfusionRecipe;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
@@ -43,6 +42,9 @@ import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
|
||||
public class ItemPlacementMirror extends ItemKamiBase {
|
||||
|
||||
@Deprecated
|
||||
private static final String TAG_BLOCK_ID = "blockID";
|
||||
|
||||
private static final String TAG_BLOCK_NAME = "blockName";
|
||||
private static final String TAG_BLOCK_META = "blockMeta";
|
||||
private static final String TAG_SIZE = "size";
|
||||
@@ -54,39 +56,40 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public static boolean hasBlocks(EntityPlayer player, Block requiredBlock, int requiredMetadata,
|
||||
int requiredAmount) {
|
||||
public static boolean hasBlocks(ItemStack stack, EntityPlayer player, ChunkCoordinates[] blocks) {
|
||||
if (player.capabilities.isCreativeMode) return true;
|
||||
|
||||
Item requiredItem = Item.getItemFromBlock(requiredBlock);
|
||||
|
||||
int required = blocks.length;
|
||||
int current = 0;
|
||||
ItemStack reqStack = new ItemStack(getBlock(stack), 1, getBlockMeta(stack));
|
||||
List<ItemStack> talismansToCheck = new ArrayList<>();
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
|
||||
if (stackInSlot == null) continue;
|
||||
Item itemInSlot = stackInSlot.getItem();
|
||||
if (itemInSlot == requiredItem) {
|
||||
if (stackInSlot.getItemDamage() == requiredMetadata) {
|
||||
current += stackInSlot.stackSize;
|
||||
if (current >= requiredAmount) return true;
|
||||
}
|
||||
} else if (itemInSlot == TTRegistry.itemBlackHoleTalisman) {
|
||||
if (ItemBlockTalisman.getBlock(stackInSlot) == requiredBlock
|
||||
&& ItemBlockTalisman.getBlockMeta(stackInSlot) == requiredMetadata) {
|
||||
talismansToCheck.add(stackInSlot);
|
||||
}
|
||||
if (stackInSlot != null && stackInSlot.getItem() == reqStack.getItem()
|
||||
&& stackInSlot.getItemDamage() == reqStack.getItemDamage()) {
|
||||
current += stackInSlot.stackSize;
|
||||
if (current >= required) return true;
|
||||
}
|
||||
if (stackInSlot != null
|
||||
&& stackInSlot.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
|
||||
talismansToCheck.add(stackInSlot);
|
||||
}
|
||||
|
||||
for (ItemStack talisman : talismansToCheck) {
|
||||
Block block = ItemBlockTalisman.getBlock(talisman);
|
||||
int meta = ItemBlockTalisman.getBlockMeta(talisman);
|
||||
|
||||
if (Item.getItemFromBlock(block) == reqStack.getItem() && meta == reqStack.getItemDamage()) {
|
||||
current += ItemBlockTalisman.getBlockCount(talisman);
|
||||
|
||||
if (current >= required) return true;
|
||||
}
|
||||
}
|
||||
for (ItemStack talisman : talismansToCheck) {
|
||||
current += ItemBlockTalisman.getBlockCount(talisman);
|
||||
|
||||
if (current >= requiredAmount) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<ChunkCoordinates> getBlocksToPlace(ItemStack stack, EntityPlayer player) {
|
||||
public static ChunkCoordinates[] getBlocksToPlace(ItemStack stack, EntityPlayer player) {
|
||||
List<ChunkCoordinates> coords = new ArrayList<>();
|
||||
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(player.worldObj, player, true, 5);
|
||||
if (pos != null) {
|
||||
@@ -121,7 +124,7 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
}
|
||||
}
|
||||
|
||||
return coords;
|
||||
return coords.toArray(new ChunkCoordinates[coords.size()]);
|
||||
}
|
||||
|
||||
private static void setSize(ItemStack stack, int size) {
|
||||
@@ -132,8 +135,16 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
return ItemNBTHelper.getInt(stack, TAG_SIZE, 3) | 1;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static int getBlockID(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, TAG_BLOCK_ID, 0);
|
||||
}
|
||||
|
||||
public static Block getBlock(ItemStack stack) {
|
||||
return Block.getBlockFromName(getBlockName(stack));
|
||||
Block block = Block.getBlockFromName(getBlockName(stack));
|
||||
if (block == Blocks.air) block = Block.getBlockById(getBlockID(stack));
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
public static String getBlockName(ItemStack stack) {
|
||||
@@ -171,20 +182,16 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
}
|
||||
|
||||
public void placeAllBlocks(ItemStack stack, EntityPlayer player) {
|
||||
Block requiredBlock = getBlock(stack);
|
||||
if (requiredBlock == null) return;
|
||||
int requiredMetadata = getBlockMeta(stack);
|
||||
List<ChunkCoordinates> blocksToPlace = getBlocksToPlace(stack, player);
|
||||
if (!hasBlocks(player, requiredBlock, requiredMetadata, blocksToPlace.size())) return;
|
||||
ChunkCoordinates[] blocksToPlace = getBlocksToPlace(stack, player);
|
||||
if (!hasBlocks(stack, player, blocksToPlace)) return;
|
||||
|
||||
ItemStack stackToPlace = new ItemStack(requiredBlock, 1, requiredMetadata);
|
||||
for (ChunkCoordinates coords : blocksToPlace) {
|
||||
placeBlockAndConsume(player, stackToPlace, coords);
|
||||
}
|
||||
ItemStack stackToPlace = new ItemStack(getBlock(stack), 1, getBlockMeta(stack));
|
||||
for (ChunkCoordinates coords : blocksToPlace) placeBlockAndConsume(player, stackToPlace, coords);
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
|
||||
}
|
||||
|
||||
private void placeBlockAndConsume(EntityPlayer player, ItemStack blockToPlace, ChunkCoordinates coords) {
|
||||
if (blockToPlace.getItem() == null) return;
|
||||
player.worldObj.setBlock(
|
||||
coords.posX,
|
||||
coords.posY,
|
||||
@@ -206,7 +213,8 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stackInSlot != null && stackInSlot.getItem() == TTRegistry.itemBlackHoleTalisman)
|
||||
if (stackInSlot != null
|
||||
&& stackInSlot.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
|
||||
talismansToCheck.add(stackInSlot);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ItemProtoclay extends ItemKamiBase {
|
||||
return super.shouldRegister();
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void Interact(PlayerInteractEvent event) {
|
||||
|
||||
@@ -185,14 +185,14 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
|
||||
|
||||
// Avoid NSM Exception when ThaumicBoots is not present.
|
||||
public double getSpeedModifier(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("speed")) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getDouble("speed");
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
public double getJumpModifier(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("jump")) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getDouble("jump");
|
||||
}
|
||||
return 1.0;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.armor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -18,7 +19,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -121,8 +121,12 @@ public class ItemIchorclothArmor extends ItemArmor
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getMetaItems() {
|
||||
return new Item[] { new ItemIchorclothArmor(1), new ItemIchorclothArmor(2), new ItemIchorclothArmor(3) };
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList<Object> result = new ArrayList<>();
|
||||
result.add(1);
|
||||
result.add(2);
|
||||
result.add(3);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.armor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -46,7 +46,7 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getMetaItems() {
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.foci;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -80,6 +81,11 @@ public abstract class ItemModKamiFocus extends ItemFocusBasic implements ITTinke
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
super.addInformation(stack, player, list, par4);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
@@ -58,6 +60,11 @@ public class ItemIchorAxe extends ItemAxe implements ITTinkererItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.ICHOR_AXE;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
@@ -62,6 +64,11 @@ public class ItemIchorPick extends ItemPickaxe implements ITTinkererItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.ICHOR_PICK;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
@@ -58,6 +60,11 @@ public class ItemIchorShovel extends ItemSpade implements ITTinkererItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.ICHOR_SHOVEL;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -57,6 +59,11 @@ public class ItemIchorSword extends ItemSword implements ITTinkererItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.ICHOR_SWORD;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ItemIchorSwordAdv extends ItemIchorSword implements IAdvancedTool {
|
||||
break;
|
||||
case 1: {
|
||||
int range = 3;
|
||||
var entities = player.worldObj.getEntitiesWithinAABB(
|
||||
List<Entity> entities = player.worldObj.getEntitiesWithinAABB(
|
||||
entity.getClass(),
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
entity.posX - range,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemMultiTexture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,6 +40,11 @@ public class ItemDarkQuartzBlock extends ItemMultiTexture implements ITTinkererI
|
||||
: LibBlockNames.DARK_QUARTZ_BLOCK_NAMES[par1ItemStack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.DARK_QUARTZ;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
@@ -28,10 +30,15 @@ public class ItemDarkQuartzSlab extends ItemSlab implements ITTinkererItem {
|
||||
super(
|
||||
par1,
|
||||
(BlockSlab) ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockDarkQuartzSlab.class, 1),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockDarkQuartzSlab.class).get(1),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.DARK_QUARTZ_SLAB;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package thaumic.tinkerer.common.registry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -9,17 +10,15 @@ import net.minecraft.tileentity.TileEntity;
|
||||
*/
|
||||
public interface ITTinkererBlock extends ITTinkererRegisterable {
|
||||
|
||||
String getBlockName();
|
||||
public ArrayList<Object> getSpecialParameters();
|
||||
|
||||
boolean shouldRegister();
|
||||
public String getBlockName();
|
||||
|
||||
boolean shouldDisplayInTab();
|
||||
public boolean shouldRegister();
|
||||
|
||||
Class<? extends ItemBlock> getItemBlock();
|
||||
public boolean shouldDisplayInTab();
|
||||
|
||||
Class<? extends TileEntity> getTileEntity();
|
||||
public Class<? extends ItemBlock> getItemBlock();
|
||||
|
||||
default Block[] getMetaBlocks() {
|
||||
return null;
|
||||
}
|
||||
public Class<? extends TileEntity> getTileEntity();
|
||||
}
|
||||
@@ -1,19 +1,17 @@
|
||||
package thaumic.tinkerer.common.registry;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by localmacaccount on 6/9/14.
|
||||
*/
|
||||
public interface ITTinkererItem extends ITTinkererRegisterable {
|
||||
|
||||
String getItemName();
|
||||
public ArrayList<Object> getSpecialParameters();
|
||||
|
||||
boolean shouldRegister();
|
||||
public String getItemName();
|
||||
|
||||
boolean shouldDisplayInTab();
|
||||
public boolean shouldRegister();
|
||||
|
||||
default Item[] getMetaItems() {
|
||||
return null;
|
||||
}
|
||||
public boolean shouldDisplayInTab();
|
||||
}
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.registry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@@ -32,6 +34,11 @@ public abstract class ItemBase extends Item implements ITTinkererItem {
|
||||
itemIcon = IconHelper.forItem(par1IconRegister, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package thaumic.tinkerer.common.registry;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -8,119 +13,221 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import com.google.common.reflect.ClassPath;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumic.tinkerer.client.lib.LibResources;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
|
||||
public class TTRegistry {
|
||||
|
||||
private final HashMap<Class, Item[]> itemRegistry = new HashMap<>();
|
||||
private ArrayList<Class> itemClasses = new ArrayList<>();
|
||||
private HashMap<Class, ArrayList<Item>> itemRegistry = new HashMap<>();
|
||||
|
||||
private final HashMap<Class, Block[]> blockRegistry = new HashMap<>();
|
||||
private ArrayList<Class> blockClasses = new ArrayList<>();
|
||||
private HashMap<Class, ArrayList<Block>> blockRegistry = new HashMap<>();
|
||||
|
||||
public static Block dynamismTablet;
|
||||
public static Item itemPlacementMirror;
|
||||
public static Item itemBlackHoleTalisman;
|
||||
public void registerClasses() {
|
||||
try {
|
||||
ClassPath classPath = ClassPath.from(this.getClass().getClassLoader());
|
||||
for (ClassPath.ClassInfo classInfo : classPath
|
||||
.getTopLevelClassesRecursive("thaumic.tinkerer.common.block")) {
|
||||
if (ITTinkererBlock.class.isAssignableFrom(classInfo.load())
|
||||
&& !Modifier.isAbstract(classInfo.load().getModifiers())) {
|
||||
blockClasses.add(classInfo.load());
|
||||
}
|
||||
}
|
||||
for (ClassPath.ClassInfo classInfo : classPath
|
||||
.getTopLevelClassesRecursive("thaumic.tinkerer.common.item")) {
|
||||
if (ITTinkererItem.class.isAssignableFrom(classInfo.load())
|
||||
&& !ItemBlock.class.isAssignableFrom(classInfo.load())
|
||||
&& !Modifier.isAbstract(classInfo.load().getModifiers())) {
|
||||
itemClasses.add(classInfo.load());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void registerResearch(ITTinkererRegisterable nextItem) {
|
||||
IRegisterableResearch registerableResearch = nextItem.getResearchItem();
|
||||
if (registerableResearch != null) {
|
||||
registerableResearch.registerResearch();
|
||||
}
|
||||
}
|
||||
|
||||
public void registerRecipe(ITTinkererRegisterable nextItem) {
|
||||
ThaumicTinkererRecipe thaumicTinkererRecipe = nextItem.getRecipeItem();
|
||||
if (thaumicTinkererRecipe != null) {
|
||||
thaumicTinkererRecipe.registerRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>THIS NO LONGER USES REFLECTION. IF YOU WANT TO ADD A BLOCK/ITEM, ADD THE CLASS HERE.</strong>
|
||||
*/
|
||||
public void preInit() {
|
||||
dynamismTablet = loadSimpleBlock(new thaumic.tinkerer.common.block.BlockAnimationTablet());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockAspectAnalyzer());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockEnchanter());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockForcefield());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockFunnel());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockGaseousLight());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockGaseousShadow());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockGolemConnector());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockInfusedFarmland());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockInfusedGrain());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockMagnet());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockNitorGas());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockPlatform());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockRepairer());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockRPlacer());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockSummon());
|
||||
loadMetaBlock(new thaumic.tinkerer.common.block.BlockTravelSlab());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.BlockTravelStairs());
|
||||
loadMetaBlock(new thaumic.tinkerer.common.block.BlockWardSlab());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.fire.BlockFireAir());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.fire.BlockFireChaos());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.fire.BlockFireEarth());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.fire.BlockFireIgnis());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.fire.BlockFireOrder());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.fire.BlockFireWater());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.kami.BlockBedrockPortal());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.kami.BlockWarpGate());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.mobilizer.BlockMobilizer());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.mobilizer.BlockMobilizerRelay());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.quartz.BlockDarkQuartz());
|
||||
loadMetaBlock(new thaumic.tinkerer.common.block.quartz.BlockDarkQuartzSlab());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.quartz.BlockDarkQuartzStairs());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.transvector.BlockTransvectorDislocator());
|
||||
loadSimpleBlock(new thaumic.tinkerer.common.block.transvector.BlockTransvectorInterface());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusDeflect());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusDislocation());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusEnderChest());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusFlight());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusHeal());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusSmelt());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.foci.ItemFocusTelekinesis());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemBloodSword());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemBrightNitor());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemCleansingTalisman());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemConnector());
|
||||
loadMetaItem(new thaumic.tinkerer.common.item.ItemGas());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemGasRemover());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemInfusedGrain());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemInfusedInkwell());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemInfusedPotion());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemInfusedSeeds());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemMobAspect());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemMobDisplay());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemRevealingHelm());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemShareBook());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemSoulMould());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemSpellCloth());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.ItemXPTalisman());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.armor.ItemGemBoots());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.armor.ItemGemChest());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.armor.ItemGemHelm());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.armor.ItemGemLegs());
|
||||
loadMetaItem(new thaumic.tinkerer.common.item.kami.armor.ItemIchorclothArmor());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.foci.ItemFocusRecall());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.foci.ItemFocusShadowbeam());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.foci.ItemFocusXPDrain());
|
||||
itemBlackHoleTalisman = loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemBlockTalisman());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemCatAmulet());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemIchorPouch());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemKamiResource());
|
||||
itemPlacementMirror = loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemPlacementMirror());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemProtoclay());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.ItemSkyPearl());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorAxe());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorAxeAdv());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorPick());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorPickAdv());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorShovel());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorShovelAdv());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorSword());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorSwordAdv());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.quartz.ItemDarkQuartz());
|
||||
registerClasses();
|
||||
for (Class clazz : blockClasses) {
|
||||
try {
|
||||
Block newBlock = (Block) clazz.newInstance();
|
||||
if (((ITTinkererBlock) newBlock).shouldRegister()) {
|
||||
newBlock.setBlockName(((ITTinkererBlock) newBlock).getBlockName());
|
||||
ArrayList<Block> blockList = new ArrayList<>();
|
||||
blockList.add(newBlock);
|
||||
|
||||
if (newBlock == null) {
|
||||
ThaumicTinkerer.log.debug(clazz.getName() + " Returned a null block upon registration");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((ITTinkererBlock) newBlock).getSpecialParameters() != null) {
|
||||
for (Object param : ((ITTinkererBlock) newBlock).getSpecialParameters()) {
|
||||
|
||||
for (Constructor constructor : clazz.getConstructors()) {
|
||||
if (constructor.getParameterTypes().length > 0
|
||||
&& constructor.getParameterTypes()[0].isAssignableFrom(param.getClass())) {
|
||||
Block nextBlock = (Block) clazz.getConstructor(param.getClass()).newInstance(param);
|
||||
nextBlock.setBlockName(((ITTinkererBlock) nextBlock).getBlockName());
|
||||
blockList.add(nextBlock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
blockRegistry.put(clazz, blockList);
|
||||
|
||||
if (((ITTinkererBlock) newBlock).getItemBlock() != null) {
|
||||
Item newItem = ((ITTinkererBlock) newBlock).getItemBlock().getConstructor(Block.class)
|
||||
.newInstance(newBlock);
|
||||
newItem.setUnlocalizedName(((ITTinkererItem) newItem).getItemName());
|
||||
ArrayList<Item> itemList = new ArrayList<>();
|
||||
itemList.add(newItem);
|
||||
itemRegistry.put(((ITTinkererBlock) newBlock).getItemBlock(), itemList);
|
||||
}
|
||||
}
|
||||
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException
|
||||
| IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for (Class clazz : itemClasses) {
|
||||
try {
|
||||
Item newItem = (Item) clazz.newInstance();
|
||||
if (((ITTinkererItem) newItem).shouldRegister()) {
|
||||
newItem.setUnlocalizedName(((ITTinkererItem) newItem).getItemName());
|
||||
ArrayList<Item> itemList = new ArrayList<>();
|
||||
itemList.add(newItem);
|
||||
if (newItem == null) {
|
||||
ThaumicTinkerer.log.debug(clazz.getName() + " Returned a null item upon registration");
|
||||
continue;
|
||||
}
|
||||
if (((ITTinkererItem) newItem).getSpecialParameters() != null) {
|
||||
for (Object param : ((ITTinkererItem) newItem).getSpecialParameters()) {
|
||||
for (Constructor constructor : clazz.getConstructors()) {
|
||||
if (constructor.getParameterTypes().length > 0
|
||||
&& constructor.getParameterTypes()[0].isAssignableFrom(param.getClass())) {
|
||||
Item nextItem = (Item) constructor.newInstance(param);
|
||||
nextItem.setUnlocalizedName(((ITTinkererItem) nextItem).getItemName());
|
||||
itemList.add(nextItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemRegistry.put(clazz, itemList);
|
||||
}
|
||||
} catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for (ArrayList<Block> blockArrayList : blockRegistry.values()) {
|
||||
for (Block block : blockArrayList) {
|
||||
if (((ITTinkererBlock) block).getItemBlock() != null) {
|
||||
GameRegistry.registerBlock(
|
||||
block,
|
||||
((ITTinkererBlock) block).getItemBlock(),
|
||||
((ITTinkererBlock) block).getBlockName());
|
||||
} else {
|
||||
GameRegistry.registerBlock(block, ((ITTinkererBlock) block).getBlockName());
|
||||
}
|
||||
if (((ITTinkererBlock) block).getTileEntity() != null) {
|
||||
GameRegistry.registerTileEntity(
|
||||
((ITTinkererBlock) block).getTileEntity(),
|
||||
LibResources.PREFIX_MOD + ((ITTinkererBlock) block).getBlockName());
|
||||
}
|
||||
if (block instanceof IMultiTileEntityBlock) {
|
||||
for (Map.Entry<Class<? extends TileEntity>, String> tile : ((IMultiTileEntityBlock) block)
|
||||
.getAdditionalTileEntities().entrySet()) {
|
||||
GameRegistry.registerTileEntity(tile.getKey(), tile.getValue());
|
||||
}
|
||||
}
|
||||
if (((ITTinkererBlock) block).shouldDisplayInTab()
|
||||
&& FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
ModCreativeTab.INSTANCE.addBlock(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Item> getItemFromClass(Class clazz) {
|
||||
return itemRegistry.get(clazz);
|
||||
}
|
||||
|
||||
public Item getFirstItemFromClass(Class clazz) {
|
||||
return itemRegistry.get(clazz) != null ? itemRegistry.get(clazz).get(0) : null;
|
||||
}
|
||||
|
||||
public Item getItemFromClassAndName(Class clazz, String s) {
|
||||
if (itemRegistry.get(clazz) == null) {
|
||||
return null;
|
||||
}
|
||||
for (Item i : getItemFromClass(clazz)) {
|
||||
if (((ITTinkererItem) i).getItemName().equals(s)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Block getBlockFromClassAndName(Class clazz, String s) {
|
||||
if (blockRegistry.get(clazz) == null) {
|
||||
return null;
|
||||
}
|
||||
for (Block i : getBlockFromClass(clazz)) {
|
||||
if (((ITTinkererBlock) i).getBlockName().equals(s)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<Block> getBlockFromClass(Class clazz) {
|
||||
return blockRegistry.get(clazz);
|
||||
}
|
||||
|
||||
public Block getFirstBlockFromClass(Class clazz) {
|
||||
return blockRegistry.get(clazz) != null ? blockRegistry.get(clazz).get(0) : null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (Item[] itemArrayList : itemRegistry.values()) {
|
||||
|
||||
for (ArrayList<Item> itemArrayList : itemRegistry.values()) {
|
||||
for (Item item : itemArrayList) {
|
||||
registerRecipe((ITTinkererRegisterable) item);
|
||||
}
|
||||
}
|
||||
|
||||
for (ArrayList<Block> blockArrayList : blockRegistry.values()) {
|
||||
for (Block block : blockArrayList) {
|
||||
registerRecipe((ITTinkererRegisterable) block);
|
||||
}
|
||||
}
|
||||
for (ArrayList<Item> itemArrayList : itemRegistry.values()) {
|
||||
for (Item item : itemArrayList) {
|
||||
if (!(item instanceof ItemBlock)) {
|
||||
GameRegistry.registerItem(item, ((ITTinkererItem) item).getItemName());
|
||||
|
||||
@@ -131,222 +238,16 @@ public class TTRegistry {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Block[] blockArrayList : blockRegistry.values()) {
|
||||
for (Block block : blockArrayList) {
|
||||
registerRecipe((ITTinkererRegisterable) block);
|
||||
}
|
||||
}
|
||||
ModCreativeTab.INSTANCE.addAllItemsAndBlocks();
|
||||
}
|
||||
|
||||
private void registerResearch(ITTinkererRegisterable nextItem) {
|
||||
IRegisterableResearch registerableResearch = nextItem.getResearchItem();
|
||||
if (registerableResearch != null) {
|
||||
registerableResearch.registerResearch();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerRecipe(ITTinkererRegisterable nextItem) {
|
||||
ThaumicTinkererRecipe thaumicTinkererRecipe = nextItem.getRecipeItem();
|
||||
if (thaumicTinkererRecipe != null) {
|
||||
thaumicTinkererRecipe.registerRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
private Block loadSimpleBlock(Block newBlock) {
|
||||
try {
|
||||
final ITTinkererBlock ittBlock = (ITTinkererBlock) newBlock;
|
||||
if (ittBlock.shouldRegister()) {
|
||||
newBlock.setBlockName(ittBlock.getBlockName());
|
||||
blockRegistry.put(newBlock.getClass(), new Block[] { newBlock });
|
||||
registerBlock(newBlock, ittBlock);
|
||||
|
||||
Class<? extends ItemBlock> itemBlock = ittBlock.getItemBlock();
|
||||
if (itemBlock != null) {
|
||||
Item newItem = itemBlock.getConstructor(Block.class).newInstance(newBlock);
|
||||
newItem.setUnlocalizedName(((ITTinkererItem) newItem).getItemName());
|
||||
itemRegistry.put(itemBlock, new Item[] { newItem });
|
||||
}
|
||||
return newBlock;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FMLLog.log(
|
||||
Level.WARN,
|
||||
"Failed to load Block " + newBlock.getClass().getSimpleName() + ". This shouldn't happen!");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Block[] loadMetaBlock(Block newBlock) {
|
||||
try {
|
||||
final ITTinkererBlock ittBlock = (ITTinkererBlock) newBlock;
|
||||
if (ittBlock.shouldRegister()) {
|
||||
newBlock.setBlockName(ittBlock.getBlockName());
|
||||
|
||||
Block[] metaBlocks = ittBlock.getMetaBlocks();
|
||||
|
||||
Block[] blockList = new Block[1 + metaBlocks.length];
|
||||
blockRegistry.put(newBlock.getClass(), blockList);
|
||||
blockList[0] = newBlock;
|
||||
|
||||
int index = 1;
|
||||
registerBlock(newBlock, ittBlock);
|
||||
for (Block metaBlock : metaBlocks) {
|
||||
ITTinkererBlock metaIttBlock = (ITTinkererBlock) metaBlock;
|
||||
metaBlock.setBlockName(metaIttBlock.getBlockName());
|
||||
blockList[index++] = metaBlock;
|
||||
registerBlock(metaBlock, metaIttBlock);
|
||||
}
|
||||
|
||||
Class<? extends ItemBlock> itemBlock = ittBlock.getItemBlock();
|
||||
if (itemBlock != null) {
|
||||
Item newItem = itemBlock.getConstructor(Block.class).newInstance(newBlock);
|
||||
newItem.setUnlocalizedName(((ITTinkererItem) newItem).getItemName());
|
||||
itemRegistry.put(itemBlock, new Item[] { newItem });
|
||||
}
|
||||
|
||||
return blockList;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FMLLog.log(
|
||||
Level.WARN,
|
||||
"Failed to load Block " + newBlock.getClass().getSimpleName() + ". This shouldn't happen!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Item loadSimpleItem(Item newItem) {
|
||||
try {
|
||||
final ITTinkererItem ittItem = (ITTinkererItem) newItem;
|
||||
if (ittItem.shouldRegister()) {
|
||||
newItem.setUnlocalizedName(ittItem.getItemName());
|
||||
itemRegistry.put(newItem.getClass(), new Item[] { newItem });
|
||||
|
||||
return newItem;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FMLLog.log(
|
||||
Level.WARN,
|
||||
"Failed to load Item " + newItem.getClass().getSimpleName() + ". This shouldn't happen!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Item[] loadMetaItem(Item newItem) {
|
||||
try {
|
||||
final ITTinkererItem ittItem = (ITTinkererItem) newItem;
|
||||
if (ittItem.shouldRegister()) {
|
||||
newItem.setUnlocalizedName(ittItem.getItemName());
|
||||
|
||||
Item[] metaItems = ittItem.getMetaItems();
|
||||
|
||||
Item[] itemList = new Item[1 + metaItems.length];
|
||||
itemList[0] = newItem;
|
||||
|
||||
int index = 1;
|
||||
for (Item metaItem : metaItems) {
|
||||
metaItem.setUnlocalizedName(((ITTinkererItem) metaItem).getItemName());
|
||||
itemList[index++] = metaItem;
|
||||
}
|
||||
itemRegistry.put(newItem.getClass(), itemList);
|
||||
return itemList;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
FMLLog.log(
|
||||
Level.WARN,
|
||||
"Failed to load Item " + newItem.getClass().getSimpleName() + ". This shouldn't happen!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void registerBlock(Block block, ITTinkererBlock ittBlock) {
|
||||
String blockName = ittBlock.getBlockName();
|
||||
Class<? extends ItemBlock> itemBlock = ittBlock.getItemBlock();
|
||||
if (itemBlock != null) {
|
||||
GameRegistry.registerBlock(block, itemBlock, blockName);
|
||||
} else {
|
||||
GameRegistry.registerBlock(block, blockName);
|
||||
}
|
||||
Class<? extends TileEntity> tileEntity = ittBlock.getTileEntity();
|
||||
if (tileEntity != null) {
|
||||
GameRegistry.registerTileEntity(tileEntity, LibResources.PREFIX_MOD + blockName);
|
||||
}
|
||||
if (block instanceof IMultiTileEntityBlock) {
|
||||
for (Map.Entry<Class<? extends TileEntity>, String> tile : ((IMultiTileEntityBlock) block)
|
||||
.getAdditionalTileEntities().entrySet()) {
|
||||
GameRegistry.registerTileEntity(tile.getKey(), tile.getValue());
|
||||
}
|
||||
}
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
if (ittBlock.shouldDisplayInTab()) {
|
||||
ModCreativeTab.INSTANCE.addBlock(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Item[] getItemArrayFromClass(Class clazz) {
|
||||
return itemRegistry.get(clazz);
|
||||
}
|
||||
|
||||
public Item getItemFromClass(Class clazz, int index) {
|
||||
return itemRegistry.get(clazz)[index];
|
||||
}
|
||||
|
||||
public Item getFirstItemFromClass(Class clazz) {
|
||||
final Item[] items = itemRegistry.get(clazz);
|
||||
return items != null ? items[0] : null;
|
||||
}
|
||||
|
||||
public Item getItemFromClassAndName(Class clazz, String s) {
|
||||
final Item[] itemsFromClass = itemRegistry.get(clazz);
|
||||
if (itemsFromClass != null) {
|
||||
for (Item i : itemsFromClass) {
|
||||
if (((ITTinkererItem) i).getItemName().equals(s)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Block getBlockFromClassAndName(Class clazz, String s) {
|
||||
final Block[] blocksFromClass = blockRegistry.get(clazz);
|
||||
if (blocksFromClass != null) {
|
||||
for (Block i : blocksFromClass) {
|
||||
if (((ITTinkererBlock) i).getBlockName().equals(s)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Block[] getBlockArrayFromClass(Class clazz) {
|
||||
return blockRegistry.get(clazz);
|
||||
}
|
||||
|
||||
public Block getBlockFromClass(Class clazz, int index) {
|
||||
return blockRegistry.get(clazz)[index];
|
||||
}
|
||||
|
||||
public Block getFirstBlockFromClass(Class clazz) {
|
||||
final Block[] blocks = blockRegistry.get(clazz);
|
||||
return blocks != null ? blocks[0] : null;
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
for (Item[] itemArrayList : itemRegistry.values()) {
|
||||
for (ArrayList<Item> itemArrayList : itemRegistry.values()) {
|
||||
for (Item item : itemArrayList) {
|
||||
registerResearch((ITTinkererRegisterable) item);
|
||||
}
|
||||
}
|
||||
for (Block[] blockArrayList : blockRegistry.values()) {
|
||||
for (ArrayList<Block> blockArrayList : blockRegistry.values()) {
|
||||
for (Block block : blockArrayList) {
|
||||
registerResearch((ITTinkererRegisterable) block);
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package thaumic.tinkerer.mixins.early;
|
||||
|
||||
import net.minecraft.server.management.ItemInWorldManager;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(ItemInWorldManager.class)
|
||||
public interface AccessorItemInWorldManager {
|
||||
|
||||
@Accessor
|
||||
int getDurabilityRemainingOnBlock();
|
||||
}
|
||||
@@ -99,8 +99,8 @@ public class ThaumicTLoaderContainer extends DummyModContainer implements IFMLLo
|
||||
@Override
|
||||
public List<String> getMixins(Set<String> loadedCoreMods) {
|
||||
if (!FMLLaunchHandler.side().isClient()) {
|
||||
return Collections.singletonList("AccessorItemInWorldManager");
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Arrays.asList("renderer.MixinRenderBlocks", "AccessorItemInWorldManager");
|
||||
return Collections.singletonList("renderer.MixinRenderBlocks");
|
||||
}
|
||||
}
|
||||
@@ -557,7 +557,7 @@ ttresearch.page.ICHOR_SWORD_GEM.1=Soul Hearts are hearts that can only be used o
|
||||
# -- BOTTOMLESS POUCH
|
||||
ttresearch.name.ICHOR_POUCH=Bottomless Pouch
|
||||
ttresearch.lore.ICHOR_POUCH=Try not to tear it
|
||||
ttresearch.page.ICHOR_POUCH.0=By infusing a Focus Pouch with items such as the Portable Hole focus, you’ve enhanced it to store not just foci, but any kind of items with an impressively spacious interior.<BR><BR>This upgraded pouch can hold the contents of more than four chests, all while functioning as a regular Focus Pouch, allowing any foci inside to be equipped to a wand as usual. You can kiss your inventory problems goodbye.
|
||||
ttresearch.page.ICHOR_POUCH.0=By infusing a Focus Pouch with items such as the Portable Hole focus, you managed to allow it to not only store more than Foci, but also to have a very extensive storage space.<BR><BR>This pouch can not only carry more than four chests, but it also doubles as a standard Focus Pouch, allowing any foci within it to be inserted in a wand like normally. You can kiss your inventory problems goodbye.
|
||||
|
||||
# -- BLACK HOLE RING
|
||||
ttresearch.name.BLOCK_TALISMAN=Black Hole Ring
|
||||
|
||||
Reference in new issue
Block a user