mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
964d3391e4 | ||
|
|
92b212d5e0 | ||
|
|
1972b9ab2b | ||
|
|
99e23607f5 | ||
|
|
63423b8913 | ||
|
|
0d3d390e22 | ||
|
|
96ffb23eae | ||
|
|
d5b1802379 | ||
|
|
a4a4af3087 | ||
|
|
c1d71d767e | ||
|
|
ef9221265d | ||
|
|
cedfe231c3 | ||
|
|
f64efe15c8 | ||
|
|
0905f7b806 | ||
|
|
425af1d868 | ||
|
|
3ec494d713 | ||
|
|
744c39aba8 | ||
|
|
f297a522a9 | ||
|
|
7be29e459e | ||
|
|
c8f7742df5 | ||
|
|
bbe1e7f50f | ||
|
|
8ff5a8cf52 | ||
|
|
b9e61335e3 | ||
|
|
0272517b10 | ||
|
|
8782f7c6a7 | ||
|
|
58676ab46d | ||
|
|
2127d30d16 | ||
|
|
5268737e2e | ||
|
|
c075644243 | ||
|
|
e95d6c870c | ||
|
|
6d278db79d | ||
|
|
4f2618d03b | ||
|
|
c2cbc66645 | ||
|
|
df4a8cfca9 | ||
|
|
00e831c20f | ||
|
|
7fbffb3aa7 | ||
|
|
7b02309128 | ||
|
|
c9be818502 | ||
|
|
3e96d49fef | ||
|
|
64d179543c | ||
|
|
e1d8a847a9 | ||
|
|
38fb7fc71f | ||
|
|
6479b0b635 | ||
|
|
5b388b5cba | ||
|
|
3cc1026704 | ||
|
|
2a548be7d8 | ||
|
|
dce00bbc74 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,5 +0,0 @@
|
||||
//version: 1707058017
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhconvention")
|
||||
}
|
||||
+19
-16
@@ -1,25 +1,28 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.6-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-586-GTNH:api')
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-882-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.8:dev') {transitive=false}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.12.6-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.7.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.4:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.13.21-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.1:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.13-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.16-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.5.12:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.22:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.22:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.46-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.22-GTNH:api') {transitive=false}
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.256:dev") {transitive=false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.399:dev") {exclude group: 'com.github.GTNewHorizons', module: 'ThaumicTinkerer'}
|
||||
compileOnly('curse.maven:computercraft-67504:2269339')
|
||||
compileOnly('curse.maven:cofh-core-69162:2388751')
|
||||
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.4.8:dev') {
|
||||
exclude module: 'Baubles'
|
||||
}
|
||||
// For testing purposes
|
||||
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.20:dev")
|
||||
|
||||
runtimeOnly(rfg.deobf('curse.maven:thaumcraft-nei-plugin-225095:2241913'))
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.13:dev')
|
||||
}
|
||||
+38
-6
@@ -39,13 +39,37 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
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 = false
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# 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
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# 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 = false
|
||||
enableGenericInjection = true
|
||||
|
||||
# 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.
|
||||
@@ -96,7 +120,9 @@ usesMixinDebug = true
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
# 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.
|
||||
mixinsPackage = mixins
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
@@ -151,7 +177,7 @@ modrinthProjectId =
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
@@ -172,6 +198,12 @@ 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.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
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-8.13-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 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.
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -114,7 +114,6 @@ 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.
|
||||
@@ -172,7 +171,6 @@ 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" )
|
||||
|
||||
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ 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%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
// 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 "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
name = "GTNH Maven"
|
||||
url = uri("https://nexus.gtnewhorizons.com/repository/public/")
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.24"
|
||||
}
|
||||
|
||||
|
||||
+19
-29
@@ -8,7 +8,6 @@ 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;
|
||||
@@ -17,63 +16,54 @@ 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 {
|
||||
|
||||
RenderBlocks blockRender = new RenderBlocks();
|
||||
private final RenderBlocks blockRender;
|
||||
|
||||
public PlacementMirrorPredictionRenderer() {
|
||||
this.blockRender = new RenderBlocks();
|
||||
blockRender.useInventoryTint = false;
|
||||
}
|
||||
|
||||
@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()
|
||||
== ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class)
|
||||
&& ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
|
||||
if (currentStack != null && currentStack.getItem() == TTRegistry.itemPlacementMirror) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
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();
|
||||
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())) {
|
||||
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(block, coord, lastCoords);
|
||||
lastCoords = coord;
|
||||
renderBlockAt(requiredBlock, requiredMetadata, coord);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
|
||||
if (block.getItem() == null) return;
|
||||
private void renderBlockAt(Block block, int metadata, ChunkCoordinates pos) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(
|
||||
pos.posX + 0.5 - RenderManager.renderPosX,
|
||||
pos.posY + 0.5 - RenderManager.renderPosY,
|
||||
pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
|
||||
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);
|
||||
|
||||
blockRender.renderBlockAsItem(block, metadata, 1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumic.tinkerer.client.core.handler.ClientTickHandler;
|
||||
@@ -64,8 +66,11 @@ import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
import thaumic.tinkerer.common.item.kami.foci.ItemFocusShadowbeam;
|
||||
import thaumic.tinkerer.common.potion.PotionEffectHandlerClient;
|
||||
|
||||
public class TTClientProxy extends TTCommonProxy {
|
||||
public final class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
private PotionEffectHandlerClient potionHandlerClient;
|
||||
|
||||
public static EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
@@ -74,18 +79,21 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
if (Loader.isModLoaded("ComputerCraft")) {
|
||||
MinecraftForge.EVENT_BUS.register(new FumeTool());
|
||||
}
|
||||
|
||||
if (ConfigHandler.enableKami)
|
||||
if (ConfigHandler.enableKami) {
|
||||
// kamiRarity = EnumHelperClient.addRarity("KAMI", 0x6, "Kami");
|
||||
|
||||
kamiRarity = EnumHelperClient.addEnum(
|
||||
new Class[][] { { EnumRarity.class, EnumChatFormatting.class, String.class } },
|
||||
EnumRarity.class,
|
||||
"KAMI",
|
||||
EnumChatFormatting.LIGHT_PURPLE,
|
||||
"Kami");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,6 +116,22 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
|
||||
this.potionHandlerClient = new PotionEffectHandlerClient();
|
||||
MinecraftForge.EVENT_BUS.register(potionHandlerClient);
|
||||
FMLCommonHandler.instance().bus().register(potionHandlerClient);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
|
||||
if (this.potionHandlerClient != null) {
|
||||
MinecraftForge.EVENT_BUS.unregister(potionHandlerClient);
|
||||
FMLCommonHandler.instance().bus().unregister(potionHandlerClient);
|
||||
this.potionHandlerClient = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void registerTiles() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAnimationTablet.class, new RenderTileAnimationTablet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMagnet.class, new RenderTileMagnet());
|
||||
|
||||
@@ -38,7 +38,6 @@ 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) {
|
||||
@@ -51,25 +50,26 @@ 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) {
|
||||
buttonListAT.add(button);
|
||||
buttonList.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 buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
|
||||
else {
|
||||
button0.buttonEnabled = !button0.buttonEnabled;
|
||||
}
|
||||
|
||||
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
|
||||
tablet.redstone = buttonListAT.get(0).buttonEnabled;
|
||||
tablet.leftClick = ((GuiButtonAT) buttonList.get(1)).buttonEnabled;
|
||||
tablet.redstone = button0.buttonEnabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ 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) {
|
||||
@@ -55,23 +54,21 @@ 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) {
|
||||
buttonListMM.add(button);
|
||||
buttonList.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
else buttonList.get(0).enabled = !buttonList.get(0).enabled;
|
||||
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
mobMagnet.adult = buttonList.get(0).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
|
||||
int x, y;
|
||||
List<IRadioButton> radioButtons = new ArrayList<>();
|
||||
List<GuiButtonRP> buttonListRP = new ArrayList<>();
|
||||
TileRPlacer placer;
|
||||
Aspect aspectHovered = null;
|
||||
|
||||
@@ -43,23 +42,24 @@ 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) {
|
||||
buttonListRP.add(button);
|
||||
buttonList.add(button);
|
||||
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListRP.get(0).buttonEnabled = !buttonListRP.get(0).buttonEnabled;
|
||||
if (par1GuiButton instanceof IRadioButton iRadioButton) iRadioButton.enableFromClick();
|
||||
else {
|
||||
var button0 = (GuiButtonRP) buttonList.get(0);
|
||||
button0.buttonEnabled = !button0.buttonEnabled;
|
||||
}
|
||||
|
||||
placer.blocks = par1GuiButton.id + 1;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ 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;
|
||||
@@ -34,15 +35,14 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
|
||||
float b = (aspect.getColor() & 0xFF) / 255.0F;
|
||||
|
||||
GL11.glColor4f(r, g, b, 1F);
|
||||
Tessellator.instance.setColorRGBA_I(aspect.getColor(), 255);
|
||||
tess.setColorRGBA_I(aspect.getColor(), 255);
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture(block.getIcon(world, x, y, z, world.getBlockMetadata(x, y, z)));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tess.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
renderer.renderBlockCropsImpl(block, world.getBlockMetadata(x, y, z), x, y - 0.0625F, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
// Tessellator.instance.setColorOpaque_I(0xFFFFFF);
|
||||
// tess.setColorOpaque_I(0xFFFFFF);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
@@ -19,8 +18,6 @@ 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,7 +2,6 @@ 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;
|
||||
@@ -16,8 +15,6 @@ 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,9 +1,7 @@
|
||||
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;
|
||||
@@ -15,9 +13,6 @@ 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;
|
||||
@@ -69,6 +64,7 @@ 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);
|
||||
@@ -77,6 +73,7 @@ public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -47,12 +47,18 @@ 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);
|
||||
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.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);
|
||||
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.1, 0.2 + Math.cos(System.currentTimeMillis() / 600D) / 18F, 0.5);
|
||||
@@ -60,9 +66,10 @@ 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);
|
||||
GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
|
||||
float swingProgress = tile.getRenderSwingProgress(partialTicks);
|
||||
GL11.glRotatef(swingProgress, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
GL11.glTranslatef(-tile.swingProgress / 250F, tile.swingProgress / 1000F, 0F);
|
||||
GL11.glTranslatef(-swingProgress / 250F, swingProgress / 1000F, 0F);
|
||||
GL11.glRotatef((float) Math.cos(System.currentTimeMillis() / 400F) * 5F, 1F, 0F, 1F);
|
||||
renderItem(tile);
|
||||
GL11.glPopMatrix();
|
||||
@@ -72,6 +79,8 @@ 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();
|
||||
@@ -81,25 +90,24 @@ 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 useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useBlend,
|
||||
double size, float height, float partialTicks) {
|
||||
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 = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
float deg = (tablet.getTicksExisted(partialTicks) * 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;
|
||||
@@ -109,8 +117,33 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glDepthMask(true);
|
||||
if (!useLighting) GL11.glEnable(GL11.GL_LIGHTING);
|
||||
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.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,6 @@ package thaumic.tinkerer.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -31,14 +28,12 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import thaumcraft.common.CommonProxy;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumic.tinkerer.api.InterModCommsOperations;
|
||||
import thaumic.tinkerer.common.core.commands.KamiUnlockedCommand;
|
||||
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
|
||||
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import thaumic.tinkerer.common.dim.WorldProviderBedrock;
|
||||
@@ -56,6 +51,10 @@ public class ThaumicTinkerer {
|
||||
@SidedProxy(clientSide = LibMisc.CLIENT_PROXY, serverSide = LibMisc.COMMON_PROXY)
|
||||
public static TTCommonProxy proxy;
|
||||
|
||||
public static boolean isBootsActive = false;
|
||||
public static boolean gtLoaded;
|
||||
public static final String BOOTS = "thaumicboots";
|
||||
|
||||
public static CommonProxy tcProxy;
|
||||
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
|
||||
|
||||
@@ -74,16 +73,34 @@ public class ThaumicTinkerer {
|
||||
"register",
|
||||
"thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
|
||||
}
|
||||
if (Loader.isModLoaded(BOOTS)) {
|
||||
isBootsActive = true;
|
||||
}
|
||||
gtLoaded = Loader.isModLoaded("gregtech");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
proxy.serverStarting(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
proxy.serverStopped(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -103,18 +120,4 @@ public class ThaumicTinkerer {
|
||||
public void blackListCCDevices(String classname) {
|
||||
PeripheralHandler.Blacklist.add(classname);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -44,6 +43,7 @@ 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,37 +98,32 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tablet != null) {
|
||||
if (tablet.getIsBreaking()) {}
|
||||
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;
|
||||
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
|
||||
.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (k1 > itemstack.stackSize) k1 = itemstack.stackSize;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
|
||||
.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
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 (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());
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +137,8 @@ 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);
|
||||
@@ -149,9 +146,10 @@ 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
|
||||
@@ -159,37 +157,17 @@ 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 != null) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (tile instanceof TileAnimationTablet tablet) {
|
||||
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.swingProgress == 0) {
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.isIdle()) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F);
|
||||
} else par5EntityPlayer
|
||||
@@ -229,11 +207,6 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return new TileAnimationTablet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ANIMATION_TABLET;
|
||||
@@ -268,10 +241,9 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
-8,
|
||||
2,
|
||||
4,
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class))).setWarp(1)
|
||||
.setParents(LibResearch.KEY_MAGNETS).setPages(
|
||||
new ResearchPage("0"),
|
||||
ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
new ItemStack(TTRegistry.dynamismTablet)).setWarp(1).setParents(LibResearch.KEY_MAGNETS).setPages(
|
||||
new ResearchPage("0"),
|
||||
ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -279,7 +251,7 @@ public class BlockAnimationTablet extends BlockModContainer {
|
||||
return new ThaumicTinkererArcaneRecipe(
|
||||
LibResearch.KEY_ANIMATION_TABLET,
|
||||
LibResearch.KEY_ANIMATION_TABLET,
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class)),
|
||||
new ItemStack(TTRegistry.dynamismTablet),
|
||||
new AspectList().add(Aspect.AIR, 25).add(Aspect.ORDER, 15).add(Aspect.FIRE, 10),
|
||||
"GIG",
|
||||
"ICI",
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -135,11 +134,6 @@ public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
return new TileAspectAnalyzer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -153,11 +152,6 @@ public class BlockEnchanter extends BlockModContainer {
|
||||
return new TileEnchanter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -179,11 +178,6 @@ public class BlockFunnel extends BlockModContainer {
|
||||
return new TileFunnel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
|
||||
@@ -136,11 +136,6 @@ public abstract class BlockGas extends BlockMod implements ITTinkererBlock {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
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;
|
||||
@@ -48,11 +46,6 @@ public class BlockGolemConnector extends BlockCamo {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GOLEMCONNECTOR;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
@@ -53,11 +52,6 @@ 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;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -37,7 +38,6 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
|
||||
public static final int BREEDING_CHANCE = 10;
|
||||
private IIcon[][] icons;
|
||||
private TileInfusedGrain tileEntity;
|
||||
|
||||
// Returns 0-5 for primal aspects, or 6 if compound aspect
|
||||
public static int getNumberFromAspectForTexture(Aspect aspect) {
|
||||
@@ -116,10 +116,6 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileInfusedGrain) {
|
||||
tileEntity = (TileInfusedGrain) tile;
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
}
|
||||
|
||||
@@ -130,11 +126,11 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
Random rand = new Random();
|
||||
int count = 1;
|
||||
for (int i = 0; i < count; i++) {
|
||||
TileInfusedGrain tileGrain = getTileEntitySafe(world, x, y, z);
|
||||
TileEntity tileGrain = world.getTileEntity(x, y, z);
|
||||
ItemStack seedStack = new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class));
|
||||
ItemInfusedSeeds.setAspect(seedStack, getAspectDropped(world, x, y, z, metadata));
|
||||
if (tileGrain != null) {
|
||||
ItemInfusedSeeds.setAspectTendencies(seedStack, tileGrain.primalTendencies);
|
||||
ItemInfusedSeeds.setAspectTendencies(seedStack, ((TileInfusedGrain) tileGrain).primalTendencies);
|
||||
}
|
||||
while (rand.nextInt(10000) < Math.pow(getPrimalTendencyCount(world, x, y, z, Aspect.ENTROPY), 2)) {
|
||||
seedStack.stackSize++;
|
||||
@@ -144,27 +140,42 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
Aspect aspect = getAspectSafe(world, x, y, z);
|
||||
Aspect aspect = getAspect(world, x, y, z);
|
||||
ItemStack retItem = AspectCropLootManager.getLootForAspect(aspect);
|
||||
if (retItem != null) ret.add(retItem);
|
||||
|
||||
} while (world.rand.nextInt(75) < getPrimalTendencyCount(world, x, y, z, Aspect.ORDER));
|
||||
}
|
||||
tileEntity = null;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
if (willHarvest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
super.harvestBlock(world, player, x, y, z, meta);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
public int getPrimalTendencyCount(World world, int x, int y, int z, Aspect aspect) {
|
||||
TileInfusedGrain tileGrain = getTileEntitySafe(world, x, y, z);
|
||||
return tileGrain != null ? tileGrain.primalTendencies.getAmount(aspect) : 0;
|
||||
TileEntity tileGrain = world.getTileEntity(x, y, z);
|
||||
return tileGrain instanceof TileInfusedGrain ? ((TileInfusedGrain) tileGrain).primalTendencies.getAmount(aspect)
|
||||
: 0;
|
||||
}
|
||||
|
||||
private void fertilizeSoil(World world, int x, int y, int z, int metadata) {
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
if (world.getTileEntity(x, y - 1, z) instanceof TileInfusedFarmland) {
|
||||
Aspect currentAspect = getAspectSafe(world, x, y, z);
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList.add(currentAspect, 1);
|
||||
((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).reduceSaturatedAspects();
|
||||
world.markBlockForUpdate(x, y - 1, z);
|
||||
@@ -181,7 +192,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
public Aspect getAspectDropped(World world, int x, int y, int z, int metadata) {
|
||||
Aspect currentAspect = getAspectSafe(world, x, y, z);
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
if (metadata >= 7 && currentAspect != null) {
|
||||
if (world.getTileEntity(x, y - 1, z) instanceof TileInfusedFarmland) {
|
||||
AspectList farmlandAspectList = ((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList;
|
||||
@@ -200,11 +211,6 @@ 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;
|
||||
@@ -250,31 +256,4 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return null;
|
||||
}
|
||||
|
||||
private TileInfusedGrain getTileEntitySafe(World world, int x, int y, int z) {
|
||||
if (tileEntity != null) {
|
||||
return tileEntity;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof TileInfusedGrain) {
|
||||
return (TileInfusedGrain) tile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Aspect getAspectSafe(World world, int x, int y, int z) {
|
||||
if (tileEntity != null) {
|
||||
return tileEntity.aspect;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof TileInfusedGrain) {
|
||||
return ((TileInfusedGrain) tile).aspect;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -191,11 +190,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -42,11 +40,6 @@ public abstract class BlockMod extends Block implements ITTinkererBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -65,11 +64,6 @@ public class BlockPlatform extends BlockCamo {
|
||||
return new TileCamo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PLATFORM;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -83,11 +82,6 @@ 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,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -182,11 +181,6 @@ public class BlockRepairer extends BlockModContainer {
|
||||
return new TileRepairer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -94,11 +93,6 @@ 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,10 +81,8 @@ public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockTravelSlab(true) };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package thaumic.tinkerer.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -32,11 +30,6 @@ 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,10 +88,8 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock, ITileEn
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockWardSlab(true) };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,6 @@ 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;
|
||||
|
||||
@@ -389,11 +388,6 @@ 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,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.kami;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -151,11 +150,6 @@ public class BlockWarpGate extends BlockModContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.quartz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -130,11 +129,6 @@ 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,10 +83,8 @@ public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
public Block[] getMetaBlocks() {
|
||||
return new Block[] { new BlockDarkQuartzSlab(true) };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -35,11 +33,6 @@ 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;
|
||||
|
||||
@@ -65,11 +65,13 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
if (partnerX - xCoord != 0) {
|
||||
xInc = ((float) Math.copySign(.05, partnerX - xCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (0.5 + i + xInc),
|
||||
(float) (yCoord + 0.5),
|
||||
(float) (j + 0.5 + zInc),
|
||||
xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (0.5 + i + xInc),
|
||||
(float) (yCoord + 0.5),
|
||||
(float) (j + 0.5 + zInc),
|
||||
xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
}
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
|
||||
@@ -17,7 +17,8 @@ public class TileForcefield extends TileEntity {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
ticks--;
|
||||
|
||||
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,9 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
|
||||
|
||||
if (distanceSqrd > 1) {
|
||||
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
if (worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
public class TileRepairer extends TileEntity
|
||||
implements ISidedInventory, IAspectContainer, IEssentiaTransport, IMovableTile {
|
||||
|
||||
private static final String TAG_TOOK_LAST_TICK = "tookLastTick";
|
||||
private static final Map<Aspect, Integer> repairValues = new HashMap<>();
|
||||
|
||||
static {
|
||||
@@ -53,12 +54,25 @@ public class TileRepairer extends TileEntity
|
||||
|
||||
public int ticksExisted = 0;
|
||||
public boolean tookLastTick = true;
|
||||
int dmgLastTick = 0;
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (++ticksExisted % 10 == 0) {
|
||||
if (worldObj.isRemote) {
|
||||
if (tookLastTick) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (xCoord + 0.25 + Math.random() / 2F),
|
||||
(float) (yCoord + 1 + Math.random() / 2F),
|
||||
(float) (zCoord + 0.25 + Math.random() / 2F),
|
||||
0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean oldTookLastTick = tookLastTick;
|
||||
tookLastTick = false;
|
||||
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (inventorySlots[0] != null) {
|
||||
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
|
||||
@@ -66,18 +80,11 @@ public class TileRepairer extends TileEntity
|
||||
if (dmg > 0) {
|
||||
int essentia = drawEssentia();
|
||||
TinkersConstructCompat.fixDamage(inventorySlots[0], essentia);
|
||||
int newDmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
tookLastTick = newDmg != dmg;
|
||||
markDirty();
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (xCoord + 0.25 + Math.random() / 2F),
|
||||
(float) (yCoord + 1 + Math.random() / 2F),
|
||||
(float) (zCoord + 0.25 + Math.random() / 2F),
|
||||
0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
dmgLastTick = inventorySlots[0] == null ? 0
|
||||
: TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
}
|
||||
if (tookLastTick != oldTookLastTick) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -85,20 +92,12 @@ public class TileRepairer extends TileEntity
|
||||
if (inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
|
||||
int essentia = drawEssentia();
|
||||
int dmg = inventorySlots[0].getItemDamage();
|
||||
inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia));
|
||||
int newDmg = Math.max(0, dmg - essentia);
|
||||
inventorySlots[0].setItemDamage(newDmg);
|
||||
tookLastTick = newDmg != dmg;
|
||||
markDirty();
|
||||
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (xCoord + 0.25 + Math.random() / 2F),
|
||||
(float) (yCoord + 1 + Math.random() / 2F),
|
||||
(float) (zCoord + 0.25 + Math.random() / 2F),
|
||||
0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : inventorySlots[0].getItemDamage();
|
||||
}
|
||||
if (tookLastTick != oldTookLastTick) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +116,7 @@ public class TileRepairer extends TileEntity
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
tookLastTick = par1NBTTagCompound.getBoolean(TAG_TOOK_LAST_TICK);
|
||||
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[1];
|
||||
|
||||
@@ -127,6 +127,7 @@ public class TileRepairer extends TileEntity
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_TOOK_LAST_TICK, tookLastTick);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if (inventorySlots[0] != null) {
|
||||
NBTTagCompound tagList = new NBTTagCompound();
|
||||
|
||||
@@ -51,22 +51,23 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
if (!destGate.locked) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
|
||||
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
|
||||
if (player.worldObj.isRemote) {
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
}
|
||||
player.mountEntity(null);
|
||||
if (player instanceof EntityPlayerMP) ((EntityPlayerMP) player).playerNetServerHandler
|
||||
.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
|
||||
if (player.worldObj.isRemote) {
|
||||
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) player.posY + player.worldObj.rand.nextFloat(),
|
||||
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
|
||||
6);
|
||||
}
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F);
|
||||
return true;
|
||||
} else
|
||||
|
||||
@@ -13,76 +13,180 @@ 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.World;
|
||||
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 com.mojang.authlib.GameProfile;
|
||||
|
||||
import thaumcraft.common.lib.FakeThaumcraftPlayer;
|
||||
public final class TabletFakePlayer extends FakePlayer {
|
||||
|
||||
public class TabletFakePlayer extends FakeThaumcraftPlayer {
|
||||
private final TileAnimationTablet tablet;
|
||||
|
||||
TileAnimationTablet tablet;
|
||||
|
||||
public TabletFakePlayer(TileAnimationTablet tablet) { // ,String name) {
|
||||
public TabletFakePlayer(TileAnimationTablet tablet) {
|
||||
super(
|
||||
tablet.getWorldObj(),
|
||||
(WorldServer) tablet.getWorldObj(),
|
||||
new GameProfile(UUID.fromString("a8f026a0-135b-11e4-9191-0800200c9a66"), "[ThaumcraftTablet]"));
|
||||
// super(tablet.getWorldObj(),"[ThaumcraftTablet]");
|
||||
this.tablet = tablet;
|
||||
}
|
||||
|
||||
@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
|
||||
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 onUpdate() {
|
||||
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;
|
||||
|
||||
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;
|
||||
setHealth(20);
|
||||
isDead = false;
|
||||
|
||||
this.capabilities.isCreativeMode = false;
|
||||
|
||||
int meta = tablet.getBlockMetadata() & 7;
|
||||
int rotation = meta == 2 ? 180 : meta == 3 ? 0 : meta == 4 ? 90 : -90;
|
||||
rotationYaw = rotationYawHead = rotation;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
syncSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChatMessage(IChatComponent var1) {}
|
||||
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 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
|
||||
}
|
||||
}
|
||||
}
|
||||
+416
-397
File diff suppressed because it is too large.
Load diff
-6
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.block.transvector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -134,11 +133,6 @@ public class BlockTransvectorDislocator extends BlockCamo {
|
||||
return new TileTransvectorDislocator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DISLOCATOR;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -49,11 +47,6 @@ public class BlockTransvectorInterface extends BlockCamo {
|
||||
return new TileTransvectorInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.INTERFACE;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class AspectCropLootManager {
|
||||
Random rand = new Random();
|
||||
int randInt = rand.nextInt(sum);
|
||||
for (Map.Entry<ItemStack, Integer> pair : aspectHashmap.entrySet()) {
|
||||
if (randInt <= 0) {
|
||||
if (randInt < pair.getValue()) {
|
||||
return pair.getKey().copy();
|
||||
}
|
||||
randInt -= pair.getValue();
|
||||
@@ -55,15 +55,7 @@ public class AspectCropLootManager {
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, String target) {
|
||||
|
||||
addAspectLoot(aspect, target, 1);
|
||||
for (String ore : OreDictionary.getOreNames()) {
|
||||
if (ore.contains(WordUtils.capitalizeFully(target)) || ore.contains(target)) {
|
||||
for (ItemStack stack : OreDictionary.getOres(ore)) {
|
||||
addAspectLoot(aspect, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAspectLoot(Aspect aspect, String target, int count) {
|
||||
@@ -217,8 +209,7 @@ public class AspectCropLootManager {
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 6));
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Blocks.cake));
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.cake));
|
||||
|
||||
addAspectLoot(Aspect.SENSES, new ItemStack(Items.dye, 20, 4));
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package thaumic.tinkerer.common.core.helper;
|
||||
|
||||
import net.minecraft.block.IGrowable;
|
||||
import static thaumic.tinkerer.common.compat.EMTCompat.EMTLoaded;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
@@ -8,6 +10,7 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -26,26 +29,37 @@ 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) {
|
||||
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 world = event.world;
|
||||
if (world.isRemote) return;
|
||||
if (!(world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain infusedGrain)) return;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
var player = event.entityPlayer;
|
||||
if (player == null) return;
|
||||
|
||||
var hoeOfGrowth = player.getCurrentEquippedItem();
|
||||
if (!isMagicHoe(hoeOfGrowth)) return;
|
||||
|
||||
if (!infusedGrain.func_149851_a(world, event.x, event.y, event.z, false)
|
||||
|| !infusedGrain.func_149852_a(world, world.rand, event.x, event.y, event.z)) {
|
||||
return;
|
||||
}
|
||||
infusedGrain.func_149853_b(world, world.rand, event.x, event.y, event.z);
|
||||
hoeOfGrowth.damageItem(25, player);
|
||||
Thaumcraft.proxy.blockSparkle(world, event.x, event.y, event.z, 0, 2);
|
||||
world.playSoundEffect(
|
||||
event.x + 0.5D,
|
||||
event.y + 0.5D,
|
||||
event.z + 0.5D,
|
||||
"thaumcraft:wand",
|
||||
0.75F,
|
||||
0.9F + world.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,22 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* <p>
|
||||
* ThaumicTinkerer is Open Source and distributed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||
* License (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* <p>
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4. Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* <p>
|
||||
* File Created @ [4 Sep 2013, 16:29:41 (GMT)]
|
||||
*/
|
||||
package thaumic.tinkerer.common.core.proxy;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -24,9 +26,10 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
@@ -51,8 +54,12 @@ 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.commands.KamiUnlockedCommand;
|
||||
import thaumic.tinkerer.common.core.commands.MaxResearchCommand;
|
||||
import thaumic.tinkerer.common.core.commands.SetTendencyCommand;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.core.handler.kami.DimensionalShardDropHandler;
|
||||
@@ -68,7 +75,6 @@ import thaumic.tinkerer.common.item.SpellClothCraftingHandler;
|
||||
import thaumic.tinkerer.common.item.foci.ItemFocusDeflect;
|
||||
import thaumic.tinkerer.common.item.kami.wand.CapIchor;
|
||||
import thaumic.tinkerer.common.item.kami.wand.RodIchorcloth;
|
||||
import thaumic.tinkerer.common.lib.LibMisc;
|
||||
import thaumic.tinkerer.common.network.GuiHandler;
|
||||
import thaumic.tinkerer.common.network.PlayerTracker;
|
||||
import thaumic.tinkerer.common.network.packet.PacketEnchanterAddEnchant;
|
||||
@@ -88,6 +94,7 @@ import thaumic.tinkerer.common.peripheral.OpenComputers.DriverEssentiaTransport;
|
||||
import thaumic.tinkerer.common.peripheral.OpenComputers.DriverIAspectContainer;
|
||||
import thaumic.tinkerer.common.peripheral.PeripheralHandler;
|
||||
import thaumic.tinkerer.common.potion.ModPotions;
|
||||
import thaumic.tinkerer.common.potion.PotionEffectHandlerServer;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
|
||||
public class TTCommonProxy {
|
||||
@@ -96,6 +103,7 @@ public class TTCommonProxy {
|
||||
public WandCap capIchor;
|
||||
public WandRod rodIchor;
|
||||
public Item.ToolMaterial toolMaterialIchor;
|
||||
private PotionEffectHandlerServer potionHandlerServer;
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
toolMaterialIchor = EnumHelper.addToolMaterial("ICHOR", 4, -1, 10F, 5F, 25);
|
||||
@@ -113,7 +121,6 @@ public class TTCommonProxy {
|
||||
if (Loader.isModLoaded("ComputerCraft")) {
|
||||
initCCPeripherals();
|
||||
}
|
||||
registerVersionChecker();
|
||||
|
||||
kamiRarity = EnumHelper.addEnum(
|
||||
new Class[][] { { EnumRarity.class, EnumChatFormatting.class, String.class } },
|
||||
@@ -158,43 +165,8 @@ public class TTCommonProxy {
|
||||
} else {
|
||||
ThaumicTinkerer.log.info("Skipping TC Multipart integration");
|
||||
}
|
||||
}
|
||||
|
||||
protected void registerPackets() {
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketSoulHearts.class, PacketSoulHearts.class, 142 + 0, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 1, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 2, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketWarpGateButton.class, PacketWarpGateButton.class, 142 + 3, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketWarpGateTeleport.class, PacketWarpGateTeleport.class, 142 + 4, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(
|
||||
PacketEnchanterAddEnchant.class,
|
||||
PacketEnchanterAddEnchant.class,
|
||||
142 + 5,
|
||||
Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(
|
||||
PacketEnchanterStartWorking.class,
|
||||
PacketEnchanterStartWorking.class,
|
||||
142 + 6,
|
||||
Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketMobMagnetButton.class, PacketMobMagnetButton.class, 142 + 7, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketTabletButton.class, PacketTabletButton.class, 142 + 8, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler
|
||||
.registerMessage(PacketPlacerButton.class, PacketPlacerButton.class, 142 + 9, Side.SERVER);
|
||||
}
|
||||
|
||||
public void registerVersionChecker() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("curseProjectName", "75598-thaumic-tinkerer");
|
||||
compound.setString("curseFilenameParser", "ThaumicTinkerer-[].jar");
|
||||
compound.setString("modDisplayName", "Thaumic Tinkerer");
|
||||
FMLInterModComms.sendRuntimeMessage(LibMisc.MOD_ID, "VersionChecker", "addCurseCheck", compound);
|
||||
EMTCompat.init();
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
@@ -204,6 +176,41 @@ public class TTCommonProxy {
|
||||
ItemFocusDeflect.setupBlackList();
|
||||
}
|
||||
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
this.potionHandlerServer = new PotionEffectHandlerServer();
|
||||
MinecraftForge.EVENT_BUS.register(potionHandlerServer);
|
||||
FMLCommonHandler.instance().bus().register(potionHandlerServer);
|
||||
}
|
||||
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
if (this.potionHandlerServer != null) {
|
||||
MinecraftForge.EVENT_BUS.unregister(potionHandlerServer);
|
||||
FMLCommonHandler.instance().bus().unregister(potionHandlerServer);
|
||||
this.potionHandlerServer = null;
|
||||
}
|
||||
}
|
||||
|
||||
// spotless:off
|
||||
protected void registerPackets() {
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketSoulHearts.class, PacketSoulHearts.class, 142 + 0, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 1, Side.CLIENT);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketToggleArmor.class, PacketToggleArmor.class, 142 + 2, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketWarpGateButton.class, PacketWarpGateButton.class, 142 + 3, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketWarpGateTeleport.class, PacketWarpGateTeleport.class, 142 + 4, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketEnchanterAddEnchant.class, PacketEnchanterAddEnchant.class, 142 + 5, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketEnchanterStartWorking.class, PacketEnchanterStartWorking.class, 142 + 6, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketMobMagnetButton.class, PacketMobMagnetButton.class, 142 + 7, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketTabletButton.class, PacketTabletButton.class, 142 + 8, Side.SERVER);
|
||||
ThaumicTinkerer.netHandler.registerMessage(PacketPlacerButton.class, PacketPlacerButton.class, 142 + 9, Side.SERVER);
|
||||
}
|
||||
// spotless:on
|
||||
|
||||
@Optional.Method(modid = "EnderIO")
|
||||
protected void InitEnderIO() {
|
||||
EnderIO.registerPlanters();
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ModEnchantmentHandler {
|
||||
int finalStrike = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.finalStrike, heldItem);
|
||||
if (finalStrike > 0) {
|
||||
Random rand = new Random();
|
||||
if ((finalStrike >= 19 || rand.nextInt(20 - finalStrike) == 0)) {
|
||||
if (finalStrike > rand.nextInt(19)) {
|
||||
event.ammount *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
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;
|
||||
@@ -32,11 +30,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -39,11 +37,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -66,7 +64,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
|
||||
public ItemBloodSword() {
|
||||
super(EnumHelper.addToolMaterial("TT_BLOOD", 0, 950, 0, 0, ThaumcraftApi.toolMatThaumium.getEnchantability()));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -112,60 +110,6 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == this
|
||||
&& stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
// if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
// for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDamageTaken(LivingAttackEvent event) {
|
||||
if (event.entity == null) return;
|
||||
|
||||
if (event.entity.worldObj.isRemote) return;
|
||||
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle) handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == this) {
|
||||
|
||||
event.setCanceled(true);
|
||||
handleNext = 3;
|
||||
player.attackEntityFrom(DamageSource.magic, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == this) attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
|
||||
@@ -187,11 +131,6 @@ 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;
|
||||
@@ -239,4 +178,62 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
new ItemStack(Items.diamond),
|
||||
new ItemStack(Items.ghast_tear));
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == ItemBloodSword.this
|
||||
&& stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
// if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
// for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDamageTaken(LivingAttackEvent event) {
|
||||
if (event.entity == null) return;
|
||||
|
||||
if (event.entity.worldObj.isRemote) return;
|
||||
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle) handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this) {
|
||||
|
||||
event.setCanceled(true);
|
||||
handleNext = 3;
|
||||
player.attackEntityFrom(DamageSource.magic, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this)
|
||||
attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4.
|
||||
* Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [Nov 24, 2013, 7:31:51 PM (GMT)]
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.client.core.helper.IconHelper;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.lib.LibItemNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ITTinkererItem;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererInfusionRecipe;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
import thaumic.tinkerer.common.research.TTResearchItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkererItem {
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
|
||||
return super.getItemUseAction(par1ItemStack);
|
||||
}
|
||||
|
||||
private static final int DAMAGE = 10;
|
||||
|
||||
public ItemBloodSword() {
|
||||
super(EnumHelper.addToolMaterial("TT_BLOOD", 0, 950, 0, 0, ThaumcraftApi.toolMatThaumium.getEnchantability()));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
private IIcon activeIcon;
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
<<<<<<< HEAD
|
||||
if(stack==null)
|
||||
return itemIcon;
|
||||
if(stack.stackTagCompound==null)
|
||||
return itemIcon;
|
||||
return stack.stackTagCompound.getInteger("Activated") == 1 ? activeIcon : itemIcon;
|
||||
=======
|
||||
return (stack.stackTagCompound != null && stack.stackTagCompound.getInteger("Activated") == 1) ? activeIcon : itemIcon;
|
||||
>>>>>>> develop
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
|
||||
activeIcon = IconHelper.forItem(par1IconRegister, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
Multimap multimap = HashMultimap.create();
|
||||
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", DAMAGE, 0));
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 0.25, 1));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
static int handleNext = 0;
|
||||
|
||||
public void addDrops(LivingDropsEvent event, ItemStack dropStack) {
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == this && stack.stackTagCompound != null && stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
//ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
//AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
//if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
//for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDamageTaken(LivingAttackEvent event) {
|
||||
if (event.entity.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle)
|
||||
handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == this) {
|
||||
|
||||
event.setCanceled(true);
|
||||
handleNext = 3;
|
||||
player.attackEntityFrom(DamageSource.magic, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == this)
|
||||
attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
|
||||
ItemStack cache = super.onItemRightClick(stack, par2World, par3EntityPlayer);
|
||||
if (par3EntityPlayer.isSneaking() && !par2World.isRemote) {
|
||||
if (stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
if (stack.stackTagCompound.getInteger("Activated") == 0) {
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.bloodSword.activateEssentiaHarvest"));
|
||||
stack.stackTagCompound.setInteger("Activated", 1);
|
||||
} else {
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.bloodSword.deactivateEssentiaHarvest"));
|
||||
stack.stackTagCompound.setInteger("Activated", 0);
|
||||
}
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.BLOOD_SWORD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_BLOOD_SWORD, new AspectList().add(Aspect.HUNGER, 2).add(Aspect.WEAPON, 1).add(Aspect.FLESH, 1).add(Aspect.SOUL, 1), -4, 6, 3, new ItemStack(this)).setParents(LibResearch.KEY_CLEANSING_TALISMAN)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_BLOOD_SWORD), new ResearchPage("1")).setSecondary();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_BLOOD_SWORD, new ItemStack(this), 6, new AspectList().add(Aspect.HUNGER, 20).add(Aspect.DARKNESS, 5).add(Aspect.SOUL, 10).add(Aspect.MAN, 6), new ItemStack(ConfigItems.itemSwordThaumium),
|
||||
new ItemStack(Items.rotten_flesh), new ItemStack(Items.porkchop), new ItemStack(Items.beef), new ItemStack(Items.bone), new ItemStack(Items.diamond), new ItemStack(Items.ghast_tear));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -292,4 +292,12 @@ 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,10 +11,9 @@
|
||||
*/
|
||||
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;
|
||||
|
||||
@@ -48,10 +47,8 @@ public class ItemGas extends ItemBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList<Object> result = new ArrayList<>();
|
||||
result.add(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockGaseousLight.class));
|
||||
return result;
|
||||
public Item[] getMetaItems() {
|
||||
return new Item[] { new ItemGas(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockGaseousLight.class)) };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ 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;
|
||||
|
||||
@@ -65,6 +66,7 @@ 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,
|
||||
@@ -76,9 +78,9 @@ public class ItemGasRemover extends ItemBase {
|
||||
'D',
|
||||
new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemDarkQuartz.class)),
|
||||
'T',
|
||||
new ItemStack(ThaumicTinkerer.registry.getItemFromClass(ItemGas.class).get(0)),
|
||||
new ItemStack(gasTypes[0]),
|
||||
'G',
|
||||
new ItemStack(ThaumicTinkerer.registry.getItemFromClass(ItemGas.class).get(1)),
|
||||
new ItemStack(gasTypes[1]),
|
||||
'Q',
|
||||
new ItemStack(Items.quartz));
|
||||
}
|
||||
|
||||
@@ -118,11 +118,6 @@ public class ItemInfusedPotion extends ItemPotion implements ITTinkererItem {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.INFUSED_POTION;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
@@ -138,11 +137,6 @@ 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,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -112,11 +111,6 @@ public class ItemRevealingHelm extends ItemArmor
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.REVEALING_HELM;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ItemSpellCloth extends ItemBase {
|
||||
return new ThaumicTinkererCrucibleRecipe(
|
||||
LibResearch.KEY_SPELL_CLOTH,
|
||||
new ItemStack(this),
|
||||
new ItemStack(ConfigItems.itemResource, 0, 7),
|
||||
new ItemStack(ConfigItems.itemResource, 1, 7),
|
||||
new AspectList().add(Aspect.MAGIC, 10).add(Aspect.ENTROPY, 6).add(Aspect.EXCHANGE, 4));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
@@ -22,15 +20,10 @@ public class ItemTravelSlab extends ItemSlab implements ITTinkererItem {
|
||||
super(
|
||||
par1,
|
||||
(BlockSlab) ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockTravelSlab.class).get(1),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockTravelSlab.class, 1),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.TRAVEL_SLAB;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
@@ -22,15 +20,10 @@ public class ItemWardSlab extends ItemSlab implements ITTinkererItem {
|
||||
super(
|
||||
par1,
|
||||
(BlockSlab) ThaumicTinkerer.registry.getFirstBlockFromClass(BlockWardSlab.class),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockWardSlab.class).get(1),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockWardSlab.class, 1),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.WARD_SLAB;
|
||||
|
||||
@@ -85,11 +85,13 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
|
||||
int xp = getXP(par1ItemStack);
|
||||
setXP(par1ItemStack, xp - LibFeatures.XP_TALISMAN_ENCHANTING_BOTTLE_COST);
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "random.orb", 0.1F, (float) (0.1F + Math.random() / 2F));
|
||||
for (int i = 0; par2World.isRemote && i < 6; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (par3EntityPlayer.posX + (Math.random() - 0.5)),
|
||||
(float) (par3EntityPlayer.posY + Math.random() - 0.5),
|
||||
(float) (par3EntityPlayer.posZ + (Math.random() - 0.5)),
|
||||
3);
|
||||
if (par2World.isRemote) {
|
||||
for (int i = 0; par2World.isRemote && i < 6; i++) ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) (par3EntityPlayer.posX + (Math.random() - 0.5)),
|
||||
(float) (par3EntityPlayer.posY + Math.random() - 0.5),
|
||||
(float) (par3EntityPlayer.posZ + (Math.random() - 0.5)),
|
||||
3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +99,13 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
|
||||
}
|
||||
|
||||
private void consumeXPOrb(EntityXPOrb orb) {
|
||||
orb.setDead();
|
||||
orb.worldObj.playSoundAtEntity(orb, "thaumcraft:zap", orb.getXpValue() / 10F, 1F);
|
||||
ThaumicTinkerer.tcProxy
|
||||
.wispFX(orb.worldObj, orb.posX, orb.posY, orb.posZ, orb.getXpValue() / 5F, 0.1F, 0.9F, 0.1F);
|
||||
if (!orb.worldObj.isRemote) {
|
||||
orb.setDead();
|
||||
orb.worldObj.playSoundAtEntity(orb, "thaumcraft:zap", orb.getXpValue() / 10F, 1F);
|
||||
} else {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.wispFX(orb.worldObj, orb.posX, orb.posY, orb.posZ, orb.getXpValue() / 5F, 0.1F, 0.9F, 0.1F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,13 +184,15 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
|
||||
@Override
|
||||
public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) {
|
||||
World par2World = player.worldObj;
|
||||
if (par1ItemStack.getItemDamage() == 1 && !par2World.isRemote) {
|
||||
if (par1ItemStack.getItemDamage() == 1) {
|
||||
int r = LibFeatures.XP_TALISMAN_RANGE;
|
||||
int currentXP = getXP(par1ItemStack);
|
||||
int xpToAdd = 0;
|
||||
int maxXP = LibFeatures.XP_TALISMAN_MAX_XP - currentXP; // Max, to prevent overflow.
|
||||
if (maxXP <= 0) {
|
||||
par1ItemStack.setItemDamage(0);
|
||||
if (!par2World.isRemote) {
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
return; // Can't take any XP.
|
||||
}
|
||||
|
||||
@@ -211,8 +218,9 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
|
||||
if (maxXP <= 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
setXP(par1ItemStack, Math.min(LibFeatures.XP_TALISMAN_MAX_XP, currentXP + xpToAdd));
|
||||
if (!par2World.isRemote) {
|
||||
setXP(par1ItemStack, Math.min(LibFeatures.XP_TALISMAN_MAX_XP, currentXP + xpToAdd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemFocusDeflect extends ItemModFocus {
|
||||
range = wand.getFocusEnlarge(stack);
|
||||
}
|
||||
|
||||
List<Entity> projectiles = p.worldObj.getEntitiesWithinAABB(
|
||||
var projectiles = p.worldObj.getEntitiesWithinAABB(
|
||||
IProjectile.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
p.posX - (4 + range),
|
||||
@@ -74,17 +74,19 @@ public class ItemFocusDeflect extends ItemModFocus {
|
||||
p.posY + (3 + range),
|
||||
p.posZ + (3 + range)));
|
||||
|
||||
for (Entity e : projectiles) {
|
||||
for (var projectile : projectiles) {
|
||||
if (!(projectile instanceof Entity e)) continue;
|
||||
|
||||
if (CheckBlackList(e) || ProjectileHelper.getOwner(e) == p) continue;
|
||||
Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ).normalize().multiply(
|
||||
Math.sqrt(
|
||||
(e.posX - p.posX) * (e.posX - p.posX) + (e.posY - p.posY) * (e.posY - p.posY)
|
||||
+ (e.posZ - p.posZ) * (e.posZ - p.posZ))
|
||||
* 2);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) e.posX, (float) e.posY, (float) e.posZ, 6);
|
||||
|
||||
if (p.worldObj.isRemote) {
|
||||
for (int i = 0; i < 6; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) e.posX, (float) e.posY, (float) e.posZ, 6);
|
||||
}
|
||||
e.posX += motionVec.x;
|
||||
e.posY += motionVec.y;
|
||||
e.posZ += motionVec.z;
|
||||
@@ -102,19 +104,11 @@ public class ItemFocusDeflect extends ItemModFocus {
|
||||
|
||||
@Override
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack itemstack, int rank) {
|
||||
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;
|
||||
return switch (rank) {
|
||||
case 1, 3, 5 -> new FocusUpgradeType[] { FocusUpgradeType.frugal };
|
||||
case 2, 4 -> new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge };
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean CheckBlackList(Entity entity) {
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ItemFocusDislocation extends ItemModFocus {
|
||||
stack.getItemDamage(),
|
||||
1 | 2);
|
||||
((ItemBlock) stack.getItem()).field_150939_a
|
||||
.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, itemstack);
|
||||
.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, stack);
|
||||
NBTTagCompound tileCmp = getStackTileEntity(itemstack);
|
||||
if (tileCmp != null && !tileCmp.hasNoTags()) {
|
||||
TileEntity tile1 = TileEntity.createAndLoadEntity(tileCmp);
|
||||
@@ -126,15 +126,17 @@ public class ItemFocusDislocation extends ItemModFocus {
|
||||
tile1.zCoord = mop.blockZ;
|
||||
world.setTileEntity(mop.blockX, mop.blockY, mop.blockZ, tile1);
|
||||
}
|
||||
} else player.swingItem();
|
||||
} else {
|
||||
player.swingItem();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
float x = (float) (mop.blockX + Math.random());
|
||||
float y = (float) (mop.blockY + Math.random()) + 0.65F;
|
||||
float z = (float) (mop.blockZ + Math.random());
|
||||
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
|
||||
}
|
||||
}
|
||||
clearPickedBlock(itemstack);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
float x = (float) (mop.blockX + Math.random());
|
||||
float y = (float) (mop.blockY + Math.random()) + 0.65F;
|
||||
float z = (float) (mop.blockZ + Math.random());
|
||||
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
|
||||
}
|
||||
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F, 1F);
|
||||
}
|
||||
} else if (!blacklist.contains(block) && isBlockAllowed(block)
|
||||
@@ -146,13 +148,13 @@ public class ItemFocusDislocation extends ItemModFocus {
|
||||
world.removeTileEntity(mop.blockX, mop.blockY, mop.blockZ);
|
||||
world.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.air, 0, 1 | 2);
|
||||
storePickedBlock(itemstack, block, (short) meta, tile);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
float x = (float) (mop.blockX + Math.random());
|
||||
float y = (float) (mop.blockY + Math.random());
|
||||
float z = (float) (mop.blockZ + Math.random());
|
||||
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
|
||||
} else {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
float x = (float) (mop.blockX + Math.random());
|
||||
float y = (float) (mop.blockY + Math.random());
|
||||
float z = (float) (mop.blockZ + Math.random());
|
||||
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
|
||||
}
|
||||
}
|
||||
world.playSoundAtEntity(player, block.stepSound.getBreakSound(), 1F, 1F);
|
||||
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F, 1F);
|
||||
|
||||
@@ -56,15 +56,17 @@ public class ItemFocusFlight extends ItemModFocus {
|
||||
if (p instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) p).playerNetServerHandler.floatingTickCount = 0;
|
||||
}
|
||||
for (int i = 0; i < 5; i++) ThaumicTinkerer.tcProxy.smokeSpiral(
|
||||
world,
|
||||
p.posX,
|
||||
p.posY - p.motionY,
|
||||
p.posZ,
|
||||
2F,
|
||||
(int) (Math.random() * 360),
|
||||
(int) p.posY,
|
||||
0x9E2FF);
|
||||
if (world.isRemote) {
|
||||
for (int i = 0; i < 5; i++) ThaumicTinkerer.tcProxy.smokeSpiral(
|
||||
world,
|
||||
p.posX,
|
||||
p.posY - p.motionY,
|
||||
p.posZ,
|
||||
2F,
|
||||
(int) (Math.random() * 360),
|
||||
(int) p.posY,
|
||||
0x9E2FF);
|
||||
}
|
||||
world.playSoundAtEntity(p, "thaumcraft:wind", 0.4F, 1F);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +58,13 @@ public class ItemFocusHeal extends ItemModFocus {
|
||||
int progress = playerHealData.get(p.getGameProfile().getName()) + 1;
|
||||
playerHealData.put(p.getGameProfile().getName(), progress);
|
||||
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) p.posX + p.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) p.posY + p.worldObj.rand.nextFloat(),
|
||||
(float) p.posZ + p.worldObj.rand.nextFloat() - 0.5F,
|
||||
0);
|
||||
if (p.worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(
|
||||
(float) p.posX + p.worldObj.rand.nextFloat() - 0.5F,
|
||||
(float) p.posY + p.worldObj.rand.nextFloat(),
|
||||
(float) p.posZ + p.worldObj.rand.nextFloat() - 0.5F,
|
||||
0);
|
||||
}
|
||||
|
||||
if (progress >= 30 - potency * 10 / 3) {
|
||||
playerHealData.put(p.getGameProfile().getName(), 0);
|
||||
|
||||
@@ -117,21 +117,23 @@ public class ItemFocusSmelt extends ItemModFocus {
|
||||
p.worldObj.playSoundAtEntity(p, "fire.fire", 1F, 1F);
|
||||
// Particle
|
||||
////////////////////
|
||||
for (int i = 0; i < 25; i++) {
|
||||
double x = pos.blockX + Math.random();
|
||||
double y = pos.blockY + Math.random();
|
||||
double z = pos.blockZ + Math.random();
|
||||
if (p.worldObj.isRemote) {
|
||||
for (int i = 0; i < 25; i++) {
|
||||
double x = pos.blockX + Math.random();
|
||||
double y = pos.blockY + Math.random();
|
||||
double z = pos.blockZ + Math.random();
|
||||
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
p.worldObj,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
(float) Math.random() / 2F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
(float) -Math.random() / 10F);
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
p.worldObj,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
(float) Math.random() / 2F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
(float) -Math.random() / 10F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,21 +148,23 @@ public class ItemFocusSmelt extends ItemModFocus {
|
||||
if (time % soundCooldown == 0) p.worldObj.playSoundAtEntity(p, "fire.fire", 0.2F, 1F);
|
||||
// Particle
|
||||
////////////////////
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = pos.blockX + Math.random();
|
||||
double y = pos.blockY + Math.random();
|
||||
double z = pos.blockZ + Math.random();
|
||||
if (p.worldObj.isRemote) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = pos.blockX + Math.random();
|
||||
double y = pos.blockY + Math.random();
|
||||
double z = pos.blockZ + Math.random();
|
||||
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
p.worldObj,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
(float) Math.random() / 2F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
(float) -Math.random() / 10F);
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
p.worldObj,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
(float) Math.random() / 2F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
(float) -Math.random() / 10F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ public class ItemFocusTelekinesis extends ItemModFocus {
|
||||
if (!entities.isEmpty() && wand.consumeAllVis(stack, player, getVisCost(stack), true, false)) {
|
||||
for (EntityItem item : entities) {
|
||||
MiscHelper.setEntityMotionFromVector(item, target, 0.3333F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) item.posX, (float) item.posY, (float) item.posZ, 0);
|
||||
if (player.worldObj.isRemote) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) item.posX, (float) item.posY, (float) item.posZ, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.foci;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -58,11 +57,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -35,11 +33,6 @@ 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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -27,6 +27,10 @@ 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;
|
||||
@@ -50,7 +54,10 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.KamiResearchItem;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
|
||||
public class ItemIchorPouch extends ItemFocusPouch implements IBauble, ITTinkererItem {
|
||||
@Optional.Interface(iface = "baubles.api.expanded.IBaubleExpanded", modid = "Baubles|Expanded")
|
||||
public class ItemIchorPouch extends ItemFocusPouch implements IBauble, IBaubleExpanded, ITTinkererItem {
|
||||
|
||||
private static final boolean baublesExpandedLoaded = Loader.isModLoaded("Baubles|Expanded");
|
||||
|
||||
public ItemIchorPouch() {
|
||||
super();
|
||||
@@ -82,17 +89,31 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, ITTinkere
|
||||
|
||||
@Override
|
||||
public ItemStack[] getInventory(ItemStack item) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return stackList;
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List textLines, boolean showAdvancedInfo) {
|
||||
if (baublesExpandedLoaded) {
|
||||
BaubleItemHelper.addSlotInformation(textLines, getBaubleTypes(null));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,6 +121,12 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, ITTinkere
|
||||
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) {}
|
||||
|
||||
@@ -119,11 +146,6 @@ public class ItemIchorPouch extends ItemFocusPouch implements IBauble, ITTinkere
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.ICHOR_POUCH;
|
||||
|
||||
@@ -218,9 +218,9 @@ public class ItemKamiResource extends ItemKamiBase {
|
||||
new AspectList().add(Aspect.MAN, 32).add(Aspect.LIGHT, 32).add(Aspect.SOUL, 64),
|
||||
new ItemStack(Items.nether_star),
|
||||
new ItemStack(Items.diamond),
|
||||
new ItemStack(this, 8, 7),
|
||||
new ItemStack(this, 1, 7),
|
||||
new ItemStack(Items.ender_eye),
|
||||
new ItemStack(this, 8, 6)),
|
||||
new ItemStack(this, 1, 6)),
|
||||
new ThaumicTinkererInfusionRecipe(
|
||||
LibResearch.KEY_ICHORCLOTH_ROD,
|
||||
new ItemStack(this, 1, 5),
|
||||
|
||||
@@ -34,6 +34,7 @@ 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;
|
||||
@@ -42,9 +43,6 @@ 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";
|
||||
@@ -56,40 +54,39 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public static boolean hasBlocks(ItemStack stack, EntityPlayer player, ChunkCoordinates[] blocks) {
|
||||
public static boolean hasBlocks(EntityPlayer player, Block requiredBlock, int requiredMetadata,
|
||||
int requiredAmount) {
|
||||
if (player.capabilities.isCreativeMode) return true;
|
||||
|
||||
int required = blocks.length;
|
||||
Item requiredItem = Item.getItemFromBlock(requiredBlock);
|
||||
|
||||
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 && stackInSlot.getItem() == reqStack.getItem()
|
||||
&& stackInSlot.getItemDamage() == reqStack.getItemDamage()) {
|
||||
current += stackInSlot.stackSize;
|
||||
if (current >= required) return true;
|
||||
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() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
|
||||
talismansToCheck.add(stackInSlot);
|
||||
}
|
||||
|
||||
for (ItemStack talisman : talismansToCheck) {
|
||||
Block block = ItemBlockTalisman.getBlock(talisman);
|
||||
int meta = ItemBlockTalisman.getBlockMeta(talisman);
|
||||
current += ItemBlockTalisman.getBlockCount(talisman);
|
||||
|
||||
if (Item.getItemFromBlock(block) == reqStack.getItem() && meta == reqStack.getItemDamage()) {
|
||||
current += ItemBlockTalisman.getBlockCount(talisman);
|
||||
|
||||
if (current >= required) return true;
|
||||
}
|
||||
if (current >= requiredAmount) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ChunkCoordinates[] getBlocksToPlace(ItemStack stack, EntityPlayer player) {
|
||||
public static List<ChunkCoordinates> getBlocksToPlace(ItemStack stack, EntityPlayer player) {
|
||||
List<ChunkCoordinates> coords = new ArrayList<>();
|
||||
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(player.worldObj, player, true, 5);
|
||||
if (pos != null) {
|
||||
@@ -124,7 +121,7 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
}
|
||||
}
|
||||
|
||||
return coords.toArray(new ChunkCoordinates[coords.size()]);
|
||||
return coords;
|
||||
}
|
||||
|
||||
private static void setSize(ItemStack stack, int size) {
|
||||
@@ -135,16 +132,8 @@ 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) {
|
||||
Block block = Block.getBlockFromName(getBlockName(stack));
|
||||
if (block == Blocks.air) block = Block.getBlockById(getBlockID(stack));
|
||||
|
||||
return block;
|
||||
return Block.getBlockFromName(getBlockName(stack));
|
||||
}
|
||||
|
||||
public static String getBlockName(ItemStack stack) {
|
||||
@@ -182,16 +171,20 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
}
|
||||
|
||||
public void placeAllBlocks(ItemStack stack, EntityPlayer player) {
|
||||
ChunkCoordinates[] blocksToPlace = getBlocksToPlace(stack, player);
|
||||
if (!hasBlocks(stack, player, blocksToPlace)) return;
|
||||
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;
|
||||
|
||||
ItemStack stackToPlace = new ItemStack(getBlock(stack), 1, getBlockMeta(stack));
|
||||
for (ChunkCoordinates coords : blocksToPlace) placeBlockAndConsume(player, stackToPlace, coords);
|
||||
ItemStack stackToPlace = new ItemStack(requiredBlock, 1, requiredMetadata);
|
||||
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,
|
||||
@@ -213,8 +206,7 @@ public class ItemPlacementMirror extends ItemKamiBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stackInSlot != null
|
||||
&& stackInSlot.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
|
||||
if (stackInSlot != null && stackInSlot.getItem() == TTRegistry.itemBlackHoleTalisman)
|
||||
talismansToCheck.add(stackInSlot);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,50 +49,6 @@ public class ItemProtoclay extends ItemKamiBase {
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void Interact(PlayerInteractEvent event) {
|
||||
if (event.entityPlayer.inventory.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemProtoclay.class))) {
|
||||
World par2World = event.world;
|
||||
Entity par3Entity = event.entityPlayer;
|
||||
EntityPlayer player = (EntityPlayer) par3Entity;
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool)) return;
|
||||
IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();
|
||||
|
||||
if (tool.getType().equals("sword")) return;
|
||||
|
||||
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
|
||||
String typeToFind = "";
|
||||
|
||||
if (player.isSwingInProgress && pos != null) {
|
||||
Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
if (block != null) {
|
||||
Material mat = block.getMaterial();
|
||||
if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) typeToFind = "pick";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) typeToFind = "shovel";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) typeToFind = "axe";
|
||||
}
|
||||
}
|
||||
|
||||
if (tool.getType().equals(typeToFind) || typeToFind.isEmpty()) return;
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool
|
||||
&& stackInSlot != currentStack) {
|
||||
IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
|
||||
if (toolInSlot.getType().equals(typeToFind)) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
|
||||
player.inventory.setInventorySlotContents(i, currentStack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {}
|
||||
|
||||
@@ -136,7 +92,56 @@ public class ItemProtoclay extends ItemKamiBase {
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
return super.shouldRegister();
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void Interact(PlayerInteractEvent event) {
|
||||
if (event.entityPlayer.inventory
|
||||
.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemProtoclay.class))) {
|
||||
World par2World = event.world;
|
||||
Entity par3Entity = event.entityPlayer;
|
||||
EntityPlayer player = (EntityPlayer) par3Entity;
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool)) return;
|
||||
IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();
|
||||
|
||||
if (tool.getType().equals("sword")) return;
|
||||
|
||||
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
|
||||
String typeToFind = "";
|
||||
|
||||
if (player.isSwingInProgress && pos != null) {
|
||||
Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
if (block != null) {
|
||||
Material mat = block.getMaterial();
|
||||
if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) typeToFind = "pick";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) typeToFind = "shovel";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) typeToFind = "axe";
|
||||
}
|
||||
}
|
||||
|
||||
if (tool.getType().equals(typeToFind) || typeToFind.isEmpty()) return;
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool
|
||||
&& stackInSlot != currentStack) {
|
||||
IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
|
||||
if (toolInSlot.getType().equals(typeToFind)) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
|
||||
player.inventory.setInventorySlotContents(i, currentStack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,15 +20,21 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
@@ -41,8 +47,12 @@ import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.KamiResearchItem;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
import thaumicboots.api.IBoots;
|
||||
|
||||
public class ItemGemBoots extends ItemIchorclothArmorAdv {
|
||||
@Interface(iface = "thaumicboots.api.IBoots", modid = "thaumicboots")
|
||||
public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
|
||||
|
||||
public float speedBonus = 0.075F;
|
||||
|
||||
public static List<String> playersWith1Step = new ArrayList<>();
|
||||
|
||||
@@ -63,14 +73,14 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv {
|
||||
|
||||
if (player.worldObj.isRemote) player.stepHeight = player.isSneaking() ? 0.5F : 1F;
|
||||
if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
|
||||
player.moveFlying(0F, 1F, player.capabilities.isFlying ? 0.075F : 0.15F);
|
||||
player.moveFlying(0F, speedBonus, player.capabilities.isFlying ? 0.075F : 0.15F);
|
||||
player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F;
|
||||
player.fallDistance = 0F;
|
||||
|
||||
if (ConfigHandler.shouldKamiBootsDoGrass) {
|
||||
int x = (int) player.posX;
|
||||
int y = (int) player.posY - 1;
|
||||
int z = (int) player.posZ;
|
||||
int x = MathHelper.floor_double(player.posX);
|
||||
int y = MathHelper.floor_double(player.posY) - 1;
|
||||
int z = MathHelper.floor_double(player.posZ);
|
||||
if (player.worldObj.getBlock(x, y, z) == Blocks.dirt && player.worldObj.getBlockMetadata(x, y, z) == 0)
|
||||
player.worldObj.setBlock(x, y, z, Blocks.grass, 0, 2);
|
||||
}
|
||||
@@ -120,47 +130,143 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv {
|
||||
new ItemStack(Items.lead));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerJump(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
|
||||
|
||||
if (hasArmor && ThaumicTinkerer.proxy.armorStatus(player) && player.getCurrentArmor(0).getItemDamage() == 0)
|
||||
player.motionY += 0.3;
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (getIntertialState(itemStack) && player.moveForward == 0
|
||||
&& player.moveStrafing == 0
|
||||
&& player.capabilities.isFlying) {
|
||||
player.motionX *= 0.5;
|
||||
player.motionZ *= 0.5;
|
||||
}
|
||||
}
|
||||
boolean omniMode = false;
|
||||
if (ThaumicTinkerer.isBootsActive) {
|
||||
omniMode = isOmniEnabled(itemStack);
|
||||
if ((player.moveForward == 0F && player.moveStrafing == 0F && omniMode)
|
||||
|| (player.moveForward <= 0F && !omniMode)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (player.moveForward != 0.0F || player.moveStrafing != 0.0F) {
|
||||
if (player.worldObj.isRemote && !player.isSneaking()) {
|
||||
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId())) {
|
||||
Thaumcraft.instance.entityEventHandler.prevStep.put(player.getEntityId(), player.stepHeight);
|
||||
}
|
||||
player.stepHeight = 1.0F;
|
||||
}
|
||||
float speedMod = (float) getSpeedModifier(itemStack);
|
||||
if (player.onGround || player.isOnLadder() || player.capabilities.isFlying) {
|
||||
float bonus = speedBonus;
|
||||
if (player.isInWater()) {
|
||||
bonus /= 4.0F;
|
||||
}
|
||||
|
||||
// Attempt at fixing a bug with falling on SMP
|
||||
// In theory, this should be redundant
|
||||
@SubscribeEvent
|
||||
public void onFall(LivingFallEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
|
||||
if (hasArmor) {
|
||||
event.distance = 0;
|
||||
if (player.isSneaking()) {
|
||||
bonus /= 2.0F;
|
||||
}
|
||||
bonus *= speedMod;
|
||||
if (ThaumicTinkerer.isBootsActive) {
|
||||
applyOmniState(player, bonus, itemStack);
|
||||
} else if (player.moveForward > 0.0) {
|
||||
player.moveFlying(0.0F, player.moveForward, bonus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
@Optional.Method(modid = "thaumicboots")
|
||||
public void applyOmniState(EntityPlayer player, float bonus, ItemStack itemStack) {
|
||||
if (player.moveForward != 0.0) {
|
||||
player.moveFlying(0.0F, player.moveForward, bonus);
|
||||
}
|
||||
if (player.moveStrafing != 0.0 && getOmniState(itemStack)) {
|
||||
player.moveFlying(player.moveStrafing, 0.0F, bonus);
|
||||
}
|
||||
}
|
||||
|
||||
boolean highStepListed = playersWith1Step.contains(player.getGameProfile().getName());
|
||||
boolean hasHighStep = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
|
||||
// Avoid NSM Exception when ThaumicBoots is not present.
|
||||
public double getSpeedModifier(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("speed")) {
|
||||
return stack.stackTagCompound.getDouble("speed");
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
if (!highStepListed && (hasHighStep && ThaumicTinkerer.proxy.armorStatus(player)
|
||||
&& player.getCurrentArmor(0).getItemDamage() == 0))
|
||||
playersWith1Step.add(player.getGameProfile().getName());
|
||||
public double getJumpModifier(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("jump")) {
|
||||
return stack.stackTagCompound.getDouble("jump");
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
if ((!hasHighStep || !ThaumicTinkerer.proxy.armorStatus(player)
|
||||
|| player.getCurrentArmor(0).getItemDamage() == 1) && highStepListed) {
|
||||
playersWith1Step.remove(player.getGameProfile().getName());
|
||||
player.stepHeight = 0.5F;
|
||||
public boolean getOmniState(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getBoolean("omni");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getIntertialState(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getBoolean("inertiacanceling");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
super.registerEvents();
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerJump(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack boots = player.getCurrentArmor(0);
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null
|
||||
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
|
||||
|
||||
if (hasArmor && ThaumicTinkerer.proxy.armorStatus(player)
|
||||
&& player.getCurrentArmor(0).getItemDamage() == 0)
|
||||
player.motionY += 0.3 * (float) getJumpModifier(boots);;
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt at fixing a bug with falling on SMP
|
||||
// In theory, this should be redundant
|
||||
@SubscribeEvent
|
||||
public void onFall(LivingFallEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null
|
||||
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
|
||||
if (hasArmor) {
|
||||
event.distance = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
boolean highStepListed = playersWith1Step.contains(player.getGameProfile().getName());
|
||||
boolean hasHighStep = player.getCurrentArmor(0) != null
|
||||
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
|
||||
|
||||
if (!highStepListed && (hasHighStep && ThaumicTinkerer.proxy.armorStatus(player)
|
||||
&& player.getCurrentArmor(0).getItemDamage() == 0))
|
||||
playersWith1Step.add(player.getGameProfile().getName());
|
||||
|
||||
if ((!hasHighStep || !ThaumicTinkerer.proxy.armorStatus(player)
|
||||
|| player.getCurrentArmor(0).getItemDamage() == 1) && highStepListed) {
|
||||
playersWith1Step.remove(player.getGameProfile().getName());
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -128,27 +129,36 @@ public class ItemGemChest extends ItemIchorclothArmorAdv {
|
||||
new ItemStack(Items.arrow));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
super.registerEvents();
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == this) tickPlayer(player);
|
||||
public class EventHandler {
|
||||
|
||||
if (playersWithFlight.contains(playerStr(player))) {
|
||||
if (shouldPlayerHaveFlight(player)) player.capabilities.allowFlying = true;
|
||||
else {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.capabilities.disableDamage = false;
|
||||
@SubscribeEvent
|
||||
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == ItemGemChest.this) tickPlayer(player);
|
||||
|
||||
if (playersWithFlight.contains(playerStr(player))) {
|
||||
if (shouldPlayerHaveFlight(player)) player.capabilities.allowFlying = true;
|
||||
else {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.capabilities.disableDamage = false;
|
||||
}
|
||||
playersWithFlight.remove(playerStr(player));
|
||||
}
|
||||
playersWithFlight.remove(playerStr(player));
|
||||
} else if (shouldPlayerHaveFlight(player)) {
|
||||
playersWithFlight.add(playerStr(player));
|
||||
player.capabilities.allowFlying = true;
|
||||
}
|
||||
} else if (shouldPlayerHaveFlight(player)) {
|
||||
playersWithFlight.add(playerStr(player));
|
||||
player.capabilities.allowFlying = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.armor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -19,6 +18,7 @@ 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,12 +121,8 @@ public class ItemIchorclothArmor extends ItemArmor
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList<Object> result = new ArrayList<>();
|
||||
result.add(1);
|
||||
result.add(2);
|
||||
result.add(3);
|
||||
return result;
|
||||
public Item[] getMetaItems() {
|
||||
return new Item[] { new ItemIchorclothArmor(1), new ItemIchorclothArmor(2), new ItemIchorclothArmor(3) };
|
||||
}
|
||||
|
||||
@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;
|
||||
@@ -38,7 +38,7 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
public ItemIchorclothArmorAdv(int par2) {
|
||||
super(par2);
|
||||
setHasSubtypes(true);
|
||||
if (ticks()) MinecraftForge.EVENT_BUS.register(this);
|
||||
registerEvents();
|
||||
}
|
||||
|
||||
public ItemIchorclothArmorAdv() {
|
||||
@@ -46,7 +46,7 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
public Item[] getMetaItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -86,16 +86,6 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
return false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == this) tickPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
void tickPlayer(EntityPlayer player) {
|
||||
// NO-OP
|
||||
}
|
||||
@@ -119,4 +109,21 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void registerEvents() {
|
||||
if (ticks()) MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == ItemIchorclothArmorAdv.this) tickPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
public class ItemFocusXPDrain extends ItemModKamiFocus {
|
||||
|
||||
AspectList visUsage = new AspectList();
|
||||
private int lastGiven = 0;
|
||||
|
||||
@Override
|
||||
public boolean isVisCostPerTick(ItemStack stack) {
|
||||
@@ -46,32 +45,38 @@ public class ItemFocusXPDrain extends ItemModKamiFocus {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingFocusTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) {
|
||||
if (paramEntityPlayer.worldObj.isRemote) return;
|
||||
public void onUsingFocusTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if (player.worldObj.isRemote) return;
|
||||
|
||||
ItemWandCasting wand = (ItemWandCasting) paramItemStack.getItem();
|
||||
AspectList aspects = wand.getAllVis(paramItemStack);
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
AspectList aspects = wand.getAllVis(stack);
|
||||
|
||||
Aspect aspectToAdd = null;
|
||||
int takes = 0;
|
||||
Aspect lowestAspect = null;
|
||||
int lowestAmount = Integer.MAX_VALUE;
|
||||
int maxVis = wand.getMaxVis(stack);
|
||||
|
||||
while (aspectToAdd == null && takes < 7) {
|
||||
lastGiven = lastGiven == 5 ? 0 : lastGiven + 1;
|
||||
for (Aspect aspect : Aspect.getPrimalAspects()) {
|
||||
int amount = aspects.getAmount(aspect);
|
||||
|
||||
Aspect aspect = Aspect.getPrimalAspects().get(lastGiven);
|
||||
|
||||
if (aspects.getAmount(aspect) < wand.getMaxVis(paramItemStack)) aspectToAdd = aspect;
|
||||
|
||||
++takes;
|
||||
if (amount < maxVis && amount < lowestAmount) {
|
||||
lowestAmount = amount;
|
||||
lowestAspect = aspect;
|
||||
}
|
||||
}
|
||||
|
||||
if (aspectToAdd != null) {
|
||||
int xpUse = getXpUse(paramItemStack);
|
||||
if (paramEntityPlayer.experienceTotal >= xpUse) {
|
||||
ExperienceHelper.drainPlayerXP(paramEntityPlayer, xpUse);
|
||||
int amount = wand.getVis(paramItemStack, aspectToAdd) + 500;
|
||||
ThaumicTinkerer.log.info(amount);
|
||||
wand.storeVis(paramItemStack, aspectToAdd, Math.min(wand.getMaxVis(paramItemStack), amount));
|
||||
if (lowestAspect != null) {
|
||||
int potency = wand.getFocusPotency(stack);
|
||||
float multiplier = 1.0F + (0.2F * potency);
|
||||
|
||||
int intendedAdd = Math.round(500 * multiplier);
|
||||
int actualAdd = Math.min(intendedAdd, maxVis - lowestAmount);
|
||||
|
||||
int xpUse = getXpUse(wand.getFocusItem(stack));
|
||||
int scaledXp = Math.max(1, Math.round(xpUse * (actualAdd / (float) intendedAdd)));
|
||||
|
||||
if (player.experienceTotal >= scaledXp) {
|
||||
ExperienceHelper.drainPlayerXP(player, scaledXp);
|
||||
wand.storeVis(stack, lowestAspect, lowestAmount + actualAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,12 +93,12 @@ public class ItemFocusXPDrain extends ItemModKamiFocus {
|
||||
}
|
||||
|
||||
int getXpUse(ItemStack stack) {
|
||||
return 15;
|
||||
return 15 - this.getUpgradeLevel(stack, FocusUpgradeType.frugal);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addVisCostTooltip(AspectList cost, ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add(StatCollector.translateToLocal(isVisCostPerTick(stack) ? "item.Focus.cost2" : "item.Focus.cost1"));
|
||||
list.add(StatCollector.translateToLocal("item.Focus.cost2"));
|
||||
list.add(
|
||||
" " + EnumChatFormatting.GREEN
|
||||
+ StatCollector.translateToLocal("ttmisc.experience")
|
||||
@@ -108,8 +113,11 @@ public class ItemFocusXPDrain extends ItemModKamiFocus {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
|
||||
return false;
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack itemstack, int rank) {
|
||||
if (rank <= 5) {
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.potency };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.item.kami.foci;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -81,11 +80,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -60,11 +58,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -64,11 +62,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -60,11 +58,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -59,11 +57,6 @@ 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;
|
||||
List<Entity> entities = player.worldObj.getEntitiesWithinAABB(
|
||||
var entities = player.worldObj.getEntitiesWithinAABB(
|
||||
entity.getClass(),
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
entity.posX - range,
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -40,11 +38,6 @@ 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,8 +11,6 @@
|
||||
*/
|
||||
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;
|
||||
@@ -30,15 +28,10 @@ public class ItemDarkQuartzSlab extends ItemSlab implements ITTinkererItem {
|
||||
super(
|
||||
par1,
|
||||
(BlockSlab) ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockDarkQuartzSlab.class).get(1),
|
||||
(BlockSlab) ThaumicTinkerer.registry.getBlockFromClass(BlockDarkQuartzSlab.class, 1),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibBlockNames.DARK_QUARTZ_SLAB;
|
||||
|
||||
@@ -15,9 +15,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
|
||||
public final class ModPotions {
|
||||
@@ -28,8 +26,6 @@ public final class ModPotions {
|
||||
public static Potion potionAir;
|
||||
|
||||
public static void initPotions() {
|
||||
MinecraftForge.EVENT_BUS.register(new PotionEffectHandler());
|
||||
FMLCommonHandler.instance().bus().register(new PotionEffectHandler());
|
||||
|
||||
// Code based on potion code from WayOfTime
|
||||
Potion[] potionTypes = null;
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package thaumic.tinkerer.common.potion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
public final class PotionEffectHandlerClient {
|
||||
|
||||
private final HashMap<Entity, Long> airPotionHitClient = new HashMap<>();
|
||||
private final HashMap<Entity, Long> firePotionHitClient = new HashMap<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingAttackEvent e) {
|
||||
if (e.source.getSourceOfDamage() instanceof EntityPlayer p && p.worldObj.isRemote) {
|
||||
if (p.isPotionActive(ModPotions.potionAir)) {
|
||||
airPotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionFire)) {
|
||||
firePotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
|
||||
}
|
||||
if (p.isPotionActive(ModPotions.potionEarth)) {
|
||||
boolean xAxis = Math.abs(e.entity.posZ - p.posZ) < Math.abs(e.entity.posX - p.posX);
|
||||
int centerX = (int) ((e.entity.posX + p.posX) / 2);
|
||||
|
||||
int centerY = (int) (p.posY + 2);
|
||||
int centerZ = (int) ((e.entity.posZ + p.posZ) / 2);
|
||||
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = -2; j < 3; j++) {
|
||||
if (xAxis) {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.blockSparkle(p.worldObj, centerX, centerY + i, centerZ + j, 100, 100);
|
||||
} else {
|
||||
ThaumicTinkerer.tcProxy
|
||||
.blockSparkle(p.worldObj, centerX + j, centerY + i, centerZ, 100, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
if (e.side == Side.CLIENT && e.player.isPotionActive(ModPotions.potionWater)) {
|
||||
for (int x = (int) (e.player.posX - 2); x < e.player.posX + 2; x++) {
|
||||
for (int y = (int) (e.player.posY - 2); y < e.player.posY + 2; y++) {
|
||||
for (int z = (int) (e.player.posZ - 2); z < e.player.posZ + 2; z++) {
|
||||
if (e.player.worldObj.getBlock(x, y, z) == Blocks.lava
|
||||
|| e.player.worldObj.getBlock(x, y, z) == Blocks.flowing_lava) {
|
||||
ThaumicTinkerer.tcProxy.burst(e.player.worldObj, x + .5, y + .5, z + .5, 1.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTickClient(TickEvent.ClientTickEvent e) {
|
||||
|
||||
Iterator<Entity> iter = airPotionHitClient.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > airPotionHitClient.get(target) + 20) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
iter = firePotionHitClient.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity target = iter.next();
|
||||
if (target.isEntityAlive()) {
|
||||
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
Random rand = new Random();
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
double theta = rand.nextFloat() * 2 * Math.PI;
|
||||
|
||||
double phi = rand.nextFloat() * 2 * Math.PI;
|
||||
double r = 2.5;
|
||||
|
||||
double x = r * Math.sin(theta) * Math.cos(phi);
|
||||
|
||||
double y = r * Math.sin(theta) * Math.sin(phi);
|
||||
|
||||
double z = r * Math.cos(theta);
|
||||
|
||||
ThaumicTinkerer.tcProxy.wispFX2(
|
||||
target.worldObj,
|
||||
target.posX + x,
|
||||
target.posY + y + 1,
|
||||
target.posZ + z,
|
||||
.1F,
|
||||
4,
|
||||
true,
|
||||
true,
|
||||
1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target.worldObj.getTotalWorldTime() > firePotionHitClient.get(target) + 6000) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 388 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user