mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 06:53:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad16588e3b | ||
|
|
5acbd0b977 | ||
|
|
7e22128279 | ||
|
|
65e11fa564 | ||
|
|
355c85598e | ||
|
|
63232799bc | ||
|
|
a48f59e0ed | ||
|
|
84d462d8d5 | ||
|
|
b32f2a210c | ||
|
|
c988aa9870 | ||
|
|
6ba66123eb | ||
|
|
1d0568388a | ||
|
|
3968cc320e | ||
|
|
ed1daa1e96 | ||
|
|
ffcc5f7102 | ||
|
|
4c619fd3b2 | ||
|
|
341fea50ba | ||
|
|
e6c67df077 | ||
|
|
d24088ea4b | ||
|
|
a2a57d1656 | ||
|
|
2e36fbcfcc | ||
|
|
bd5bd5c153 | ||
|
|
f324cb53db | ||
|
|
c6815bebdf | ||
|
|
7ffa516892 | ||
|
|
311d618d53 | ||
|
|
9795aad66f | ||
|
|
ea7e2d7de4 | ||
|
|
39f86c8b0c | ||
|
|
5b551eb8ec | ||
|
|
f497114579 | ||
|
|
ea547df4d0 | ||
|
|
39c9f1f6c6 | ||
|
|
4000763323 | ||
|
|
59e98dd290 | ||
|
|
c1ec3e5c8e | ||
|
|
ac4b21b05e | ||
|
|
0e0ded5cc0 | ||
|
|
a1f54e7500 | ||
|
|
5f1b5daa24 |
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
|
||||||
+6
-6
@@ -1,12 +1,12 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:ForestryMC:4.10.0:dev')
|
api('com.github.GTNewHorizons:ForestryMC:4.11.12:dev')
|
||||||
implementation('com.github.GTNewHorizons:GTNHLib:0.6.0:dev')
|
implementation('com.github.GTNewHorizons:GTNHLib:0.9.48:dev')
|
||||||
|
|
||||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.8-GTNH:dev')
|
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.88-GTNH:dev')
|
||||||
|
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.57:api')
|
||||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||||
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
||||||
}
|
}
|
||||||
+38
-6
@@ -14,7 +14,7 @@ modId = BinnieCore
|
|||||||
modGroup = binnie
|
modGroup = binnie
|
||||||
|
|
||||||
# Whether to use modGroup as the maven publishing group.
|
# Whether to use modGroup as the maven publishing group.
|
||||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
# When false, com.github.GTNewHorizons is used.
|
||||||
useModGroupForPublishing = false
|
useModGroupForPublishing = false
|
||||||
|
|
||||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||||
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
|||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
developmentEnvironmentUserName = Developer
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
# Enables modern Java syntax support. Valid values:
|
||||||
# See https://github.com/bsideup/jabel for details on how this works.
|
# - false: No modern syntax, Java 8 only
|
||||||
enableModernJavaSyntax = true
|
# - 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.
|
# 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.
|
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||||
@@ -96,7 +120,9 @@ usesMixinDebug = false
|
|||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
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 =
|
mixinsPackage =
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# 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],
|
# type can be one of [project, version],
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
# 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
|
# 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 =
|
modrinthRelations =
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
# 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.
|
# projects. New projects should not use this parameter.
|
||||||
customArchiveBaseName = binnie-mods
|
customArchiveBaseName = binnie-mods
|
||||||
|
|
||||||
|
# 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.
|
# 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'.
|
# 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.
|
# 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
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (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.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -86,8 +86,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
' "$PWD" ) || exit
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -115,7 +114,6 @@ case "$( uname )" in #(
|
|||||||
NONSTOP* ) nonstop=true ;;
|
NONSTOP* ) nonstop=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -173,7 +171,6 @@ fi
|
|||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if "$cygwin" || "$msys" ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
@@ -206,15 +203,14 @@ fi
|
|||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command:
|
# Collect all arguments for the java command:
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# and any embedded shellness will be escaped.
|
# and any embedded shellness will be escaped.
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# treated as '${Hostname}' itself on the command line.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
-classpath "$CLASSPATH" \
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
# Stop when "xargs" is not available.
|
# Stop when "xargs" is not available.
|
||||||
|
|||||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
|||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|||||||
+1
-1
@@ -17,5 +17,5 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import binnie.core.ManagerBase;
|
import binnie.core.ManagerBase;
|
||||||
import binnie.core.genetics.ManagerGenetics;
|
import binnie.core.genetics.ManagerGenetics;
|
||||||
import binnie.core.item.ManagerItem;
|
|
||||||
import binnie.core.liquid.ManagerLiquid;
|
import binnie.core.liquid.ManagerLiquid;
|
||||||
import binnie.core.machines.ManagerMachine;
|
import binnie.core.machines.ManagerMachine;
|
||||||
import binnie.core.resource.ManagerResource;
|
import binnie.core.resource.ManagerResource;
|
||||||
@@ -16,6 +15,5 @@ public final class Binnie {
|
|||||||
public static ManagerGenetics Genetics = new ManagerGenetics();
|
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||||
public static ManagerLiquid Liquid = new ManagerLiquid();
|
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||||
public static ManagerMachine Machine = new ManagerMachine();
|
public static ManagerMachine Machine = new ManagerMachine();
|
||||||
public static ManagerItem Item = new ManagerItem();
|
|
||||||
public static ManagerResource Resource = new ManagerResource();
|
public static ManagerResource Resource = new ManagerResource();
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
@@ -63,35 +64,41 @@ public class Botany extends AbstractMod {
|
|||||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||||
public static Proxy proxy;
|
public static Proxy proxy;
|
||||||
|
|
||||||
|
// Genetics module
|
||||||
public static BlockFlower flower;
|
public static BlockFlower flower;
|
||||||
public static Item seed;
|
|
||||||
|
public static ItemFlower flowerItem;
|
||||||
public static Item pollen;
|
public static Item pollen;
|
||||||
|
public static Item seed;
|
||||||
public static ItemDictionary database;
|
public static ItemDictionary database;
|
||||||
|
|
||||||
|
// Gardening module
|
||||||
public static BlockPlant plant;
|
public static BlockPlant plant;
|
||||||
public static ItemTrowel trowelWood;
|
|
||||||
public static ItemTrowel trowelStone;
|
|
||||||
public static ItemTrowel trowelIron;
|
|
||||||
public static ItemTrowel trowelDiamond;
|
|
||||||
public static ItemTrowel trowelGold;
|
|
||||||
public static BlockSoil soil;
|
public static BlockSoil soil;
|
||||||
public static BlockSoil loam;
|
public static BlockSoil loam;
|
||||||
public static BlockSoil flowerbed;
|
public static BlockSoil flowerbed;
|
||||||
public static BlockSoil soilNoWeed;
|
public static BlockSoil soilNoWeed;
|
||||||
public static BlockSoil loamNoWeed;
|
public static BlockSoil loamNoWeed;
|
||||||
public static BlockSoil flowerbedNoWeed;
|
public static BlockSoil flowerbedNoWeed;
|
||||||
public static ItemInsulatedTube insulatedTube;
|
public static BlockCeramic ceramic;
|
||||||
|
public static BlockStained stained;
|
||||||
|
public static BlockCeramicPatterned ceramicTile;
|
||||||
|
public static BlockCeramicBrick ceramicBrick;
|
||||||
|
|
||||||
public static ItemSoilMeter soilMeter;
|
public static ItemSoilMeter soilMeter;
|
||||||
|
public static ItemInsulatedTube insulatedTube;
|
||||||
|
public static ItemTrowel trowelWood;
|
||||||
|
public static ItemTrowel trowelStone;
|
||||||
|
public static ItemTrowel trowelIron;
|
||||||
|
public static ItemTrowel trowelDiamond;
|
||||||
|
public static ItemTrowel trowelGold;
|
||||||
public static ItemMisc misc;
|
public static ItemMisc misc;
|
||||||
public static ItemFlower flowerItem;
|
|
||||||
public static ItemPigment pigment;
|
public static ItemPigment pigment;
|
||||||
public static ItemClay clay;
|
public static ItemClay clay;
|
||||||
public static BlockCeramic ceramic;
|
|
||||||
public static BlockCeramicPatterned ceramicTile;
|
|
||||||
public static BlockStained stained;
|
|
||||||
public static BlockCeramicBrick ceramicBrick;
|
|
||||||
|
|
||||||
public Botany() {
|
public Botany() {
|
||||||
Botany.instance = this;
|
Botany.instance = this;
|
||||||
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
@@ -142,118 +149,6 @@ public class Botany extends AbstractMod {
|
|||||||
return PacketHandler.class;
|
return PacketHandler.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onShearFlower(PlayerInteractEvent event) {
|
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
|
|
||||||
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
|
||||||
if (tile instanceof TileEntityFlower tileFlower) {
|
|
||||||
tileFlower.onShear();
|
|
||||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
|
|
||||||
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
|
||||||
if (tile instanceof TileEntityFlower tileFlower) {
|
|
||||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
|
||||||
if (pollen != null && tileFlower.canMateWith(pollen)) {
|
|
||||||
tileFlower.mateWith(pollen);
|
|
||||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
|
||||||
heldItem.stackSize--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onFertiliseSoil(PlayerInteractEvent event) {
|
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int y = event.y;
|
|
||||||
Block block = event.world.getBlock(event.x, y, event.z);
|
|
||||||
if (!Gardening.isSoil(block)) {
|
|
||||||
block = event.world.getBlock(event.x, --y, event.z);
|
|
||||||
}
|
|
||||||
if (!Gardening.isSoil(block)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IBlockSoil soil = (IBlockSoil) block;
|
|
||||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem())
|
|
||||||
&& soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
|
||||||
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
|
||||||
int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
|
||||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next])
|
|
||||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
|
||||||
heldItem.stackSize--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem())
|
|
||||||
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
|
||||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
|
||||||
int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
|
||||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
|
||||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
|
||||||
heldItem2.stackSize--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem())
|
|
||||||
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
|
||||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
|
||||||
int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
|
||||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
|
||||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
|
||||||
heldItem3.stackSize--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem())
|
|
||||||
&& Gardening.addWeedKiller(event.world, event.x, y, event.z)
|
|
||||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
|
||||||
heldItem4.stackSize--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
|
||||||
World world = event.world;
|
|
||||||
int x = event.x;
|
|
||||||
int y = event.y;
|
|
||||||
int z = event.z;
|
|
||||||
Block block = world.getBlock(x, y - 1, z);
|
|
||||||
if (!(block instanceof IBlockSoil)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
|
||||||
if (flower != null) {
|
|
||||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void onPlantVanilla(PlayerInteractEvent event) {
|
public void onPlantVanilla(PlayerInteractEvent event) {
|
||||||
if (!BinnieCore.proxy.isSimulating(event.world)
|
if (!BinnieCore.proxy.isSimulating(event.world)
|
||||||
@@ -287,22 +182,6 @@ public class Botany extends AbstractMod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onBonemeal(BonemealEvent event) {
|
|
||||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
|
||||||
if (Gardening.isSoil(block)) {
|
|
||||||
IBlockSoil soil = (IBlockSoil) block;
|
|
||||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
|
||||||
event.setResult(Event.Result.ALLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
|
||||||
event.setResult(Event.Result.ALLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onIMC(FMLInterModComms.IMCEvent event) {
|
public void onIMC(FMLInterModComms.IMCEvent event) {
|
||||||
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||||
@@ -333,4 +212,138 @@ public class Botany extends AbstractMod {
|
|||||||
super(Botany.instance);
|
super(Botany.instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class EventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onShearFlower(PlayerInteractEvent event) {
|
||||||
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
|
||||||
|
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
||||||
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
|
if (tile instanceof TileEntityFlower tileFlower) {
|
||||||
|
tileFlower.onShear();
|
||||||
|
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
|
||||||
|
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
||||||
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
|
if (tile instanceof TileEntityFlower tileFlower) {
|
||||||
|
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||||
|
if (pollen != null && tileFlower.canMateWith(pollen)) {
|
||||||
|
tileFlower.mateWith(pollen);
|
||||||
|
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem.stackSize--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onFertiliseSoil(PlayerInteractEvent event) {
|
||||||
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int y = event.y;
|
||||||
|
Block block = event.world.getBlock(event.x, y, event.z);
|
||||||
|
if (!Gardening.isSoil(block)) {
|
||||||
|
block = event.world.getBlock(event.x, --y, event.z);
|
||||||
|
}
|
||||||
|
if (!Gardening.isSoil(block)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
|
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem())
|
||||||
|
&& soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||||
|
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||||
|
int next = Math
|
||||||
|
.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||||
|
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.VALUES[next])
|
||||||
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem.stackSize--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem())
|
||||||
|
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
||||||
|
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||||
|
int next = Math
|
||||||
|
.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||||
|
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.VALUES[next])
|
||||||
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem2.stackSize--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem())
|
||||||
|
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
||||||
|
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||||
|
int next = Math
|
||||||
|
.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||||
|
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.VALUES[next])
|
||||||
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem3.stackSize--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem())
|
||||||
|
&& Gardening.addWeedKiller(event.world, event.x, y, event.z)
|
||||||
|
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem4.stackSize--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
||||||
|
World world = event.world;
|
||||||
|
int x = event.x;
|
||||||
|
int y = event.y;
|
||||||
|
int z = event.z;
|
||||||
|
Block block = world.getBlock(x, y - 1, z);
|
||||||
|
if (!(block instanceof IBlockSoil)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||||
|
if (flower != null) {
|
||||||
|
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onBonemeal(BonemealEvent event) {
|
||||||
|
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||||
|
if (Gardening.isSoil(block)) {
|
||||||
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
|
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,11 @@ public enum EnumAcidity {
|
|||||||
NEUTRAL,
|
NEUTRAL,
|
||||||
ALKALINE;
|
ALKALINE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumAcidity[] VALUES = values();
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ public enum EnumFlowerChromosome implements IChromosomeType {
|
|||||||
SAPPINESS(IAlleleFloat.class),
|
SAPPINESS(IAlleleFloat.class),
|
||||||
STEM(IAlleleInteger.class);
|
STEM(IAlleleInteger.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumFlowerChromosome[] VALUES = values();
|
||||||
private final Class<? extends IAllele> cls;
|
private final Class<? extends IAllele> cls;
|
||||||
|
|
||||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ public enum EnumMoisture {
|
|||||||
NORMAL,
|
NORMAL,
|
||||||
DAMP;
|
DAMP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumMoisture[] VALUES = values();
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ public enum EnumSoilType {
|
|||||||
LOAM,
|
LOAM,
|
||||||
FLOWERBED;
|
FLOWERBED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumSoilType[] VALUES = values();
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemList) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,12 +102,12 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
BlockType type = new BlockType(c, c, TileType.Tile);
|
BlockType type = new BlockType(c, c, TileType.Tile);
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TileType type2 : TileType.values()) {
|
for (TileType type2 : TileType.VALUES) {
|
||||||
if (type2.canDouble()) {
|
if (type2.canDouble()) {
|
||||||
itemList.add(new BlockType(EnumFlowerColor.BROWN, EnumFlowerColor.GOLD, type2).getStack(1));
|
itemList.add(new BlockType(EnumFlowerColor.BROWN, EnumFlowerColor.GOLD, type2).getStack(1));
|
||||||
}
|
}
|
||||||
@@ -130,13 +130,13 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
return TileType.get(meta >>> 16 & 0xFF).icons[MultipassBlockRenderer.getLayer()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (TileType type : TileType.values()) {
|
for (TileType type : TileType.VALUES) {
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||||
}
|
}
|
||||||
@@ -167,6 +167,9 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(int meta) {
|
public int getRenderColor(int meta) {
|
||||||
|
if (!MultipassBlockRenderer.isRendering()) {
|
||||||
|
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
||||||
|
}
|
||||||
return colorMultiplier(meta);
|
return colorMultiplier(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,14 +180,14 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int colorMultiplier(int meta) {
|
public int colorMultiplier(int meta) {
|
||||||
BlockType type = getType(meta);
|
int layer = MultipassBlockRenderer.getLayer();
|
||||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
if (layer == 0) {
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
if (layer == 1) {
|
||||||
return type.color1.getColor(false);
|
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
||||||
}
|
}
|
||||||
return type.color2.getColor(false);
|
return EnumFlowerColor.get(meta >>> 8 & 0xFF).getColor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -205,6 +208,10 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
|
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
|
||||||
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
|
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final TileType[] VALUES = values();
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final IIcon[] icons;
|
private final IIcon[] icons;
|
||||||
@@ -216,7 +223,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TileType get(int id) {
|
public static TileType get(int id) {
|
||||||
return values()[id % values().length];
|
return VALUES[id % VALUES.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDouble() {
|
public boolean canDouble() {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class BlockStained extends Block implements IBlockMetadata {
|
|||||||
|
|
||||||
public BlockStained() {
|
public BlockStained() {
|
||||||
super(Material.glass);
|
super(Material.glass);
|
||||||
|
setHardness(0.3f);
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setBlockName("stained");
|
setBlockName("stained");
|
||||||
}
|
}
|
||||||
@@ -123,7 +124,7 @@ public class BlockStained extends Block implements IBlockMetadata {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class CeramicColor implements IDesignMaterial {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
CeramicColor.map = new LinkedHashMap<>();
|
CeramicColor.map = new LinkedHashMap<>();
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
CeramicColor.map.put(c, new CeramicColor(c));
|
CeramicColor.map.put(c, new CeramicColor(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class CeramicDesignSystem implements IDesignSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
for (EnumPattern pattern : EnumPattern.values()) {
|
for (EnumPattern pattern : EnumPattern.VALUES) {
|
||||||
primary.put(
|
primary.put(
|
||||||
pattern.ordinal(),
|
pattern.ordinal(),
|
||||||
BinnieCore.proxy.getIcon(
|
BinnieCore.proxy.getIcon(
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class CeramicTileRecipe implements IRecipe {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.VALUES) {
|
||||||
ItemStack stack2 = type.getRecipe(stacks);
|
ItemStack stack2 = type.getRecipe(stacks);
|
||||||
if (stack2 != null) {
|
if (stack2 != null) {
|
||||||
return stack2;
|
return stack2;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
List<IFlowerColor> colors = new ArrayList<>();
|
List<IFlowerColor> colors = new ArrayList<>();
|
||||||
Collections.addAll(colors, EnumFlowerColor.values());
|
Collections.addAll(colors, EnumFlowerColor.VALUES);
|
||||||
listBox.setOptions(colors);
|
listBox.setOptions(colors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class GardenLogic extends FarmLogic {
|
|||||||
if (pH.ordinal() < acidity.ordinal()) {
|
if (pH.ordinal() < acidity.ordinal()) {
|
||||||
ItemStack stack = getAvailableAlkaline();
|
ItemStack stack = getAvailableAlkaline();
|
||||||
if (stack != null && soil
|
if (stack != null && soil
|
||||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() + 1])) {
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public class GardenLogic extends FarmLogic {
|
|||||||
if (pH.ordinal() > acidity.ordinal()) {
|
if (pH.ordinal() > acidity.ordinal()) {
|
||||||
ItemStack stack = getAvailableAcid();
|
ItemStack stack = getAvailableAcid();
|
||||||
if (stack != null && soil
|
if (stack != null && soil
|
||||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() - 1])) {
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class BlockFlower extends BlockContainer {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (EnumFlowerType type : EnumFlowerType.values()) {
|
for (EnumFlowerType type : EnumFlowerType.VALUES) {
|
||||||
type.registerIcons(register);
|
type.registerIcons(register);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -39,6 +41,8 @@ public abstract class ItemBotany extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName(name);
|
setUnlocalizedName(name);
|
||||||
hasSubtypes = true;
|
hasSubtypes = true;
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -25,6 +27,8 @@ public class ItemInsulatedTube extends Item {
|
|||||||
setUnlocalizedName("insulatedTube");
|
setUnlocalizedName("insulatedTube");
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
for (EnumMoisture moisture : EnumMoisture.VALUES) {
|
||||||
for (EnumAcidity pH : EnumAcidity.values()) {
|
for (EnumAcidity pH : EnumAcidity.VALUES) {
|
||||||
int index = moisture.ordinal() + pH.ordinal() * 3;
|
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||||
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||||
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||||
@@ -104,8 +104,8 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
@Override
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
EnumMoisture moisture = EnumMoisture.VALUES[meta % 3];
|
||||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
EnumAcidity acidity = EnumAcidity.VALUES[meta / 3];
|
||||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||||
@@ -141,12 +141,12 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumAcidity getPH(World world, int x, int y, int z) {
|
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
return EnumAcidity.VALUES[world.getBlockMetadata(x, y, z) / 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
return EnumMoisture.VALUES[world.getBlockMetadata(x, y, z) % 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -233,8 +233,8 @@ public class Gardening {
|
|||||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||||
return canTolerate(
|
return canTolerate(
|
||||||
flower,
|
flower,
|
||||||
EnumAcidity.values()[soilMeta / 3 % 3],
|
EnumAcidity.VALUES[soilMeta / 3 % 3],
|
||||||
EnumMoisture.values()[soilMeta % 3],
|
EnumMoisture.VALUES[soilMeta % 3],
|
||||||
EnumTemperature.getFromValue(biome.temperature));
|
EnumTemperature.getFromValue(biome.temperature));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public class ItemSoil extends ItemBlock {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
EnumMoisture moisture = EnumMoisture.VALUES[stack.getItemDamage() % 3];
|
||||||
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
EnumAcidity acidity = EnumAcidity.VALUES[stack.getItemDamage() / 3];
|
||||||
String info = "";
|
String info = "";
|
||||||
|
|
||||||
if (moisture == EnumMoisture.DRY) {
|
if (moisture == EnumMoisture.DRY) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -28,6 +30,8 @@ public class ItemSoilMeter extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName("soilMeter");
|
setUnlocalizedName("soilMeter");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -28,6 +30,8 @@ public class ItemTrowel extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName("trowel" + material);
|
setUnlocalizedName("trowel" + material);
|
||||||
locName = "trowel" + material;
|
locName = "trowel" + material;
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import net.minecraftforge.oredict.RecipeSorter;
|
|||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
@@ -37,6 +36,7 @@ import binnie.core.block.ItemMetadata;
|
|||||||
import binnie.core.block.ItemMetadataRenderer;
|
import binnie.core.block.ItemMetadataRenderer;
|
||||||
import binnie.core.block.MultipassItemRenderer;
|
import binnie.core.block.MultipassItemRenderer;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.item.ItemMisc;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class ModuleGardening implements IInitializable {
|
public class ModuleGardening implements IInitializable {
|
||||||
@@ -75,7 +75,7 @@ public class ModuleGardening implements IInitializable {
|
|||||||
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
||||||
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
||||||
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
||||||
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
Botany.misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values());
|
||||||
Botany.pigment = new ItemPigment();
|
Botany.pigment = new ItemPigment();
|
||||||
Botany.clay = new ItemClay();
|
Botany.clay = new ItemClay();
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class ModuleGardening implements IInitializable {
|
|||||||
|
|
||||||
for (boolean manual : new boolean[] { true, false }) {
|
for (boolean manual : new boolean[] { true, false }) {
|
||||||
for (boolean fertilised : new boolean[] { true, false }) {
|
for (boolean fertilised : new boolean[] { true, false }) {
|
||||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
for (EnumMoisture moist : EnumMoisture.VALUES) {
|
||||||
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow
|
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow
|
||||||
: ((moist == EnumMoisture.NORMAL) ? red : blue);
|
: ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||||
int insulate = 2 - moist.ordinal();
|
int insulate = 2 - moist.ordinal();
|
||||||
@@ -258,7 +258,7 @@ public class ModuleGardening implements IInitializable {
|
|||||||
GameRegistry
|
GameRegistry
|
||||||
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
||||||
|
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||||
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||||
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||||
@@ -276,9 +276,9 @@ public class ModuleGardening implements IInitializable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new ItemStack(
|
return new ItemStack(
|
||||||
Gardening.getSoilBlock(EnumSoilType.values()[type]),
|
Gardening.getSoilBlock(EnumSoilType.VALUES[type]),
|
||||||
1,
|
1,
|
||||||
BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
BlockSoil.getMeta(EnumAcidity.VALUES[pH], EnumMoisture.VALUES[moisture]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||||
|
|||||||
@@ -92,7 +92,10 @@ public enum EnumFlowerColor implements IFlowerColor {
|
|||||||
YELLOW("yellow", 0xffff00),
|
YELLOW("yellow", 0xffff00),
|
||||||
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
||||||
|
|
||||||
private static final EnumFlowerColor[] ALL_VALUES = values();
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumFlowerColor[] VALUES = values();
|
||||||
private final int color;
|
private final int color;
|
||||||
private final int colorDis;
|
private final int colorDis;
|
||||||
private final String name;
|
private final String name;
|
||||||
@@ -2964,7 +2967,7 @@ public enum EnumFlowerColor implements IFlowerColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumFlowerColor get(int i) {
|
public static EnumFlowerColor get(int i) {
|
||||||
return ALL_VALUES[Math.max(0, i) % ALL_VALUES.length];
|
return VALUES[Math.max(0, i) % VALUES.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ public enum EnumFlowerType implements IFlowerType {
|
|||||||
DELPHINIUM(2),
|
DELPHINIUM(2),
|
||||||
HOLLYHOCK(2);
|
HOLLYHOCK(2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumFlowerType[] VALUES = values();
|
||||||
private final int sections;
|
private final int sections;
|
||||||
private final IIcon[] stem;
|
private final IIcon[] stem;
|
||||||
private final IIcon[] petal;
|
private final IIcon[] petal;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChromosomeType[] getKaryotype() {
|
public IChromosomeType[] getKaryotype() {
|
||||||
return EnumFlowerChromosome.values();
|
return EnumFlowerChromosome.VALUES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumHumidity getHumidity() {
|
public EnumHumidity getHumidity() {
|
||||||
return EnumHumidity.values()[getMoisture().ordinal()];
|
return EnumHumidity.VALUES[getMoisture().ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import forestry.core.genetics.alleles.EnumAllele;
|
|||||||
public class FlowerTemplates {
|
public class FlowerTemplates {
|
||||||
|
|
||||||
public static IAllele[] getDefaultTemplate() {
|
public static IAllele[] getDefaultTemplate() {
|
||||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
IAllele[] alleles = new IAllele[EnumFlowerChromosome.VALUES.length];
|
||||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -25,6 +27,8 @@ public class ItemDictionary extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName("database");
|
setUnlocalizedName("database");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ModuleGenetics implements IInitializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
for (EnumFlowerColor color : EnumFlowerColor.VALUES) {
|
||||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -22,6 +24,8 @@ public class ItemClay extends Item {
|
|||||||
setUnlocalizedName("clay");
|
setUnlocalizedName("clay");
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +49,7 @@ public class ItemClay extends Item {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -22,6 +24,8 @@ public class ItemPigment extends Item {
|
|||||||
setUnlocalizedName("pigment");
|
setUnlocalizedName("pigment");
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +49,7 @@ public class ItemPigment extends Item {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ public class MessageFlowerUpdate extends MessageCoordinates {
|
|||||||
public void readData(ByteBuf data) throws IOException {
|
public void readData(ByteBuf data) throws IOException {
|
||||||
super.readData(data);
|
super.readData(data);
|
||||||
render = new TileEntityFlower.RenderInfo();
|
render = new TileEntityFlower.RenderInfo();
|
||||||
render.primary = EnumFlowerColor.values()[data.readByte()];
|
render.primary = EnumFlowerColor.get(data.readByte());
|
||||||
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
render.secondary = EnumFlowerColor.get(data.readByte());
|
||||||
render.stem = EnumFlowerColor.values()[data.readByte()];
|
render.stem = EnumFlowerColor.get(data.readByte());
|
||||||
render.type = EnumFlowerType.values()[data.readByte()];
|
render.type = EnumFlowerType.VALUES[data.readByte()];
|
||||||
render.age = data.readByte();
|
render.age = data.readByte();
|
||||||
render.section = data.readByte();
|
render.section = data.readByte();
|
||||||
render.wilted = data.readBoolean();
|
render.wilted = data.readBoolean();
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
package binnie.core;
|
package binnie.core;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
|
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
import binnie.core.mod.parser.FieldParser;
|
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
import binnie.core.network.IPacketID;
|
import binnie.core.network.IPacketID;
|
||||||
import binnie.core.network.IPacketProvider;
|
import binnie.core.network.IPacketProvider;
|
||||||
@@ -22,14 +16,11 @@ import cpw.mods.fml.relauncher.Side;
|
|||||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||||
|
|
||||||
private SimpleNetworkWrapper wrapper;
|
private SimpleNetworkWrapper wrapper;
|
||||||
private final LinkedHashSet<Field> fields;
|
|
||||||
protected final List<IInitializable> modules;
|
protected final List<IInitializable> modules;
|
||||||
|
|
||||||
public AbstractMod() {
|
public AbstractMod() {
|
||||||
fields = new LinkedHashSet<>();
|
|
||||||
modules = new ArrayList<>();
|
modules = new ArrayList<>();
|
||||||
BinnieCore.registerMod(this);
|
BinnieCore.registerMod(this);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
@@ -68,22 +59,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.preInit();
|
module.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO what does it mean?
|
|
||||||
Collections.addAll(fields, getClass().getFields());
|
|
||||||
for (Class<?> cls : getClass().getClasses()) {
|
|
||||||
Collections.addAll(fields, getClass().getFields());
|
|
||||||
}
|
|
||||||
for (IInitializable module : modules) {
|
|
||||||
Collections.addAll(fields, module.getClass().getFields());
|
|
||||||
}
|
|
||||||
for (Field field4 : fields) {
|
|
||||||
try {
|
|
||||||
FieldParser.preInitParse(field4, this);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,14 +74,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.init();
|
module.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Field field : fields) {
|
|
||||||
try {
|
|
||||||
FieldParser.initParse(field, this);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -119,18 +86,10 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.postInit();
|
module.postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Field field : fields) {
|
|
||||||
try {
|
|
||||||
FieldParser.postInitParse(field, this);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addModule(IInitializable init) {
|
protected void addModule(IInitializable init) {
|
||||||
modules.add(init);
|
modules.add(init);
|
||||||
MinecraftForge.EVENT_BUS.register(init);
|
init.registerEventHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.core.block.MultipassBlockRenderer;
|
import binnie.core.block.MultipassBlockRenderer;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.config.BCConfig;
|
||||||
import binnie.core.craftgui.minecraft.ModuleCraftGUI;
|
import binnie.core.craftgui.minecraft.ModuleCraftGUI;
|
||||||
import binnie.core.gui.BinnieCoreGUI;
|
import binnie.core.gui.BinnieCoreGUI;
|
||||||
import binnie.core.gui.BinnieGUIHandler;
|
import binnie.core.gui.BinnieGUIHandler;
|
||||||
@@ -22,8 +23,6 @@ import binnie.core.liquid.FluidContainer;
|
|||||||
import binnie.core.liquid.ItemFluidContainer;
|
import binnie.core.liquid.ItemFluidContainer;
|
||||||
import binnie.core.machines.MachineGroup;
|
import binnie.core.machines.MachineGroup;
|
||||||
import binnie.core.machines.storage.ModuleStorage;
|
import binnie.core.machines.storage.ModuleStorage;
|
||||||
import binnie.core.mod.parser.FieldParser;
|
|
||||||
import binnie.core.mod.parser.ItemParser;
|
|
||||||
import binnie.core.network.BinnieCorePacketID;
|
import binnie.core.network.BinnieCorePacketID;
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
import binnie.core.network.IPacketID;
|
import binnie.core.network.IPacketID;
|
||||||
@@ -69,6 +68,10 @@ public class BinnieCore extends AbstractMod {
|
|||||||
public static ItemGenesis genesis;
|
public static ItemGenesis genesis;
|
||||||
public static ItemFieldKit fieldKit;
|
public static ItemFieldKit fieldKit;
|
||||||
|
|
||||||
|
public BinnieCore() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
for (ManagerBase baseManager : Binnie.Managers) {
|
for (ManagerBase baseManager : Binnie.Managers) {
|
||||||
@@ -76,7 +79,9 @@ public class BinnieCore extends AbstractMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addModule(new ModuleCraftGUI());
|
addModule(new ModuleCraftGUI());
|
||||||
addModule(new ModuleStorage());
|
if (!BCConfig.disableCompartments) {
|
||||||
|
addModule(new ModuleStorage());
|
||||||
|
}
|
||||||
addModule(new ModuleItems());
|
addModule(new ModuleItems());
|
||||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||||
addModule(new ModuleTrigger());
|
addModule(new ModuleTrigger());
|
||||||
@@ -106,7 +111,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
Item item = new ItemFluidContainer(container);
|
Item item = new ItemFluidContainer(container);
|
||||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
FieldParser.parsers.add(new ItemParser());
|
|
||||||
super.preInit();
|
super.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,23 +165,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) {
|
|
||||||
try {
|
|
||||||
EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager()
|
|
||||||
.func_152612_a(event.username.getName());
|
|
||||||
if (player == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.tracker.synchToPlayer(player);
|
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
|
||||||
nbt.setString("species", event.species.getUID());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChannel() {
|
public String getChannel() {
|
||||||
return "BIN";
|
return "BIN";
|
||||||
@@ -198,15 +185,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
return BinnieCorePacketID.values();
|
return BinnieCorePacketID.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
|
||||||
if (event.map.getTextureType() == 0) {
|
|
||||||
Binnie.Liquid.reloadIcons(event.map);
|
|
||||||
}
|
|
||||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||||
return PacketHandler.class;
|
return PacketHandler.class;
|
||||||
@@ -223,4 +201,31 @@ public class BinnieCore extends AbstractMod {
|
|||||||
super(instance);
|
super(instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class EventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) {
|
||||||
|
try {
|
||||||
|
EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager()
|
||||||
|
.func_152612_a(event.username.getName());
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.tracker.synchToPlayer(player);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
||||||
|
if (event.map.getTextureType() == 0) {
|
||||||
|
Binnie.Liquid.reloadIcons(event.map);
|
||||||
|
}
|
||||||
|
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,4 +7,6 @@ public interface IInitializable {
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
void postInit();
|
void postInit();
|
||||||
|
|
||||||
|
default void registerEventHandler() {}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
|||||||
|
|
||||||
public static MultipassBlockRenderer instance;
|
public static MultipassBlockRenderer instance;
|
||||||
private static int layer = 0;
|
private static int layer = 0;
|
||||||
|
private static boolean rendering = false;
|
||||||
|
|
||||||
public MultipassBlockRenderer() {
|
public MultipassBlockRenderer() {
|
||||||
MultipassBlockRenderer.instance = this;
|
MultipassBlockRenderer.instance = this;
|
||||||
@@ -23,31 +24,49 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
|||||||
return MultipassBlockRenderer.layer;
|
return MultipassBlockRenderer.layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isRendering() {
|
||||||
|
return MultipassBlockRenderer.rendering;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||||
|
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
||||||
|
int passes = multipassBlock.getNumberOfPasses();
|
||||||
|
|
||||||
block.setBlockBoundsForItemRender();
|
block.setBlockBoundsForItemRender();
|
||||||
renderer.setRenderBoundsFromBlock(block);
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||||
|
|
||||||
MultipassBlockRenderer.layer = 0;
|
MultipassBlockRenderer.rendering = true;
|
||||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
try {
|
||||||
renderItem(block, renderer, meta);
|
for (int pass = 0; pass < passes; ++pass) {
|
||||||
MultipassBlockRenderer.layer++;
|
MultipassBlockRenderer.layer = pass;
|
||||||
|
renderItem(block, multipassBlock, renderer, meta);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
MultipassBlockRenderer.layer = 0;
|
||||||
|
MultipassBlockRenderer.rendering = false;
|
||||||
}
|
}
|
||||||
MultipassBlockRenderer.layer = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||||
RenderBlocks renderer) {
|
RenderBlocks renderer) {
|
||||||
boolean r = true;
|
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
||||||
MultipassBlockRenderer.layer = 0;
|
int passes = multipassBlock.getNumberOfPasses();
|
||||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
boolean rendered = true;
|
||||||
r = renderer.renderStandardBlock(block, x, y, z);
|
|
||||||
MultipassBlockRenderer.layer++;
|
MultipassBlockRenderer.rendering = true;
|
||||||
|
try {
|
||||||
|
for (int pass = 0; pass < passes; ++pass) {
|
||||||
|
MultipassBlockRenderer.layer = pass;
|
||||||
|
rendered = renderer.renderStandardBlock(block, x, y, z);
|
||||||
|
}
|
||||||
|
return rendered;
|
||||||
|
} finally {
|
||||||
|
MultipassBlockRenderer.layer = 0;
|
||||||
|
MultipassBlockRenderer.rendering = false;
|
||||||
}
|
}
|
||||||
MultipassBlockRenderer.layer = 0;
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -60,8 +79,8 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
|||||||
return BinnieCore.multipassRenderID;
|
return BinnieCore.multipassRenderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderItem(Block block, RenderBlocks renderer, int meta) {
|
private void renderItem(Block block, IMultipassBlock multipassBlock, RenderBlocks renderer, int meta) {
|
||||||
setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
setColor(multipassBlock.colorMultiplier(meta));
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||||
|
|||||||
@@ -76,12 +76,14 @@ public class TileEntityMetadata extends TileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getItemStack(Block block, int damage) {
|
public static ItemStack getItemStack(Block block, int damage) {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
|
||||||
tag.setInteger("meta", damage);
|
|
||||||
|
|
||||||
ItemStack item = new ItemStack(block, 1, 0);
|
ItemStack item = new ItemStack(block, 1, 0);
|
||||||
item.setItemDamage(Math.min(damage, 16387));
|
if (0 <= damage && damage < Short.MAX_VALUE) {
|
||||||
item.setTagCompound(tag);
|
item.setItemDamage(damage);
|
||||||
|
} else {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
tag.setInteger("meta", damage);
|
||||||
|
item.setTagCompound(tag);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package binnie.core.config;
|
||||||
|
|
||||||
|
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||||
|
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
|
||||||
|
@Config(modid = BinnieCore.CORE_MODID)
|
||||||
|
public class BCConfig {
|
||||||
|
|
||||||
|
@Config.Comment("If true, disables all compartment storage machines (no blocks/recipes will be registered).")
|
||||||
|
@Config.DefaultBoolean(false)
|
||||||
|
@Config.RequiresMcRestart
|
||||||
|
public static boolean disableCompartments;
|
||||||
|
}
|
||||||
@@ -91,7 +91,7 @@ public interface IWidget {
|
|||||||
|
|
||||||
void callEvent(Event event);
|
void callEvent(Event event);
|
||||||
|
|
||||||
void recieveEvent(Event event);
|
void receiveEvent(Event event);
|
||||||
|
|
||||||
void onUpdateClient();
|
void onUpdateClient();
|
||||||
|
|
||||||
|
|||||||
@@ -235,11 +235,11 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callEvent(Event event) {
|
public void callEvent(Event event) {
|
||||||
getSuperParent().recieveEvent(event);
|
getSuperParent().receiveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveEvent(Event event) {
|
public void receiveEvent(Event event) {
|
||||||
for (EventHandler handler : globalEventHandlers) {
|
for (EventHandler handler : globalEventHandlers) {
|
||||||
if (handler.handles(event)) {
|
if (handler.handles(event)) {
|
||||||
handler.onEvent(event);
|
handler.onEvent(event);
|
||||||
@@ -248,7 +248,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (IWidget child : getWidgets()) {
|
for (IWidget child : getWidgets()) {
|
||||||
child.recieveEvent(event);
|
child.receiveEvent(event);
|
||||||
}
|
}
|
||||||
} catch (ConcurrentModificationException e) {
|
} catch (ConcurrentModificationException e) {
|
||||||
// ignored
|
// ignored
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.minecraft.init.Items;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
@@ -33,6 +34,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
|||||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||||
import binnie.core.machines.inventory.SlotValidator;
|
import binnie.core.machines.inventory.SlotValidator;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import binnie.extrabees.core.ExtraBeeTexture;
|
import binnie.extrabees.core.ExtraBeeTexture;
|
||||||
import binnie.extrabees.gui.ExtraBeeGUITexture;
|
import binnie.extrabees.gui.ExtraBeeGUITexture;
|
||||||
@@ -113,20 +115,26 @@ public class WindowFieldKit extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
|
final NBTTagList actions = new NBTTagList();
|
||||||
|
|
||||||
setTitle(getName());
|
setTitle(getName());
|
||||||
CraftGUI.render.stylesheet(new StyleSheetPunnett());
|
CraftGUI.render.stylesheet(new StyleSheetPunnett());
|
||||||
getWindowInventory().createSlot(0);
|
getWindowInventory().createSlot(0);
|
||||||
getWindowInventory().createSlot(1);
|
getWindowInventory().createSlot(1);
|
||||||
setupValidators();
|
setupValidators();
|
||||||
new ControlPlayerInventory(this);
|
new ControlPlayerInventory(this).create(actions);
|
||||||
IPoint handGlass = new IPoint(16.0f, 32.0f);
|
IPoint handGlass = new IPoint(16.0f, 32.0f);
|
||||||
GlassControl = new ControlImage(
|
GlassControl = new ControlImage(
|
||||||
this,
|
this,
|
||||||
handGlass.x(),
|
handGlass.x(),
|
||||||
handGlass.y(),
|
handGlass.y(),
|
||||||
new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett));
|
new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett));
|
||||||
new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(InventoryType.Window, 0);
|
|
||||||
new ControlSlot(this, 208.0f, 8.0f).assign(InventoryType.Window, 1);
|
new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(actions, InventoryType.Window, 0);
|
||||||
|
new ControlSlot(this, 208.0f, 8.0f).assign(actions, InventoryType.Window, 1);
|
||||||
|
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
|
|
||||||
(text = new ControlText(this, new IPoint(232.0f, 13.0f), I18N.localise("binniecore.gui.tooltip.paper")))
|
(text = new ControlText(this, new IPoint(232.0f, 13.0f), I18N.localise("binniecore.gui.tooltip.paper")))
|
||||||
.setColor(0x222222);
|
.setColor(0x222222);
|
||||||
(text = new ControlText(this, new IArea(0.0f, 120.0f, w(), 24.0f), "", TextJustification.MIDDLE_CENTER))
|
(text = new ControlText(this, new IArea(0.0f, 120.0f, w(), 24.0f), "", TextJustification.MIDDLE_CENTER))
|
||||||
@@ -285,8 +293,8 @@ public class WindowFieldKit extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.recieveGuiNBT(side, player, name, nbt);
|
super.receiveGuiNBT(side, player, name, nbt);
|
||||||
if (side != Side.SERVER || !name.equals("analyse")) {
|
if (side != Side.SERVER || !name.equals("analyse")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class WindowGenesis extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
new ControlPlayerInventory(this);
|
new ControlPlayerInventory(this).createAndRegister();
|
||||||
setTitle(getName());
|
setTitle(getName());
|
||||||
|
|
||||||
ControlTabBar<BreedingSystem> tabSystems = new BreedingSystemControlTabBar();
|
ControlTabBar<BreedingSystem> tabSystems = new BreedingSystemControlTabBar();
|
||||||
@@ -175,8 +175,8 @@ public class WindowGenesis extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.recieveGuiNBT(side, player, name, nbt);
|
super.receiveGuiNBT(side, player, name, nbt);
|
||||||
if (side == Side.SERVER && name.equals("genesis")) {
|
if (side == Side.SERVER && name.equals("genesis")) {
|
||||||
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
|
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
|
||||||
InventoryPlayer playerInv = player.inventory;
|
InventoryPlayer playerInv = player.inventory;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.core.craftgui.minecraft;
|
package binnie.core.craftgui.minecraft;
|
||||||
|
|
||||||
|
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -7,12 +9,14 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
@@ -36,43 +40,71 @@ import cpw.mods.fml.relauncher.Side;
|
|||||||
|
|
||||||
public class ContainerCraftGUI extends Container {
|
public class ContainerCraftGUI extends Container {
|
||||||
|
|
||||||
|
// Action type is one of the action constants below
|
||||||
|
public final static String ACTION_TYPE = "type";
|
||||||
|
|
||||||
|
// Action constants
|
||||||
|
public final static String ACTION_BATCH = "batch";
|
||||||
|
public final static String SLOT_REG = "slot-reg";
|
||||||
|
public final static String TANK_CLICK = "tank-click";
|
||||||
|
public final static String TANK_UPDATE = "tank-update-";
|
||||||
|
public final static String POWER_UPDATE = "power-update";
|
||||||
|
public final static String PROCESS_UPDATE = "process-update";
|
||||||
|
public final static String ERROR_UPDATE = "error-update";
|
||||||
|
public final static String MOUSE_OVER_SLOT = "mouse-over-slot";
|
||||||
|
public final static String SHIFT_CLICK_INFO = "shift-click-info";
|
||||||
|
|
||||||
|
// Error type is one of the error constants below
|
||||||
|
public final static String ERROR_TYPE = "type";
|
||||||
|
|
||||||
|
// Error constants
|
||||||
|
public static final byte CANNOT_WORK = (byte) 0;
|
||||||
|
public static final byte CANNOT_PROGRESS = (byte) 1;
|
||||||
|
|
||||||
|
// Slot constants
|
||||||
|
public static final String SLOT_TYPE = "t";
|
||||||
|
public static final String SLOT_INDEX = "i";
|
||||||
|
public static final String SLOT_NUMBER = "n";
|
||||||
|
|
||||||
|
// Uncategorized constants
|
||||||
|
public static final String ACTIONS = "actions";
|
||||||
|
private static final String USERNAME = "username";
|
||||||
|
private static final String SLOT_ID = "id";
|
||||||
|
private static final String SLOT = "slot";
|
||||||
|
private static final String SLOTS = "slots";
|
||||||
|
private static final String TANK = "tank";
|
||||||
|
private static final String ORIGIN = "origin";
|
||||||
|
private static final String NAME = "name";
|
||||||
|
|
||||||
private final Window window;
|
private final Window window;
|
||||||
private final Map<String, NBTTagCompound> syncedNBT;
|
private final Map<String, NBTTagCompound> syncedNBT = new HashMap<>();
|
||||||
private final Map<String, NBTTagCompound> sentNBT;
|
private final Map<String, NBTTagCompound> sentNBT = new HashMap<>();
|
||||||
private final Map<Integer, TankInfo> syncedTanks;
|
private final Map<Integer, TankInfo> syncedTanks = new HashMap<>();
|
||||||
private PowerInfo syncedPower;
|
private PowerInfo syncedPower = new PowerInfo();
|
||||||
private ProcessInfo syncedProcess;
|
private ProcessInfo syncedProcess = new ProcessInfo();
|
||||||
private int errorType;
|
private int errorType = 0;
|
||||||
private ErrorState error;
|
private ErrorState error = null;
|
||||||
private int mousedOverSlotNumber;
|
private int mousedOverSlotNumber = -1;
|
||||||
|
|
||||||
public ContainerCraftGUI(Window window) {
|
public ContainerCraftGUI(Window window) {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
syncedNBT = new HashMap<>();
|
|
||||||
sentNBT = new HashMap<>();
|
|
||||||
syncedTanks = new HashMap<>();
|
|
||||||
syncedPower = new PowerInfo();
|
|
||||||
syncedProcess = new ProcessInfo();
|
|
||||||
errorType = 0;
|
|
||||||
error = null;
|
|
||||||
mousedOverSlotNumber = -1;
|
|
||||||
IMachine machine = Machine.getMachine(window.getInventory());
|
|
||||||
if (getSide() != Side.SERVER) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!window.isServer()) return;
|
||||||
|
|
||||||
|
// WARNING: The client side expects `ArrayList` and the server expects `ListMap`
|
||||||
inventoryItemStacks = new ListMap<>();
|
inventoryItemStacks = new ListMap<>();
|
||||||
inventorySlots = new ListMap<>();
|
inventorySlots = new ListMap<>();
|
||||||
if (machine == null) {
|
|
||||||
return;
|
IInventory entityInventory = window.getInventory();
|
||||||
}
|
IMachine machine = Machine.getMachine(entityInventory);
|
||||||
|
if (machine == null) return;
|
||||||
|
|
||||||
GameProfile user = machine.getOwner();
|
GameProfile user = machine.getOwner();
|
||||||
if (user != null) {
|
if (user == null) return;
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
|
||||||
nbt.setString("username", user.getName());
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
sendNBTToClient("username", nbt);
|
nbt.setString(USERNAME, user.getName());
|
||||||
}
|
sendNBTToClient(USERNAME, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,54 +118,47 @@ public class ContainerCraftGUI extends Container {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Slot getSlot(int index) {
|
public Slot getSlot(int index) {
|
||||||
if (index < 0 || index >= inventorySlots.size()) {
|
return index < 0 || index >= inventorySlots.size() ? null : inventorySlots.get(index);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return inventorySlots.get(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStackInSlot(int index, ItemStack stack) {
|
public void putStackInSlot(int index, ItemStack stack) {
|
||||||
if (getSlot(index) != null) {
|
final Slot slot = getSlot(index);
|
||||||
getSlot(index).putStack(stack);
|
if (slot != null) slot.putStack(stack);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) {
|
public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) {
|
||||||
for (int i = 0; i < par1ArrayOfItemStack.length; ++i) {
|
for (int i = 0; i < par1ArrayOfItemStack.length; ++i) {
|
||||||
if (getSlot(i) != null) {
|
final Slot slot = getSlot(i);
|
||||||
getSlot(i).putStack(par1ArrayOfItemStack[i]);
|
if (slot != null) slot.putStack(par1ArrayOfItemStack[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContainerClosed(EntityPlayer player) {
|
public void onContainerClosed(EntityPlayer player) {
|
||||||
super.onContainerClosed(player);
|
super.onContainerClosed(player);
|
||||||
WindowInventory inventory = window.getWindowInventory();
|
WindowInventory windowInventory = window.getWindowInventory();
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
InventoryPlayer playerInventory = player.inventory;
|
||||||
if (!inventory.dispenseOnClose(i)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = inventory.getStackInSlot(i);
|
for (int i = 0; i < windowInventory.getSizeInventory(); ++i) {
|
||||||
if (stack == null) {
|
if (!windowInventory.dispenseOnClose(i)) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
stack = new TransferRequest(stack, player.inventory).transfer(true);
|
final ItemStack stack = windowInventory.getStackInSlot(i);
|
||||||
if (stack != null) {
|
if (stack == null) continue;
|
||||||
player.dropPlayerItemWithRandomChoice(stack, false);
|
|
||||||
}
|
final ItemStack newStack = new TransferRequest(stack, playerInventory).transfer(true);
|
||||||
|
if (newStack == null) continue;
|
||||||
|
|
||||||
|
player.dropPlayerItemWithRandomChoice(newStack, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
||||||
Slot slot = getSlot(slotNum);
|
Slot slot = getSlot(slotNum);
|
||||||
if (slot instanceof CustomSlot && ((CustomSlot) slot).handleClick()) {
|
if (slot instanceof CustomSlot customSlot && customSlot.handleClick()) {
|
||||||
((CustomSlot) slot).onSlotClick(this, mouseButton, modifier, player);
|
customSlot.onSlotClick(this, mouseButton, modifier, player);
|
||||||
return player.inventory.getItemStack();
|
return player.inventory.getItemStack();
|
||||||
}
|
}
|
||||||
return super.slotClick(slotNum, mouseButton, modifier, player);
|
return super.slotClick(slotNum, mouseButton, modifier, player);
|
||||||
@@ -151,45 +176,40 @@ public class ContainerCraftGUI extends Container {
|
|||||||
}
|
}
|
||||||
sentNBT.clear();
|
sentNBT.clear();
|
||||||
}
|
}
|
||||||
IInventory inventory = window.getInventory();
|
IInventory entityInventory = window.getInventory();
|
||||||
return inventory == null || inventory.isUseableByPlayer(player);
|
return entityInventory == null || entityInventory.isUseableByPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||||
return shiftClick(player, slotID);
|
shiftClick(player, slotID);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack shiftClick(EntityPlayer player, int index) {
|
private void shiftClick(EntityPlayer player, int index) {
|
||||||
TransferRequest request = getShiftClickRequest(player, index);
|
TransferRequest request = getShiftClickRequest(player, index);
|
||||||
if (request == null) {
|
if (request == null) return;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = request.transfer(true);
|
ItemStack stack = request.transfer(true);
|
||||||
Slot shiftClickedSlot = inventorySlots.get(index);
|
Slot shiftClickedSlot = inventorySlots.get(index);
|
||||||
shiftClickedSlot.putStack(stack);
|
shiftClickedSlot.putStack(stack);
|
||||||
shiftClickedSlot.onSlotChanged();
|
shiftClickedSlot.onSlotChanged();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TransferRequest getShiftClickRequest(EntityPlayer player, int index) {
|
private TransferRequest getShiftClickRequest(EntityPlayer player, int index) {
|
||||||
if (index < 0) {
|
if (index < 0) return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Slot shiftClickedSlot = (Slot) inventorySlots.get(index);
|
Slot shiftClickedSlot = inventorySlots.get(index);
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
if (shiftClickedSlot.getHasStack()) {
|
if (shiftClickedSlot.getHasStack()) {
|
||||||
itemstack = shiftClickedSlot.getStack().copy();
|
itemstack = shiftClickedSlot.getStack().copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
IInventory playerInventory = player.inventory;
|
IInventory playerInventory = player.inventory;
|
||||||
IInventory containerInventory = window.getInventory();
|
IInventory entityInventory = window.getInventory();
|
||||||
IInventory windowInventory = window.getWindowInventory();
|
IInventory windowInventory = window.getWindowInventory();
|
||||||
IInventory fromPlayer = (containerInventory == null) ? windowInventory : containerInventory;
|
IInventory fromPlayer = (entityInventory == null) ? windowInventory : entityInventory;
|
||||||
int[] target = new int[36];
|
int[] target = new int[36];
|
||||||
for (int i = 0; i < 36; ++i) {
|
for (int i = 0; i < target.length; ++i) {
|
||||||
target[i] = i;
|
target[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,108 +221,116 @@ public class ContainerCraftGUI extends Container {
|
|||||||
.setTargetSlots(target);
|
.setTargetSlots(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window instanceof IWindowAffectsShiftClick) {
|
if (window instanceof IWindowAffectsShiftClick iWindowAffectsShiftClick) {
|
||||||
((IWindowAffectsShiftClick) window).alterRequest(request);
|
iWindowAffectsShiftClick.alterRequest(request);
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
public ItemStack tankClick(EntityPlayer player, int slotID) {
|
public ItemStack tankClick(EntityPlayer player, int slotID) {
|
||||||
if (player.inventory.getItemStack() == null) {
|
if (player.inventory.getItemStack() == null) return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack heldItem = player.inventory.getItemStack().copy();
|
ItemStack heldItem = player.inventory.getItemStack().copy();
|
||||||
heldItem = new TransferRequest(heldItem, window.getInventory()).setOrigin(player.inventory)
|
IInventory entityInventory = window.getInventory();
|
||||||
.setTargetSlots(new int[0]).setTargetTanks(new int[] { slotID }).transfer(true);
|
heldItem = new TransferRequest(heldItem, entityInventory).setOrigin(player.inventory).setTargetSlots(new int[0])
|
||||||
|
.setTargetTanks(new int[] { slotID }).transfer(true);
|
||||||
|
|
||||||
player.inventory.setItemStack(heldItem);
|
player.inventory.setItemStack(heldItem);
|
||||||
if (player instanceof EntityPlayerMP) {
|
|
||||||
((EntityPlayerMP) player).updateHeldItem();
|
if (player instanceof EntityPlayerMP entityPlayerMP) {
|
||||||
|
entityPlayerMP.updateHeldItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
return heldItem;
|
return heldItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) {
|
public void handleNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||||
if (side == Side.SERVER) {
|
final String actionType = action.getString(ACTION_TYPE);
|
||||||
if (name.equals("tank-click")) {
|
|
||||||
tankClick(player, action.getByte("id"));
|
|
||||||
}
|
|
||||||
if (name.equals("slot-reg")) {
|
|
||||||
int type = action.getByte("t");
|
|
||||||
int index = action.getShort("i");
|
|
||||||
int slotNumber = action.getShort("n");
|
|
||||||
getOrCreateSlot(InventoryType.values()[type % 4], index, slotNumber);
|
|
||||||
|
|
||||||
for (ICrafting crafterObject : crafters) {
|
if (side == Side.SERVER) {
|
||||||
crafterObject.sendContainerAndContentsToPlayer(this, getInventory());
|
switch (actionType) {
|
||||||
|
case TANK_CLICK -> tankClick(player, action.getByte(SLOT_ID));
|
||||||
|
case SLOT_REG -> {
|
||||||
|
final int slotType = action.getByte(SLOT_TYPE);
|
||||||
|
final int slotIndex = action.getShort(SLOT_INDEX);
|
||||||
|
final int slotNumber = action.getShort(SLOT_NUMBER);
|
||||||
|
|
||||||
|
createSlot(InventoryType.values()[slotType % 4], slotIndex, slotNumber);
|
||||||
|
|
||||||
|
for (ICrafting crafterObject : crafters) {
|
||||||
|
crafterObject.sendContainerAndContentsToPlayer(this, getInventory());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.contains("tank-update")) {
|
switch (actionType) {
|
||||||
onTankUpdate(action);
|
case POWER_UPDATE -> onPowerUpdate(action);
|
||||||
} else if (name.equals("power-update")) {
|
case PROCESS_UPDATE -> onProcessUpdate(action);
|
||||||
onPowerUpdate(action);
|
case ERROR_UPDATE -> onErrorUpdate(action);
|
||||||
} else if (name.equals("process-update")) {
|
case MOUSE_OVER_SLOT -> onMouseOverSlot(player, action);
|
||||||
onProcessUpdate(action);
|
case SHIFT_CLICK_INFO -> onReceiveShiftClickHighlights(action);
|
||||||
} else if (name.equals("error-update")) {
|
default -> {
|
||||||
onErrorUpdate(action);
|
if (actionType.contains(TANK_UPDATE)) onTankUpdate(action);
|
||||||
} else if (name.equals("mouse-over-slot")) {
|
}
|
||||||
onMouseOverSlot(player, action);
|
|
||||||
} else if (name.equals("shift-click-info")) {
|
|
||||||
onRecieveShiftClickHighlights(player, action);
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges() {
|
public void detectAndSendChanges() {
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
ITankMachine tanks = Machine.getInterface(ITankMachine.class, window.getInventory());
|
|
||||||
IPoweredMachine powered = Machine.getInterface(IPoweredMachine.class, window.getInventory());
|
IInventory entityInventory = window.getInventory();
|
||||||
IErrorStateSource error = Machine.getInterface(IErrorStateSource.class, window.getInventory());
|
ITankMachine tanks = Machine.getInterface(ITankMachine.class, entityInventory);
|
||||||
IProcess process = Machine.getInterface(IProcess.class, window.getInventory());
|
IPoweredMachine powered = Machine.getInterface(IPoweredMachine.class, entityInventory);
|
||||||
if (tanks != null && window.isServer()) {
|
IErrorStateSource error = Machine.getInterface(IErrorStateSource.class, entityInventory);
|
||||||
for (int i = 0; i < tanks.getTankInfos().length; ++i) {
|
IProcess process = Machine.getInterface(IProcess.class, entityInventory);
|
||||||
TankInfo tank = tanks.getTankInfos()[i];
|
|
||||||
if (!getTankInfo(i).equals(tank)) {
|
if (window.isServer() && tanks != null) {
|
||||||
syncedNBT.put("tank-update-" + i, createTankNBT(i, tank));
|
final TankInfo[] tankInfos = tanks.getTankInfos();
|
||||||
syncedTanks.put(i, tank);
|
for (int i = 0; i < tankInfos.length; ++i) {
|
||||||
}
|
final TankInfo tank = tankInfos[i];
|
||||||
|
if (this.getTankInfo(i).equals(tank)) continue;
|
||||||
|
syncedNBT.put(TANK_UPDATE + i, createTankNBT(i, tank));
|
||||||
|
syncedTanks.put(i, tank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (powered != null && window.isServer()) {
|
if (window.isServer()) {
|
||||||
syncedNBT.put("power-update", createPowerNBT(powered.getPowerInfo()));
|
if (powered != null) syncedNBT.put(POWER_UPDATE, createPowerNBT(powered.getPowerInfo()));
|
||||||
}
|
if (process != null) syncedNBT.put(PROCESS_UPDATE, createProcessNBT(process.getInfo()));
|
||||||
if (process != null && window.isServer()) {
|
if (error != null) syncedNBT.put(ERROR_UPDATE, createErrorNBT(error));
|
||||||
syncedNBT.put("process-update", createProcessNBT(process.getInfo()));
|
|
||||||
}
|
|
||||||
if (error != null && window.isServer()) {
|
|
||||||
syncedNBT.put("error-update", createErrorNBT(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, window.getInventory());
|
INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, entityInventory);
|
||||||
if (machineSync != null) {
|
|
||||||
machineSync.sendGuiNBT(syncedNBT);
|
if (machineSync != null) machineSync.sendGuiNBT(syncedNBT);
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
|
Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
|
||||||
for (Map.Entry<String, NBTTagCompound> nbt : syncedNBT.entrySet()) {
|
NBTTagList actions = new NBTTagList();
|
||||||
nbt.getValue().setString("type", nbt.getKey());
|
|
||||||
boolean shouldSend = true;
|
|
||||||
NBTTagCompound lastSent = sentNBT.get(nbt.getKey());
|
|
||||||
if (lastSent != null) {
|
|
||||||
shouldSend = !lastSent.equals(nbt.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldSend) {
|
for (Map.Entry<String, NBTTagCompound> entry : syncedNBT.entrySet()) {
|
||||||
for (Object crafter : crafters) {
|
final String actionType = entry.getKey();
|
||||||
if (crafter instanceof EntityPlayerMP playerMP) {
|
final NBTTagCompound action = entry.getValue();
|
||||||
BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate(nbt.getValue()), playerMP);
|
final NBTTagCompound actionPrev = sentNBT.get(actionType);
|
||||||
}
|
|
||||||
}
|
action.setString(ACTION_TYPE, actionType);
|
||||||
sentThisTime.put(nbt.getKey(), nbt.getValue());
|
|
||||||
|
if (action.equals(actionPrev)) continue;
|
||||||
|
|
||||||
|
actions.appendTag(action);
|
||||||
|
sentThisTime.put(actionType, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound actionsBatch = new NBTTagCompound();
|
||||||
|
actionsBatch.setString(ACTION_TYPE, ACTION_BATCH);
|
||||||
|
actionsBatch.setTag(ACTIONS, actions);
|
||||||
|
|
||||||
|
for (ICrafting crafter : crafters) {
|
||||||
|
if (crafter instanceof EntityPlayerMP playerMP) {
|
||||||
|
final MessageContainerUpdate packet = new MessageContainerUpdate(actionsBatch);
|
||||||
|
BinnieCore.proxy.sendToPlayer(packet, playerMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,10 +342,10 @@ public class ContainerCraftGUI extends Container {
|
|||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
ErrorState state = null;
|
ErrorState state = null;
|
||||||
if (error.canWork() != null) {
|
if (error.canWork() != null) {
|
||||||
nbt.setByte("type", (byte) 0);
|
nbt.setByte(ERROR_TYPE, CANNOT_WORK);
|
||||||
state = error.canWork();
|
state = error.canWork();
|
||||||
} else if (error.canProgress() != null) {
|
} else if (error.canProgress() != null) {
|
||||||
nbt.setByte("type", (byte) 1);
|
nbt.setByte(ERROR_TYPE, CANNOT_PROGRESS);
|
||||||
state = error.canProgress();
|
state = error.canProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,19 +370,20 @@ public class ContainerCraftGUI extends Container {
|
|||||||
public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo) {
|
public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo) {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
tankInfo.writeToNBT(nbt);
|
tankInfo.writeToNBT(nbt);
|
||||||
nbt.setByte("tank", (byte) tank);
|
nbt.setByte(TANK, (byte) tank);
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTankUpdate(NBTTagCompound nbt) {
|
public void onTankUpdate(NBTTagCompound nbt) {
|
||||||
int tankID = nbt.getByte("tank");
|
int tankID = nbt.getByte(TANK);
|
||||||
TankInfo tank = new TankInfo();
|
TankInfo tank = new TankInfo();
|
||||||
tank.readFromNBT(nbt);
|
tank.readFromNBT(nbt);
|
||||||
syncedTanks.put(tankID, tank);
|
syncedTanks.put(tankID, tank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onProcessUpdate(NBTTagCompound nbt) {
|
public void onProcessUpdate(NBTTagCompound nbt) {
|
||||||
(syncedProcess = new ProcessInfo()).readFromNBT(nbt);
|
syncedProcess = new ProcessInfo();
|
||||||
|
syncedProcess.readFromNBT(nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPowerUpdate(NBTTagCompound nbt) {
|
public void onPowerUpdate(NBTTagCompound nbt) {
|
||||||
@@ -375,8 +404,8 @@ public class ContainerCraftGUI extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onErrorUpdate(NBTTagCompound nbt) {
|
public void onErrorUpdate(NBTTagCompound nbt) {
|
||||||
errorType = nbt.getByte("type");
|
errorType = nbt.getByte(ERROR_TYPE);
|
||||||
if (nbt.hasKey("name")) {
|
if (nbt.hasKey(NAME)) {
|
||||||
error = new ErrorState("", "");
|
error = new ErrorState("", "");
|
||||||
error.readFromNBT(nbt);
|
error.readFromNBT(nbt);
|
||||||
} else {
|
} else {
|
||||||
@@ -403,20 +432,18 @@ public class ContainerCraftGUI extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setMouseOverSlot(Slot slot) {
|
public void setMouseOverSlot(Slot slot) {
|
||||||
if (slot.slotNumber == mousedOverSlotNumber) {
|
if (slot.slotNumber == mousedOverSlotNumber) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mousedOverSlotNumber = slot.slotNumber;
|
mousedOverSlotNumber = slot.slotNumber;
|
||||||
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
nbt.setShort("slot", (short) slot.slotNumber);
|
nbt.setShort(SLOT, (short) slot.slotNumber);
|
||||||
window.sendClientAction("mouse-over-slot", nbt);
|
window.sendClientAction(MOUSE_OVER_SLOT, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data) {
|
private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data) {
|
||||||
int slotnumber = data.getShort("slot");
|
int slotNumber = data.getShort(SLOT);
|
||||||
TransferRequest request = getShiftClickRequest(player, slotnumber);
|
TransferRequest request = getShiftClickRequest(player, slotNumber);
|
||||||
if (request == null) {
|
if (request == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -424,8 +451,8 @@ public class ContainerCraftGUI extends Container {
|
|||||||
request.transfer(false);
|
request.transfer(false);
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
List<Integer> slots = new ArrayList<>();
|
List<Integer> slots = new ArrayList<>();
|
||||||
for (TransferRequest.TransferSlot tslot : request.getInsertedSlots()) {
|
for (TransferRequest.TransferSlot transferSlot : request.getInsertedSlots()) {
|
||||||
Slot slot = getSlot(tslot.inventory, tslot.id);
|
Slot slot = getSlot(transferSlot.inventory, transferSlot.id);
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
slots.add(slot.slotNumber);
|
slots.add(slot.slotNumber);
|
||||||
}
|
}
|
||||||
@@ -436,15 +463,15 @@ public class ContainerCraftGUI extends Container {
|
|||||||
array[i] = slots.get(i);
|
array[i] = slots.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbt.setIntArray("slots", array);
|
nbt.setIntArray(SLOTS, array);
|
||||||
nbt.setShort("origin", (short) slotnumber);
|
nbt.setShort(ORIGIN, (short) slotNumber);
|
||||||
syncedNBT.put("shift-click-info", nbt);
|
syncedNBT.put(SHIFT_CLICK_INFO, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRecieveShiftClickHighlights(EntityPlayer player, NBTTagCompound data) {
|
private void onReceiveShiftClickHighlights(NBTTagCompound data) {
|
||||||
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
||||||
for (int slotnumber : data.getIntArray("slots")) {
|
for (int slotIndex : data.getIntArray(SLOTS)) {
|
||||||
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).add(slotnumber);
|
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).add(slotIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,58 +485,50 @@ public class ContainerCraftGUI extends Container {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recieveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
public void receiveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||||
String name = action.getString("type");
|
String actionType = action.getString(ACTION_TYPE);
|
||||||
if (handleNBT(side, player, name, action)) {
|
if (actionType.equals(ACTION_BATCH)) {
|
||||||
|
NBTTagList actionsBatch = action.getTagList(ACTIONS, TAG_COMPOUND);
|
||||||
|
for (int i = 0; i < actionsBatch.tagCount(); i++) {
|
||||||
|
receiveNBT(side, player, actionsBatch.getCompoundTagAt(i));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
handleNBT(side, player, action);
|
||||||
window.recieveGuiNBT(getSide(), player, name, action);
|
window.receiveGuiNBT(getSide(), player, actionType, action);
|
||||||
INetwork.RecieveGuiNBT machine = Machine.getInterface(INetwork.RecieveGuiNBT.class, window.getInventory());
|
INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, window.getInventory());
|
||||||
if (machine != null) {
|
if (machine == null) return;
|
||||||
machine.recieveGuiNBT(getSide(), player, name, action);
|
machine.receiveGuiNBT(getSide(), player, actionType, action);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Slot getOrCreateSlot(InventoryType type, int index) {
|
public Slot getOrCreateSlot(InventoryType inventoryType, int slotIndex) {
|
||||||
IInventory inventory = getInventory(type);
|
final IInventory inventory = getInventory(inventoryType);
|
||||||
Slot slot = getSlot(inventory, index);
|
Slot slot = getSlot(inventory, slotIndex);
|
||||||
|
|
||||||
if (slot == null) {
|
if (slot == null) {
|
||||||
slot = new CustomSlot(inventory, index);
|
slot = new CustomSlot(inventory, slotIndex);
|
||||||
addSlotToContainer(slot);
|
addSlotToContainer(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
|
||||||
nbt.setByte("t", (byte) type.ordinal());
|
|
||||||
nbt.setShort("i", (short) index);
|
|
||||||
nbt.setShort("n", (short) slot.slotNumber);
|
|
||||||
window.sendClientAction("slot-reg", nbt);
|
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IInventory getInventory(InventoryType type) {
|
protected IInventory getInventory(InventoryType type) {
|
||||||
if (type == InventoryType.Machine) {
|
return switch (type) {
|
||||||
return window.getInventory();
|
case Machine -> window.getInventory();
|
||||||
}
|
case Player -> window.getPlayer().inventory;
|
||||||
if (type == InventoryType.Player) {
|
case Window -> window.getWindowInventory();
|
||||||
return window.getPlayer().inventory;
|
default -> null;
|
||||||
}
|
};
|
||||||
if (type == InventoryType.Window) {
|
|
||||||
return window.getWindowInventory();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Slot getOrCreateSlot(InventoryType type, int index, int slotNumber) {
|
private void createSlot(InventoryType type, int index, int slotNumber) {
|
||||||
IInventory inventory = getInventory(type);
|
if (inventorySlots.get(slotNumber) != null) return;
|
||||||
if (inventorySlots.get(slotNumber) != null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
IInventory inventory = getInventory(type);
|
||||||
Slot slot = new CustomSlot(inventory, index);
|
Slot slot = new CustomSlot(inventory, index);
|
||||||
slot.slotNumber = slotNumber;
|
slot.slotNumber = slotNumber;
|
||||||
inventorySlots.add(slotNumber, slot);
|
inventorySlots.add(slotNumber, slot);
|
||||||
inventoryItemStacks.add(slotNumber, null);
|
inventoryItemStacks.add(slotNumber, null);
|
||||||
return slot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,10 @@ public enum EnumColor {
|
|||||||
Yellow("Yellow", 16777045, 'e'),
|
Yellow("Yellow", 16777045, 'e'),
|
||||||
White("White", 16777215, 'f');
|
White("White", 16777215, 'f');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumColor[] VALUES = values();
|
||||||
private final int colour;
|
private final int colour;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final char code;
|
private final char code;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import binnie.core.resource.ResourceType;
|
|||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public abstract class Window extends TopLevelWidget implements INetwork.RecieveGuiNBT {
|
public abstract class Window extends TopLevelWidget implements INetwork.ReceiveGuiNBT {
|
||||||
|
|
||||||
protected float titleButtonLeft;
|
protected float titleButtonLeft;
|
||||||
protected float titleButtonRight;
|
protected float titleButtonRight;
|
||||||
@@ -291,7 +291,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
if (side == Side.CLIENT && name.equals("username")) {
|
if (side == Side.CLIENT && name.equals("username")) {
|
||||||
float w = w();
|
float w = w();
|
||||||
float titleButtonRight = this.titleButtonRight + 16.0f;
|
float titleButtonRight = this.titleButtonRight + 16.0f;
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ package binnie.core.craftgui.minecraft.control;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.craftgui.IWidget;
|
import binnie.core.craftgui.IWidget;
|
||||||
import binnie.core.craftgui.controls.core.Control;
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
import binnie.core.craftgui.minecraft.InventoryType;
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
|
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
|
|
||||||
public class ControlPlayerInventory extends Control {
|
public class ControlPlayerInventory extends Control {
|
||||||
|
|
||||||
@@ -21,23 +25,24 @@ public class ControlPlayerInventory extends Control {
|
|||||||
slots = new ArrayList<>();
|
slots = new ArrayList<>();
|
||||||
for (int row = 0; row < 3; ++row) {
|
for (int row = 0; row < 3; ++row) {
|
||||||
for (int column = 0; column < 9; ++column) {
|
for (int column = 0; column < 9; ++column) {
|
||||||
ControlSlot slot = new ControlSlot(this, (wide ? 58 : 0) + column * 18, row * 18);
|
ControlSlot slot = new ControlSlot(this, (wide ? 58 : 0) + column * 18, row * 18)
|
||||||
|
.setSlotTexture(CraftGUITexture.SlotInventory);
|
||||||
slots.add(slot);
|
slots.add(slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wide) {
|
if (wide) {
|
||||||
for (int i1 = 0; i1 < 9; ++i1) {
|
for (int i1 = 0; i1 < 9; ++i1) {
|
||||||
ControlSlot slot2 = new ControlSlot(this, i1 % 3 * 18, i1 / 3 * 18);
|
ControlSlot slot2 = new ControlSlot(this, i1 % 3 * 18, i1 / 3 * 18)
|
||||||
|
.setSlotTexture(CraftGUITexture.SlotInventory);
|
||||||
slots.add(slot2);
|
slots.add(slot2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i1 = 0; i1 < 9; ++i1) {
|
for (int i1 = 0; i1 < 9; ++i1) {
|
||||||
ControlSlot slot2 = new ControlSlot(this, i1 * 18, 58.0f);
|
ControlSlot slot2 = new ControlSlot(this, i1 * 18, 58.0f).setSlotTexture(CraftGUITexture.SlotInventory);
|
||||||
slots.add(slot2);
|
slots.add(slot2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlPlayerInventory(IWidget parent) {
|
public ControlPlayerInventory(IWidget parent) {
|
||||||
@@ -49,32 +54,33 @@ public class ControlPlayerInventory extends Control {
|
|||||||
slots = new ArrayList<>();
|
slots = new ArrayList<>();
|
||||||
for (int row = 0; row < 6; ++row) {
|
for (int row = 0; row < 6; ++row) {
|
||||||
for (int column = 0; column < 6; ++column) {
|
for (int column = 0; column < 6; ++column) {
|
||||||
ControlSlot slot = new ControlSlot(this, column * 18, row * 18);
|
ControlSlot slot = new ControlSlot(this, column * 18, row * 18)
|
||||||
|
.setSlotTexture(CraftGUITexture.SlotInventory);
|
||||||
slots.add(slot);
|
slots.add(slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create() {
|
public ControlPlayerInventory create(NBTTagList actions) {
|
||||||
for (int row = 0; row < 3; ++row) {
|
for (int row = 0; row < 3; ++row) {
|
||||||
for (int column = 0; column < 9; ++column) {
|
for (int column = 0; column < 9; ++column) {
|
||||||
ControlSlot slot = slots.get(column + row * 9);
|
ControlSlot slot = slots.get(column + row * 9);
|
||||||
slot.assign(InventoryType.Player, 9 + column + row * 9);
|
slot.assign(actions, InventoryType.Player, 9 + column + row * 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < 9; ++i1) {
|
for (int i1 = 0; i1 < 9; ++i1) {
|
||||||
ControlSlot slot2 = slots.get(27 + i1);
|
ControlSlot slot2 = slots.get(27 + i1);
|
||||||
slot2.assign(InventoryType.Player, i1);
|
slot2.assign(actions, InventoryType.Player, i1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlSlot getSlot(int i) {
|
public ControlPlayerInventory createAndRegister() {
|
||||||
if (i < 0 || i >= slots.size()) {
|
final NBTTagList actions = new NBTTagList();
|
||||||
return null;
|
create(actions);
|
||||||
}
|
MessageCraftGUI.sendToServer(actions);
|
||||||
return slots.get(i);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
package binnie.core.craftgui.minecraft.control;
|
package binnie.core.craftgui.minecraft.control;
|
||||||
|
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTION_TYPE;
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_INDEX;
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_NUMBER;
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_REG;
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.SLOT_TYPE;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,6 +16,8 @@ import net.minecraft.client.multiplayer.PlayerControllerMP;
|
|||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import binnie.core.craftgui.CraftGUI;
|
import binnie.core.craftgui.CraftGUI;
|
||||||
@@ -26,6 +34,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
|||||||
import binnie.core.machines.inventory.InventorySlot;
|
import binnie.core.machines.inventory.InventorySlot;
|
||||||
import binnie.core.machines.inventory.MachineSide;
|
import binnie.core.machines.inventory.MachineSide;
|
||||||
import binnie.core.machines.inventory.SlotValidator;
|
import binnie.core.machines.inventory.SlotValidator;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class ControlSlot extends ControlSlotBase {
|
public class ControlSlot extends ControlSlotBase {
|
||||||
@@ -40,10 +49,12 @@ public class ControlSlot extends ControlSlotBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Slot slot;
|
public Slot slot;
|
||||||
|
private CraftGUITexture slotTexture;
|
||||||
|
|
||||||
public ControlSlot(IWidget parent, float x, float y) {
|
public ControlSlot(IWidget parent, float x, float y) {
|
||||||
super(parent, x, y);
|
super(parent, x, y);
|
||||||
slot = null;
|
slot = null;
|
||||||
|
slotTexture = CraftGUITexture.Slot;
|
||||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,11 +82,17 @@ public class ControlSlot extends ControlSlotBase {
|
|||||||
public ControlSlot(IWidget parent, int x, int y, Slot slot) {
|
public ControlSlot(IWidget parent, int x, int y, Slot slot) {
|
||||||
super(parent, x, y);
|
super(parent, x, y);
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
|
slotTexture = CraftGUITexture.Slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlSlot setSlotTexture(CraftGUITexture texture) {
|
||||||
|
slotTexture = texture == null ? CraftGUITexture.Slot : texture;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRenderBackground() {
|
public void onRenderBackground() {
|
||||||
CraftGUI.render.texture(CraftGUITexture.Slot, IPoint.ZERO);
|
CraftGUI.render.texture(slotTexture, IPoint.ZERO);
|
||||||
if (slot == null) {
|
if (slot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -179,14 +196,28 @@ public class ControlSlot extends ControlSlotBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlSlot assign(int index) {
|
/// Assign a slot and register it immediately. Should be used when no other actions need to be sent.
|
||||||
return assign(InventoryType.Machine, index);
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
|
public ControlSlot assignAndRegister(InventoryType inventoryType, int slotIndex) {
|
||||||
|
final NBTTagList actions = new NBTTagList();
|
||||||
|
assign(actions, inventoryType, slotIndex);
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlSlot assign(InventoryType inventory, int index) {
|
/// Assign a slot and defer registration using an `NBTTagList`.
|
||||||
if (slot == null) {
|
/// Use in combination with {@link MessageCraftGUI#sendToServer(NBTTagList)}.
|
||||||
slot = ((Window) getSuperParent()).getContainer().getOrCreateSlot(inventory, index);
|
public ControlSlot assign(NBTTagList actions, InventoryType inventoryType, int slotIndex) {
|
||||||
}
|
if (slot == null) slot = ((Window) getSuperParent()).getContainer().getOrCreateSlot(inventoryType, slotIndex);
|
||||||
|
|
||||||
|
NBTTagCompound slotReg = new NBTTagCompound();
|
||||||
|
slotReg.setString(ACTION_TYPE, SLOT_REG);
|
||||||
|
slotReg.setByte(SLOT_TYPE, (byte) inventoryType.ordinal());
|
||||||
|
slotReg.setShort(SLOT_INDEX, (short) slotIndex);
|
||||||
|
slotReg.setShort(SLOT_NUMBER, (short) slot.slotNumber);
|
||||||
|
|
||||||
|
actions.appendTag(slotReg);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.craftgui.IWidget;
|
import binnie.core.craftgui.IWidget;
|
||||||
import binnie.core.craftgui.controls.core.Control;
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
import binnie.core.craftgui.minecraft.InventoryType;
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
@@ -26,15 +28,14 @@ public class ControlSlotArray extends Control implements Iterable<ControlSlot> {
|
|||||||
return new ControlSlot(this, x, y);
|
return new ControlSlot(this, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlSlotArray create(int[] index) {
|
public ControlSlotArray create(NBTTagList actions, InventoryType inventoryType, int[] index) {
|
||||||
return create(InventoryType.Machine, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ControlSlotArray create(InventoryType type, int[] index) {
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ControlSlot slot : slots) {
|
for (ControlSlot controlSlot : slots) {
|
||||||
slot.assign(type, index[i++]);
|
final int slotIndex = index[i];
|
||||||
|
controlSlot.assign(actions, inventoryType, slotIndex);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public enum CraftGUITexture {
|
|||||||
Button("button"),
|
Button("button"),
|
||||||
ButtonHighlighted("button.highlighted"),
|
ButtonHighlighted("button.highlighted"),
|
||||||
Slot("slot"),
|
Slot("slot"),
|
||||||
|
SlotInventory("slot.inventory"),
|
||||||
SlotBorder("slot.border"),
|
SlotBorder("slot.border"),
|
||||||
SlotOverlay("slot.overlay"),
|
SlotOverlay("slot.overlay"),
|
||||||
SlotCharge("slot.charge"),
|
SlotCharge("slot.charge"),
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public abstract class BreedingSystem implements IItemStackRepresentative {
|
|||||||
|
|
||||||
public BreedingSystem() {
|
public BreedingSystem() {
|
||||||
Binnie.Genetics.registerBreedingSystem(this);
|
Binnie.Genetics.registerBreedingSystem(this);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChromosomeName(IChromosomeType chromo) {
|
public String getChromosomeName(IChromosomeType chromo) {
|
||||||
@@ -294,13 +294,16 @@ public abstract class BreedingSystem implements IItemStackRepresentative {
|
|||||||
|
|
||||||
public abstract Class<? extends IBreedingTracker> getTrackerClass();
|
public abstract Class<? extends IBreedingTracker> getTrackerClass();
|
||||||
|
|
||||||
@SubscribeEvent
|
public class EventHandler {
|
||||||
public void onSyncBreedingTracker(ForestryEvent.SyncedBreedingTracker event) {
|
|
||||||
IBreedingTracker tracker = event.tracker;
|
@SubscribeEvent
|
||||||
if (!getTrackerClass().isInstance(tracker)) {
|
public void onSyncBreedingTracker(ForestryEvent.SyncedBreedingTracker event) {
|
||||||
return;
|
IBreedingTracker tracker = event.tracker;
|
||||||
|
if (!getTrackerClass().isInstance(tracker)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
syncTracker(tracker);
|
||||||
}
|
}
|
||||||
syncTracker(tracker);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncTracker(IBreedingTracker tracker) {
|
public void syncTracker(IBreedingTracker tracker) {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class FlowerBreedingSystem extends BreedingSystem {
|
|||||||
case PRIMARY:
|
case PRIMARY:
|
||||||
case SECONDARY:
|
case SECONDARY:
|
||||||
case STEM:
|
case STEM:
|
||||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
for (EnumFlowerColor color : EnumFlowerColor.VALUES) {
|
||||||
alleles.add(color.getAllele());
|
alleles.add(color.getAllele());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.Map;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
@@ -67,6 +68,11 @@ public class ManagerGenetics extends ManagerBase {
|
|||||||
refreshData();
|
refreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerEventHandler() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
public ITreeRoot getTreeRoot() {
|
public ITreeRoot getTreeRoot() {
|
||||||
return (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
return (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
||||||
}
|
}
|
||||||
@@ -140,11 +146,6 @@ public class ManagerGenetics extends ManagerBase {
|
|||||||
return (system == null) ? null : system.getConversion(stack);
|
return (system == null) ? null : system.getConversion(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onWorldLoad(WorldEvent.Load event) {
|
|
||||||
refreshData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshData() {
|
private void refreshData() {
|
||||||
loadAlleles();
|
loadAlleles();
|
||||||
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
||||||
@@ -219,4 +220,12 @@ public class ManagerGenetics extends ManagerBase {
|
|||||||
return o1.getUID().compareTo(o2.getUID());
|
return o1.getUID().compareTo(o2.getUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onWorldLoad(WorldEvent.Load event) {
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.core.item;
|
package binnie.core.item;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -25,6 +27,8 @@ public class ItemGenesis extends Item {
|
|||||||
setCreativeTab(Tabs.tabApiculture);
|
setCreativeTab(Tabs.tabApiculture);
|
||||||
setUnlocalizedName("genesis");
|
setUnlocalizedName("genesis");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.core.item;
|
package binnie.core.item;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -16,11 +18,13 @@ public class ItemMisc extends Item {
|
|||||||
|
|
||||||
private final IItemMisc[] items;
|
private final IItemMisc[] items;
|
||||||
|
|
||||||
protected ItemMisc(CreativeTabs tab, IItemMisc[] items2) {
|
public ItemMisc(CreativeTabs tab, IItemMisc[] items) {
|
||||||
setCreativeTab(tab);
|
setCreativeTab(tab);
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setUnlocalizedName("misc");
|
setUnlocalizedName("misc");
|
||||||
items = items2;
|
this.items = items;
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package binnie.core.item;
|
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
|
|
||||||
public class ManagerItem {
|
|
||||||
|
|
||||||
public ItemMisc registerMiscItems(IItemMisc[] items, CreativeTabs tab) {
|
|
||||||
return new ItemMisc(tab, items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,6 +6,7 @@ import net.minecraft.init.Items;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
@@ -49,36 +50,44 @@ public class ModuleItems implements IInitializable {
|
|||||||
new ItemStack(Items.dye, 1));
|
new ItemStack(Items.dye, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@Override
|
||||||
public void onUseFieldKit(PlayerInteractEvent event) {
|
public void registerEventHandler() {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
EntityPlayer player = event.entityPlayer;
|
public static class EventHandler {
|
||||||
if (player != null && player.getHeldItem() != null
|
|
||||||
&& player.getHeldItem().getItem() == BinnieCore.fieldKit
|
@SubscribeEvent
|
||||||
&& player.isSneaking()) {
|
public void onUseFieldKit(PlayerInteractEvent event) {
|
||||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (!(tile instanceof TileEntityFlower tileFlower)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFlower flower = tileFlower.getFlower();
|
EntityPlayer player = event.entityPlayer;
|
||||||
if (flower == null) {
|
if (player != null && player.getHeldItem() != null
|
||||||
return;
|
&& player.getHeldItem().getItem() == BinnieCore.fieldKit
|
||||||
}
|
&& player.isSneaking()) {
|
||||||
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
|
if (!(tile instanceof TileEntityFlower tileFlower)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NBTTagCompound info = new NBTTagCompound();
|
IFlower flower = tileFlower.getFlower();
|
||||||
info.setString("Species", flower.getGenome().getPrimary().getUID());
|
if (flower == null) {
|
||||||
info.setString("Species2", flower.getGenome().getSecondary().getUID());
|
return;
|
||||||
info.setFloat("Age", flower.getAge() / flower.getGenome().getLifespan());
|
}
|
||||||
info.setShort("Colour", (short) flower.getGenome().getPrimaryColor().getID());
|
|
||||||
info.setShort("Colour2", (short) flower.getGenome().getSecondaryColor().getID());
|
NBTTagCompound info = new NBTTagCompound();
|
||||||
info.setBoolean("Wilting", flower.isWilted());
|
info.setString("Species", flower.getGenome().getPrimary().getUID());
|
||||||
info.setBoolean("Flowered", flower.hasFlowered());
|
info.setString("Species2", flower.getGenome().getSecondary().getUID());
|
||||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FieldKit.ordinal(), info), event.entityPlayer);
|
info.setFloat("Age", flower.getAge() / flower.getGenome().getLifespan());
|
||||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
info.setShort("Colour", (short) flower.getGenome().getPrimaryColor().getID());
|
||||||
|
info.setShort("Colour2", (short) flower.getGenome().getSecondaryColor().getID());
|
||||||
|
info.setBoolean("Wilting", flower.isWilted());
|
||||||
|
info.setBoolean("Flowered", flower.hasFlowered());
|
||||||
|
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FieldKit.ordinal(), info), event.entityPlayer);
|
||||||
|
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,16 +277,16 @@ public class Machine implements INetworkedEntity, INBTTagable, INetwork.TilePack
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
for (INetwork.RecieveGuiNBT recieve : getInterfaces(INetwork.RecieveGuiNBT.class)) {
|
for (INetwork.ReceiveGuiNBT receive : getInterfaces(INetwork.ReceiveGuiNBT.class)) {
|
||||||
recieve.recieveGuiNBT(side, player, name, nbt);
|
receive.receiveGuiNBT(side, player, name, nbt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendGuiNBT(Map<String, NBTTagCompound> nbts) {
|
public void sendGuiNBT(Map<String, NBTTagCompound> nbts) {
|
||||||
for (INetwork.SendGuiNBT recieve : getInterfaces(INetwork.SendGuiNBT.class)) {
|
for (INetwork.SendGuiNBT receive : getInterfaces(INetwork.SendGuiNBT.class)) {
|
||||||
recieve.sendGuiNBT(nbts);
|
receive.sendGuiNBT(nbts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ public class MachineComponent implements INBTTagable {
|
|||||||
return new MachinePayload(Binnie.Machine.getNetworkID(getClass()));
|
return new MachinePayload(Binnie.Machine.getNetworkID(getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recieveData(MachinePayload payload) {}
|
public void receiveData(MachinePayload payload) {}
|
||||||
|
|
||||||
public MachineUtil getUtil() {
|
public MachineUtil getUtil() {
|
||||||
return getMachine().getMachineUtil();
|
return getMachine().getMachineUtil();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package binnie.core.machines;
|
package binnie.core.machines;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
@@ -32,6 +31,11 @@ public abstract class MachinePackage {
|
|||||||
return I18N.localise(group.getMod().getModID() + ".machine." + group.getShortUID() + "." + getUID());
|
return I18N.localise(group.getMod().getModID() + ".machine." + group.getShortUID() + "." + getUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGuiDisplayName() {
|
||||||
|
String guiKey = group.getMod().getModID() + ".machine." + group.getShortUID() + "." + getUID() + ".title";
|
||||||
|
return I18N.canLocalise(guiKey) ? I18N.localise(guiKey) : getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getMetadata() {
|
public Integer getMetadata() {
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
@@ -48,8 +52,7 @@ public abstract class MachinePackage {
|
|||||||
this.group = group;
|
this.group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
public abstract void renderMachine(Machine machine, double x, double y, double z, float partialTick);
|
||||||
RenderBlocks renderer);
|
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import net.minecraft.client.renderer.RenderBlocks;
|
|||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
@@ -13,30 +12,27 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|||||||
// Hmm. It's used class
|
// Hmm. It's used class
|
||||||
public class RendererMachine extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
public class RendererMachine extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||||
|
|
||||||
RenderBlocks blockRenderer;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float partialTick) {
|
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float partialTick) {
|
||||||
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick, blockRenderer);
|
renderTileEntity((TileEntityMachine) entity, x, y, z, partialTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float partialTick,
|
private void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float partialTick) {
|
||||||
RenderBlocks renderer) {
|
|
||||||
if (entity != null && entity.getMachine() != null) {
|
if (entity != null && entity.getMachine() != null) {
|
||||||
MachinePackage machinePackage = entity.getMachine().getPackage();
|
MachinePackage machinePackage = entity.getMachine().getPackage();
|
||||||
machinePackage.renderMachine(entity.getMachine(), x, y, z, partialTick, renderer);
|
machinePackage.renderMachine(entity.getMachine(), x, y, z, partialTick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderInvBlock(RenderBlocks renderblocks, Block block, int i, int j) {
|
private void renderInvBlock(Block block, int i, int j) {
|
||||||
TileEntity entity = block.createTileEntity(null, i);
|
TileEntity entity = block.createTileEntity(null, i);
|
||||||
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f, renderblocks);
|
renderTileEntity((TileEntityMachine) entity, 0.0, -0.1, 0.0, 0.0625f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||||
if (modelID == Binnie.Machine.getMachineRenderID()) {
|
if (modelID == Binnie.Machine.getMachineRenderID()) {
|
||||||
renderInvBlock(renderer, block, metadata, modelID);
|
renderInvBlock(block, metadata, modelID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +44,7 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
|||||||
&& tile.getMachine().getPackage() != null
|
&& tile.getMachine().getPackage() != null
|
||||||
&& tile.getMachine().getPackage().getGroup() != null
|
&& tile.getMachine().getPackage().getGroup() != null
|
||||||
&& !tile.getMachine().getPackage().getGroup().customRenderer) {
|
&& !tile.getMachine().getPackage().getGroup().customRenderer) {
|
||||||
renderTileEntity(tile, x, y, z, 1.0f, renderer);
|
renderTileEntity(tile, x, y, z, 1.0f);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -62,9 +58,4 @@ public class RendererMachine extends TileEntitySpecialRenderer implements ISimpl
|
|||||||
public int getRenderId() {
|
public int getRenderId() {
|
||||||
return Binnie.Machine.getMachineRenderID();
|
return Binnie.Machine.getMachineRenderID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_147496_a(World par1World) {
|
|
||||||
blockRenderer = new RenderBlocks(par1World);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ public class ComponentChargedSlots extends MachineComponent implements INetwork.
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
if (!name.equals("slot-charges")) {
|
if (!name.equals("slot-charges")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package binnie.core.machines.inventory;
|
package binnie.core.machines.inventory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -16,10 +15,13 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import binnie.core.machines.IMachine;
|
import binnie.core.machines.IMachine;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
|
||||||
|
|
||||||
public class ComponentInventorySlots extends ComponentInventory implements IInventoryMachine, IInventorySlots {
|
public class ComponentInventorySlots extends ComponentInventory implements IInventoryMachine, IInventorySlots {
|
||||||
|
|
||||||
private final Map<Integer, InventorySlot> inventory = new LinkedHashMap<>();
|
private final Int2ObjectLinkedOpenHashMap<InventorySlot> inventory = new Int2ObjectLinkedOpenHashMap<>();
|
||||||
|
private int cachedSize = 0;
|
||||||
|
private int[] cachedAccessibleSlots = null;
|
||||||
|
|
||||||
public ComponentInventorySlots(IMachine machine) {
|
public ComponentInventorySlots(IMachine machine) {
|
||||||
super(machine);
|
super(machine);
|
||||||
@@ -27,25 +29,20 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory() {
|
public int getSizeInventory() {
|
||||||
int size = 0;
|
return cachedSize;
|
||||||
for (Integer index : inventory.keySet()) {
|
|
||||||
size = Math.max(size, index + 1);
|
|
||||||
}
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlot(int index) {
|
public ItemStack getStackInSlot(int index) {
|
||||||
if (inventory.containsKey(index)) {
|
InventorySlot slot = inventory.get(index);
|
||||||
return inventory.get(index).getContent();
|
return slot != null ? slot.getContent() : null;
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int index, int amount) {
|
public ItemStack decrStackSize(int index, int amount) {
|
||||||
if (inventory.containsKey(index)) {
|
InventorySlot slot = inventory.get(index);
|
||||||
ItemStack stack = inventory.get(index).decrStackSize(amount);
|
if (slot != null) {
|
||||||
|
ItemStack stack = slot.decrStackSize(amount);
|
||||||
markDirty();
|
markDirty();
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
@@ -59,8 +56,9 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int index, ItemStack itemStack) {
|
public void setInventorySlotContents(int index, ItemStack itemStack) {
|
||||||
if (inventory.containsKey(index) && (itemStack == null || inventory.get(index).isValid(itemStack))) {
|
InventorySlot slot = inventory.get(index);
|
||||||
inventory.get(index).setContent(itemStack);
|
if (slot != null && (itemStack == null || slot.isValid(itemStack))) {
|
||||||
|
slot.setContent(itemStack);
|
||||||
}
|
}
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
@@ -113,7 +111,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
super.writeToNBT(nbttagcompound);
|
super.writeToNBT(nbttagcompound);
|
||||||
NBTTagList inventoryNBT = new NBTTagList();
|
NBTTagList inventoryNBT = new NBTTagList();
|
||||||
for (Map.Entry<Integer, InventorySlot> entry : inventory.entrySet()) {
|
for (Map.Entry<Integer, InventorySlot> entry : inventory.int2ObjectEntrySet()) {
|
||||||
NBTTagCompound slotNBT = new NBTTagCompound();
|
NBTTagCompound slotNBT = new NBTTagCompound();
|
||||||
slotNBT.setInteger("id", entry.getKey());
|
slotNBT.setInteger("id", entry.getKey());
|
||||||
entry.getValue().writeToNBT(slotNBT);
|
entry.getValue().writeToNBT(slotNBT);
|
||||||
@@ -125,6 +123,8 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
@Override
|
@Override
|
||||||
public InventorySlot addSlot(int index, String unlocalizedName) {
|
public InventorySlot addSlot(int index, String unlocalizedName) {
|
||||||
inventory.put(index, new InventorySlot(index, unlocalizedName));
|
inventory.put(index, new InventorySlot(index, unlocalizedName));
|
||||||
|
cachedSize = Math.max(cachedSize, index + 1);
|
||||||
|
cachedAccessibleSlots = null;
|
||||||
return getSlot(index);
|
return getSlot(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,10 +138,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventorySlot getSlot(int index) {
|
public InventorySlot getSlot(int index) {
|
||||||
if (inventory.containsKey(index)) {
|
return inventory.get(index);
|
||||||
return inventory.get(index);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -151,7 +148,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventorySlot[] getSlots(int[] indexes) {
|
public InventorySlot[] getSlots(int[] indexes) {
|
||||||
List<InventorySlot> list = new ArrayList<>();
|
List<InventorySlot> list = new ArrayList<>(indexes.length);
|
||||||
for (int i : indexes) {
|
for (int i : indexes) {
|
||||||
if (getSlot(i) != null) {
|
if (getSlot(i) != null) {
|
||||||
list.add(getSlot(i));
|
list.add(getSlot(i));
|
||||||
@@ -213,18 +210,20 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||||
List<Integer> slots = new ArrayList<>();
|
if (cachedAccessibleSlots == null) {
|
||||||
for (InventorySlot slot : inventory.values()) {
|
List<Integer> slots = new ArrayList<>();
|
||||||
if (slot.canInsert() || slot.canExtract()) {
|
for (InventorySlot slot : inventory.values()) {
|
||||||
slots.add(slot.getIndex());
|
if (slot.canInsert() || slot.canExtract()) {
|
||||||
|
slots.add(slot.getIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedAccessibleSlots = new int[slots.size()];
|
||||||
|
for (int i = 0; i < slots.size(); ++i) {
|
||||||
|
cachedAccessibleSlots[i] = slots.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return cachedAccessibleSlots;
|
||||||
int[] ids = new int[slots.size()];
|
|
||||||
for (int i = 0; i < slots.size(); ++i) {
|
|
||||||
ids[i] = slots.get(i);
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -234,6 +233,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slot, ItemStack itemstack, int direction) {
|
public boolean canExtractItem(int slot, ItemStack itemstack, int direction) {
|
||||||
return getSlot(slot).canExtract(ForgeDirection.getOrientation(direction));
|
InventorySlot iSlot = getSlot(slot);
|
||||||
|
return iSlot != null && iSlot.canExtract(ForgeDirection.getOrientation(direction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,11 @@ public interface INetwork {
|
|||||||
void syncFromNBT(NBTTagCompound nbt);
|
void syncFromNBT(NBTTagCompound nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RecieveGuiNBT {
|
interface ReceiveGuiNBT {
|
||||||
|
|
||||||
void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt);
|
void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GuiNBT extends RecieveGuiNBT, SendGuiNBT {
|
interface GuiNBT extends ReceiveGuiNBT, SendGuiNBT {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,4 +9,11 @@ public interface IProcess extends IErrorStateSource {
|
|||||||
boolean isInProgress();
|
boolean isInProgress();
|
||||||
|
|
||||||
ProcessInfo getInfo();
|
ProcessInfo getInfo();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns true if the current target got worked on at least once.
|
||||||
|
*/
|
||||||
|
default boolean workedOnTarget() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package binnie.core.machines.storage;
|
package binnie.core.machines.storage;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
@@ -51,8 +50,7 @@ enum Compartment implements IMachineType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||||
RenderBlocks renderer) {
|
|
||||||
MachineRendererCompartment.instance.renderMachine(machine, renderTexture, x, y, z);
|
MachineRendererCompartment.instance.renderMachine(machine, renderTexture, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class CompartmentTab implements INBTTagable {
|
|||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
name = nbt.getString("name");
|
name = nbt.getString("name");
|
||||||
icon = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("icon"));
|
icon = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("icon"));
|
||||||
color = EnumColor.values()[nbt.getByte("color")];
|
color = EnumColor.VALUES[nbt.getByte("color")];
|
||||||
id = nbt.getByte("id");
|
id = nbt.getByte("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
if (name.equals("comp-tabs")) {
|
if (name.equals("comp-tabs")) {
|
||||||
NBTTagList tags = nbt.getTagList("tabs", 10);
|
NBTTagList tags = nbt.getTagList("tabs", 10);
|
||||||
for (int i = 0; i < tags.tagCount(); ++i) {
|
for (int i = 0; i < tags.tagCount(); ++i) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import net.minecraft.init.Items;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
@@ -42,6 +43,7 @@ import binnie.core.craftgui.geometry.Position;
|
|||||||
import binnie.core.craftgui.minecraft.Dialog;
|
import binnie.core.craftgui.minecraft.Dialog;
|
||||||
import binnie.core.craftgui.minecraft.EnumColor;
|
import binnie.core.craftgui.minecraft.EnumColor;
|
||||||
import binnie.core.craftgui.minecraft.IWindowAffectsShiftClick;
|
import binnie.core.craftgui.minecraft.IWindowAffectsShiftClick;
|
||||||
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
import binnie.core.craftgui.minecraft.MinecraftGUI;
|
import binnie.core.craftgui.minecraft.MinecraftGUI;
|
||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||||
@@ -55,6 +57,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
|||||||
import binnie.core.craftgui.window.Panel;
|
import binnie.core.craftgui.window.Panel;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.transfer.TransferRequest;
|
import binnie.core.machines.transfer.TransferRequest;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import binnie.genetics.craftgui.WindowMachine;
|
import binnie.genetics.craftgui.WindowMachine;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -80,7 +83,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
|
setTitle(Machine.getMachine(getInventory()).getPackage().getGuiDisplayName());
|
||||||
int x = 16;
|
int x = 16;
|
||||||
int y = 32;
|
int y = 32;
|
||||||
ComponentCompartmentInventory inv = Machine.getMachine(getInventory())
|
ComponentCompartmentInventory inv = Machine.getMachine(getInventory())
|
||||||
@@ -187,7 +190,11 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
for (int k = 0; k < inv.getPageSize(); ++k) {
|
for (int k = 0; k < inv.getPageSize(); ++k) {
|
||||||
slotsIDs[k] = i++;
|
slotsIDs[k] = i++;
|
||||||
}
|
}
|
||||||
new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5).create(slotsIDs);
|
|
||||||
|
final NBTTagList actions = new NBTTagList();
|
||||||
|
new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5)
|
||||||
|
.create(actions, InventoryType.Machine, slotsIDs);
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
}
|
}
|
||||||
x += compartmentPageWidth;
|
x += compartmentPageWidth;
|
||||||
if (tabs2.length > 0) {
|
if (tabs2.length > 0) {
|
||||||
@@ -245,7 +252,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
|
|
||||||
setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h()));
|
setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h()));
|
||||||
controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0f, controlCompartment.y()));
|
controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0f, controlCompartment.y()));
|
||||||
new ControlPlayerInventory(this, true);
|
new ControlPlayerInventory(this, true).createAndRegister();
|
||||||
ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.LEFT);
|
ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.LEFT);
|
||||||
slide.setLabel(I18N.localise("binniecore.machine.storage.tab.properties"));
|
slide.setLabel(I18N.localise("binniecore.machine.storage.tab.properties"));
|
||||||
slide.setSlide(false);
|
slide.setSlide(false);
|
||||||
@@ -313,7 +320,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
1 + cw * (cc / 8),
|
1 + cw * (cc / 8),
|
||||||
cw,
|
cw,
|
||||||
cw,
|
cw,
|
||||||
EnumColor.values()[cc]);
|
EnumColor.VALUES[cc]);
|
||||||
color.addSelfEventHandler(new EventMouse.Down.Handler() {
|
color.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -367,7 +374,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
};
|
};
|
||||||
slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f);
|
slotGrid = new Control(scroll, 1.0f, 1.0f, 108.0f, 18.0f);
|
||||||
scroll.setScrollableContent(slotGrid);
|
scroll.setScrollableContent(slotGrid);
|
||||||
new ControlPlayerInventory(this, true);
|
new ControlPlayerInventory(this, true).createAndRegister();
|
||||||
new ControlTextEdit(this, 16.0f, 16.0f, 100.0f, 14.0f).addEventHandler(new EventTextEdit.Handler() {
|
new ControlTextEdit(this, 16.0f, 16.0f, 100.0f, 14.0f).addEventHandler(new EventTextEdit.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -459,8 +466,10 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
slotGrid.deleteAllChildren();
|
slotGrid.deleteAllChildren();
|
||||||
slotGrid.setSize(new IPoint(width, height));
|
slotGrid.setSize(new IPoint(width, height));
|
||||||
|
|
||||||
|
final NBTTagList actions = new NBTTagList();
|
||||||
|
|
||||||
for (int k : slotIds.keySet()) {
|
for (int k : slotIds.keySet()) {
|
||||||
new ControlSlot(slotGrid, x, y).assign(k);
|
new ControlSlot(slotGrid, x, y).assign(actions, InventoryType.Machine, k);
|
||||||
x += 18;
|
x += 18;
|
||||||
if (x >= 108) {
|
if (x >= 108) {
|
||||||
x = 0;
|
x = 0;
|
||||||
@@ -468,6 +477,8 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
|
|
||||||
while (y < 108 || x != 0) {
|
while (y < 108 || x != 0) {
|
||||||
new ControlSlot(slotGrid, x, y);
|
new ControlSlot(slotGrid, x, y);
|
||||||
x += 18;
|
x += 18;
|
||||||
@@ -488,14 +499,16 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
|||||||
|
|
||||||
public void updateTabs() {
|
public void updateTabs() {
|
||||||
CompartmentTab tab = getCurrentTab();
|
CompartmentTab tab = getCurrentTab();
|
||||||
tabName.setValue(tab.getName());
|
if (!tabName.isFocused()) {
|
||||||
|
tabName.setValue(tab.getName());
|
||||||
|
}
|
||||||
tabIcon.setItemStack(tab.getIcon());
|
tabIcon.setItemStack(tab.getIcon());
|
||||||
tabColour.setValue(tab.getColor());
|
tabColour.setValue(tab.getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.recieveGuiNBT(side, player, name, nbt);
|
super.receiveGuiNBT(side, player, name, nbt);
|
||||||
if (name.equals("tab-change")) {
|
if (name.equals("tab-change")) {
|
||||||
currentTab = nbt.getByte("i");
|
currentTab = nbt.getByte("i");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
package binnie.core.mod.parser;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
|
||||||
|
|
||||||
public abstract class FieldParser {
|
|
||||||
|
|
||||||
public static Collection<FieldParser> parsers = new ArrayList<>();
|
|
||||||
|
|
||||||
public abstract boolean isHandled(Field field, AbstractMod mod);
|
|
||||||
|
|
||||||
public void preInit(Field field, AbstractMod mod) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Field field, AbstractMod mod) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
public void postInit(Field field, AbstractMod mod) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void preInitParse(Field field, AbstractMod mod)
|
|
||||||
throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
for (FieldParser parser : FieldParser.parsers) {
|
|
||||||
if (parser.isHandled(field, mod)) {
|
|
||||||
parser.preInit(field, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initParse(Field field, AbstractMod mod) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
for (FieldParser parser : FieldParser.parsers) {
|
|
||||||
if (parser.isHandled(field, mod)) {
|
|
||||||
parser.init(field, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void postInitParse(Field field, AbstractMod mod)
|
|
||||||
throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
for (FieldParser parser : FieldParser.parsers) {
|
|
||||||
if (parser.isHandled(field, mod)) {
|
|
||||||
parser.postInit(field, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package binnie.core.mod.parser;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
public class ItemParser extends FieldParser {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHandled(Field field, AbstractMod mod) {
|
|
||||||
return Item.class.isAssignableFrom(field.getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void preInit(Field field, AbstractMod mod) throws IllegalArgumentException, IllegalAccessException {
|
|
||||||
Item item = (Item) field.get(null);
|
|
||||||
if (item != null) {
|
|
||||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package binnie.core.network;
|
package binnie.core.network;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetHandlerPlayServer;
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
@@ -27,41 +28,71 @@ public enum BinnieCorePacketID implements IPacketID {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||||
if (this == BinnieCorePacketID.NetworkEntityUpdate) {
|
switch (this) {
|
||||||
MessageUpdate packet = new MessageUpdate(message);
|
case NetworkEntityUpdate -> processNetworkEntityUpdate(message);
|
||||||
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
case TileMetadata -> processTileMetadata(message);
|
||||||
if (tile instanceof INetworkedEntity) {
|
case CraftGUIAction -> processCraftGUIAction(message, context);
|
||||||
((INetworkedEntity) tile).readFromPacket(packet.payload);
|
case TileDescriptionSync -> processTileDescriptionSync(message, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processNetworkEntityUpdate(MessageBinnie message) {
|
||||||
|
final MessageUpdate packet = new MessageUpdate(message);
|
||||||
|
final TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
||||||
|
|
||||||
|
if (tile instanceof INetworkedEntity iNetworkedEntity) {
|
||||||
|
iNetworkedEntity.readFromPacket(packet.payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processTileMetadata(MessageBinnie message) {
|
||||||
|
final MessageMetadata packet = new MessageMetadata(message);
|
||||||
|
final TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
||||||
|
|
||||||
|
if (tile instanceof TileEntityMetadata tileEntityMetadata) {
|
||||||
|
tileEntityMetadata.setTileMetadata(packet.meta, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processCraftGUIAction(MessageBinnie message, MessageContext context) {
|
||||||
|
final MessageCraftGUI packet = new MessageCraftGUI(message);
|
||||||
|
final NBTTagCompound tagCompound = packet.getTagCompound();
|
||||||
|
|
||||||
|
if (tagCompound == null) return;
|
||||||
|
|
||||||
|
if (context.side == Side.CLIENT) {
|
||||||
|
final EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||||
|
|
||||||
|
if (player.openContainer instanceof ContainerCraftGUI gui) {
|
||||||
|
gui.receiveNBT(Side.CLIENT, player, tagCompound);
|
||||||
}
|
}
|
||||||
} else if (this == BinnieCorePacketID.TileMetadata) {
|
} else {
|
||||||
MessageMetadata packet = new MessageMetadata(message);
|
if (context.netHandler instanceof NetHandlerPlayServer server) {
|
||||||
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
final EntityPlayer player = server.playerEntity;
|
||||||
if (tile instanceof TileEntityMetadata) {
|
|
||||||
((TileEntityMetadata) tile).setTileMetadata(packet.meta, true);
|
if (player.openContainer instanceof ContainerCraftGUI gui) {
|
||||||
}
|
gui.receiveNBT(Side.SERVER, player, tagCompound);
|
||||||
} else if (this == BinnieCorePacketID.CraftGUIAction) {
|
|
||||||
if (context.side == Side.CLIENT) {
|
|
||||||
MessageCraftGUI packet = new MessageCraftGUI(message);
|
|
||||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
|
||||||
if (player.openContainer instanceof ContainerCraftGUI && packet.getTagCompound() != null) {
|
|
||||||
((ContainerCraftGUI) player.openContainer).recieveNBT(Side.CLIENT, player, packet.getTagCompound());
|
|
||||||
}
|
|
||||||
} else if (context.netHandler instanceof NetHandlerPlayServer) {
|
|
||||||
MessageCraftGUI packet = new MessageCraftGUI(message);
|
|
||||||
EntityPlayer player = ((NetHandlerPlayServer) context.netHandler).playerEntity;
|
|
||||||
if (player.openContainer instanceof ContainerCraftGUI && packet.getTagCompound() != null) {
|
|
||||||
((ContainerCraftGUI) player.openContainer).recieveNBT(Side.SERVER, player, packet.getTagCompound());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (this == BinnieCorePacketID.TileDescriptionSync && context.side == Side.CLIENT) {
|
|
||||||
MessageTileNBT packet = new MessageTileNBT(message);
|
|
||||||
TileEntity tile = packet.getTarget(BinnieCore.proxy.getWorld());
|
|
||||||
if (tile != null && packet.getTagCompound() != null) {
|
|
||||||
IMachine machine = Machine.getMachine(tile);
|
|
||||||
if (machine instanceof INetwork.TilePacketSync tps) {
|
|
||||||
tps.syncFromNBT(packet.getTagCompound());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void processTileDescriptionSync(MessageBinnie message, MessageContext context) {
|
||||||
|
if (!context.side.isClient()) return;
|
||||||
|
|
||||||
|
final MessageTileNBT packet = new MessageTileNBT(message);
|
||||||
|
final NBTTagCompound tagCompound = packet.getTagCompound();
|
||||||
|
|
||||||
|
if (tagCompound == null) return;
|
||||||
|
|
||||||
|
final TileEntity tile = packet.getTarget(BinnieCore.proxy.getWorld());
|
||||||
|
|
||||||
|
if (tile == null) return;
|
||||||
|
|
||||||
|
final IMachine machine = Machine.getMachine(tile);
|
||||||
|
|
||||||
|
if (machine instanceof INetwork.TilePacketSync tps) {
|
||||||
|
tps.syncFromNBT(tagCompound);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
package binnie.core.network.packet;
|
package binnie.core.network.packet;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTIONS;
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTION_BATCH;
|
||||||
|
import static binnie.core.craftgui.minecraft.ContainerCraftGUI.ACTION_TYPE;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
import binnie.core.network.BinnieCorePacketID;
|
import binnie.core.network.BinnieCorePacketID;
|
||||||
|
|
||||||
public class MessageCraftGUI extends MessageNBT {
|
public class MessageCraftGUI extends MessageNBT {
|
||||||
@@ -13,4 +19,12 @@ public class MessageCraftGUI extends MessageNBT {
|
|||||||
public MessageCraftGUI(NBTTagCompound action) {
|
public MessageCraftGUI(NBTTagCompound action) {
|
||||||
super(BinnieCorePacketID.CraftGUIAction.ordinal(), action);
|
super(BinnieCorePacketID.CraftGUIAction.ordinal(), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendToServer(NBTTagList actions) {
|
||||||
|
NBTTagCompound actionsBatch = new NBTTagCompound();
|
||||||
|
actionsBatch.setString(ACTION_TYPE, ACTION_BATCH);
|
||||||
|
actionsBatch.setTag(ACTIONS, actions);
|
||||||
|
final MessageCraftGUI packet = new MessageCraftGUI(actionsBatch);
|
||||||
|
BinnieCore.proxy.sendToServer(packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package binnie.extrabees;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
|
|
||||||
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||||
@@ -11,6 +10,7 @@ import binnie.core.AbstractMod;
|
|||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import binnie.core.Tags;
|
import binnie.core.Tags;
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
|
import binnie.core.item.ItemMisc;
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
import binnie.core.proxy.IProxyCore;
|
import binnie.core.proxy.IProxyCore;
|
||||||
import binnie.extrabees.apiary.ModuleApiary;
|
import binnie.extrabees.apiary.ModuleApiary;
|
||||||
@@ -18,7 +18,11 @@ import binnie.extrabees.config.EBConfig;
|
|||||||
import binnie.extrabees.core.ExtraBeeGUID;
|
import binnie.extrabees.core.ExtraBeeGUID;
|
||||||
import binnie.extrabees.core.ModuleCore;
|
import binnie.extrabees.core.ModuleCore;
|
||||||
import binnie.extrabees.genetics.ModuleGenetics;
|
import binnie.extrabees.genetics.ModuleGenetics;
|
||||||
|
import binnie.extrabees.genetics.items.ItemDictionary;
|
||||||
import binnie.extrabees.liquids.ModuleLiquids;
|
import binnie.extrabees.liquids.ModuleLiquids;
|
||||||
|
import binnie.extrabees.products.ItemHoneyComb;
|
||||||
|
import binnie.extrabees.products.ItemHoneyDrop;
|
||||||
|
import binnie.extrabees.products.ItemPropolis;
|
||||||
import binnie.extrabees.products.ModuleProducts;
|
import binnie.extrabees.products.ModuleProducts;
|
||||||
import binnie.extrabees.proxy.ExtraBeesProxy;
|
import binnie.extrabees.proxy.ExtraBeesProxy;
|
||||||
import binnie.extrabees.worldgen.ModuleGeneration;
|
import binnie.extrabees.worldgen.ModuleGeneration;
|
||||||
@@ -58,11 +62,11 @@ public class ExtraBees extends AbstractMod {
|
|||||||
public static Block hive;
|
public static Block hive;
|
||||||
public static Material materialBeehive;
|
public static Material materialBeehive;
|
||||||
public static Block ectoplasm;
|
public static Block ectoplasm;
|
||||||
public static Item comb;
|
public static ItemHoneyComb comb;
|
||||||
public static Item propolis;
|
public static ItemPropolis propolis;
|
||||||
public static Item honeyDrop;
|
public static ItemHoneyDrop honeyDrop;
|
||||||
public static Item dictionary;
|
public static ItemDictionary dictionary;
|
||||||
public static Item itemMisc;
|
public static ItemMisc itemMisc;
|
||||||
|
|
||||||
public ExtraBees() {
|
public ExtraBees() {
|
||||||
ExtraBees.instance = this;
|
ExtraBees.instance = this;
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ public class ModuleApiary implements IInitializable {
|
|||||||
BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
|
BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine"));
|
||||||
ModuleApiary.blockComponent = machineGroup.getBlock();
|
ModuleApiary.blockComponent = machineGroup.getBlock();
|
||||||
AlvearyMutator.addMutationItem(new ItemStack(Blocks.soul_sand), 1.5f);
|
AlvearyMutator.addMutationItem(new ItemStack(Blocks.soul_sand), 1.5f);
|
||||||
AlvearyMutator.addMutationItem(Mods.ic2.stack("UranFuel"), 8.0f);
|
AlvearyMutator.addMutationItem(Mods.ic2.stack("itemUran"), 8.0f);
|
||||||
AlvearyMutator.addMutationItem(Mods.ic2.stack("Plutonium"), 15.0f);
|
AlvearyMutator.addMutationItem(Mods.ic2.stack("itemPlutonium"), 15.0f);
|
||||||
AlvearyMutator.addMutationItem(Mods.ic2.stack("smallPlutonium"), 9.0f);
|
AlvearyMutator.addMutationItem(Mods.ic2.stack("itemPlutoniumSmall"), 9.0f);
|
||||||
AlvearyMutator.addMutationItem(Mods.ic2.stack("Uran235"), 10.0f);
|
AlvearyMutator.addMutationItem(Mods.ic2.stack("itemUran235"), 10.0f);
|
||||||
AlvearyMutator.addMutationItem(Mods.ic2.stack("smallUran235"), 5.5f);
|
AlvearyMutator.addMutationItem(Mods.ic2.stack("itemUran235small"), 5.5f);
|
||||||
AlvearyMutator.addMutationItem(Mods.ic2.stack("Uran238"), 2.0f);
|
AlvearyMutator.addMutationItem(Mods.ic2.stack("itemUran238"), 2.0f);
|
||||||
AlvearyMutator.addMutationItem(new ItemStack(Items.nether_star), 50.0f);
|
AlvearyMutator.addMutationItem(new ItemStack(Items.nether_star), 50.0f);
|
||||||
AlvearyMutator.addMutationItem(new ItemStack(Items.ender_pearl), 2.0f);
|
AlvearyMutator.addMutationItem(new ItemStack(Items.ender_pearl), 2.0f);
|
||||||
AlvearyMutator.addMutationItem(new ItemStack(Items.ender_eye), 4.0f);
|
AlvearyMutator.addMutationItem(new ItemStack(Items.ender_eye), 4.0f);
|
||||||
|
|||||||
@@ -6,14 +6,23 @@ import java.util.List;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
import net.minecraft.util.ChunkCoordinates;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import binnie.core.machines.TileEntityMachine;
|
import binnie.core.machines.TileEntityMachine;
|
||||||
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
||||||
import forestry.api.apiculture.IBeeGenome;
|
import forestry.api.apiculture.IBeeGenome;
|
||||||
|
import forestry.api.apiculture.IBeeHousing;
|
||||||
|
import forestry.api.apiculture.IBeeHousingInventory;
|
||||||
import forestry.api.apiculture.IBeeListener;
|
import forestry.api.apiculture.IBeeListener;
|
||||||
import forestry.api.apiculture.IBeeModifier;
|
import forestry.api.apiculture.IBeeModifier;
|
||||||
|
import forestry.api.apiculture.IBeekeepingLogic;
|
||||||
|
import forestry.api.core.EnumHumidity;
|
||||||
|
import forestry.api.core.EnumTemperature;
|
||||||
|
import forestry.api.core.IErrorLogic;
|
||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
import forestry.api.multiblock.IAlvearyComponent;
|
import forestry.api.multiblock.IAlvearyComponent;
|
||||||
import forestry.api.multiblock.IMultiblockComponent;
|
import forestry.api.multiblock.IMultiblockComponent;
|
||||||
@@ -21,7 +30,7 @@ import forestry.api.multiblock.IMultiblockController;
|
|||||||
import forestry.api.multiblock.IMultiblockLogicAlveary;
|
import forestry.api.multiblock.IMultiblockLogicAlveary;
|
||||||
import forestry.api.multiblock.MultiblockManager;
|
import forestry.api.multiblock.MultiblockManager;
|
||||||
|
|
||||||
public class TileExtraBeeAlveary extends TileEntityMachine implements IAlvearyComponent.Active,
|
public class TileExtraBeeAlveary extends TileEntityMachine implements IBeeHousing, IAlvearyComponent.Active,
|
||||||
IAlvearyComponent.BeeModifier, IAlvearyComponent.BeeListener, IBeeListener, IBeeModifier {
|
IAlvearyComponent.BeeModifier, IAlvearyComponent.BeeListener, IBeeListener, IBeeModifier {
|
||||||
|
|
||||||
protected IMultiblockLogicAlveary structureLogic;
|
protected IMultiblockLogicAlveary structureLogic;
|
||||||
@@ -42,11 +51,51 @@ public class TileExtraBeeAlveary extends TileEntityMachine implements IAlvearyCo
|
|||||||
return new ChunkCoordinates(xCoord, yCoord, zCoord);
|
return new ChunkCoordinates(xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<IBeeModifier> getBeeModifiers() {
|
||||||
|
return getMultiblockLogic().getController().getBeeModifiers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<IBeeListener> getBeeListeners() {
|
||||||
|
return getMultiblockLogic().getController().getBeeListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBeeHousingInventory getBeeInventory() {
|
||||||
|
return getMultiblockLogic().getController().getBeeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBeekeepingLogic getBeekeepingLogic() {
|
||||||
|
return getMultiblockLogic().getController().getBeekeepingLogic();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBlockLightValue() {
|
||||||
|
return getMultiblockLogic().getController().getBlockLightValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBlockSeeTheSky() {
|
||||||
|
return getMultiblockLogic().getController().canBlockSeeTheSky();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World getWorld() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameProfile getOwner() {
|
public GameProfile getOwner() {
|
||||||
return getMachine().getOwner();
|
return getMachine().getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vec3 getBeeFXCoordinates() {
|
||||||
|
return getMultiblockLogic().getController().getBeeFXCoordinates();
|
||||||
|
}
|
||||||
|
|
||||||
public List<TileEntity> getAlvearyBlocks() {
|
public List<TileEntity> getAlvearyBlocks() {
|
||||||
LinkedList<TileEntity> tiles = new LinkedList<>();
|
LinkedList<TileEntity> tiles = new LinkedList<>();
|
||||||
if (min == null || max == null) {
|
if (min == null || max == null) {
|
||||||
@@ -226,6 +275,26 @@ public class TileExtraBeeAlveary extends TileEntityMachine implements IAlvearyCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeGenBase getBiome() {
|
||||||
|
return getMultiblockLogic().getController().getBiome();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumTemperature getTemperature() {
|
||||||
|
return getMultiblockLogic().getController().getTemperature();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumHumidity getHumidity() {
|
||||||
|
return getMultiblockLogic().getController().getHumidity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IErrorLogic getErrorLogic() {
|
||||||
|
return getMultiblockLogic().getController().getErrorLogic();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO why its commented?
|
// TODO why its commented?
|
||||||
// boolean init;
|
// boolean init;
|
||||||
// //IStructureLogic structureLogic;
|
// //IStructureLogic structureLogic;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package binnie.extrabees.apiary.machine;
|
package binnie.extrabees.apiary.machine;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
@@ -66,8 +65,7 @@ public enum AlvearyMachine implements IMachineType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick,
|
public void renderMachine(Machine machine, double x, double y, double z, float partialTick) {
|
||||||
RenderBlocks renderer) {
|
|
||||||
MachineRendererBlock.instance.renderMachine(machineTexture, x, y, z, partialTick);
|
MachineRendererBlock.instance.renderMachine(machineTexture, x, y, z, partialTick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ public class MutatorModifierComponent extends ComponentBeeModifier implements IB
|
|||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float mult = AlvearyMutator.getMutationMult(getUtil().getStack(AlvearyMutator.SLOT_MUTATOR));
|
return AlvearyMutator.getMutationMult(getUtil().getStack(AlvearyMutator.SLOT_MUTATOR));
|
||||||
return Math.min(mult, 15.0f / currentModifier);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -48,8 +48,8 @@ public class TransmissionModifierComponent extends ComponentBeeModifier implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (IEnergyHandler handler : handlers) {
|
for (IEnergyHandler handler : handlers) {
|
||||||
int recieved = handler.receiveEnergy(ForgeDirection.NORTH, output, false);
|
int received = handler.receiveEnergy(ForgeDirection.NORTH, output, false);
|
||||||
getUtil().getPoweredMachine().receiveEnergy(ForgeDirection.NORTH, -recieved, false);
|
getUtil().getPoweredMachine().receiveEnergy(ForgeDirection.NORTH, -received, false);
|
||||||
energy = getUtil().getPoweredMachine().getEnergyStored(ForgeDirection.NORTH);
|
energy = getUtil().getPoweredMachine().getEnergyStored(ForgeDirection.NORTH);
|
||||||
if (energy <= 0) {
|
if (energy <= 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package binnie.extrabees.core;
|
package binnie.extrabees.core;
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.IInitializable;
|
import binnie.core.IInitializable;
|
||||||
|
import binnie.core.item.ItemMisc;
|
||||||
import binnie.extrabees.ExtraBees;
|
import binnie.extrabees.ExtraBees;
|
||||||
import forestry.api.core.Tabs;
|
import forestry.api.core.Tabs;
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ public class ModuleCore implements IInitializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
ExtraBees.itemMisc = Binnie.Item.registerMiscItems(ExtraBeeItems.values(), Tabs.tabApiculture);
|
ExtraBees.itemMisc = new ItemMisc(Tabs.tabApiculture, ExtraBeeItems.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -389,34 +389,27 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onFoodEffect(IBeeGenome genome, IBeeHousing housing) {
|
private void onFoodEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||||
for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
|
for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) {
|
||||||
if (entity instanceof EntityPlayer player) {
|
player.getFoodStats().addStats(2, 0.2f);
|
||||||
player.getFoodStats().addStats(2, 0.2f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onHungerEffect(IBeeGenome genome, IBeeHousing housing, World world) {
|
private void onHungerEffect(IBeeGenome genome, IBeeHousing housing, World world) {
|
||||||
for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
|
for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) {
|
||||||
if (entity instanceof EntityPlayer player) {
|
if (world.rand.nextInt(4) < wearsItems(player)) {
|
||||||
if (world.rand.nextInt(4) < wearsItems(player)) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.getFoodStats().addExhaustion(4.0f);
|
|
||||||
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
|
|
||||||
}
|
}
|
||||||
|
player.addExhaustion(4.0f);
|
||||||
|
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPotionEffect(IBeeGenome genome, IBeeHousing housing, World world, PotionEffect potion) {
|
private void onPotionEffect(IBeeGenome genome, IBeeHousing housing, World world, PotionEffect potion) {
|
||||||
for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) {
|
for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) {
|
||||||
if (entity instanceof EntityPlayer player) {
|
if (world.rand.nextInt(4) < wearsItems(player)) {
|
||||||
if (world.rand.nextInt(4) < wearsItems(player)) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
player.addPotionEffect(potion);
|
|
||||||
}
|
}
|
||||||
|
player.addPotionEffect(potion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,13 +604,16 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
|||||||
|
|
||||||
public <T extends Entity> List<T> getEntities(Class<T> eClass, IBeeGenome genome, IBeeHousing housing) {
|
public <T extends Entity> List<T> getEntities(Class<T> eClass, IBeeGenome genome, IBeeHousing housing) {
|
||||||
int[] area = genome.getTerritory();
|
int[] area = genome.getTerritory();
|
||||||
int[] offset = { -Math.round(area[0] / 2f), -Math.round(area[1] / 2f), -Math.round(area[2] / 2f) };
|
int offsetX = -Math.round(area[0] / 2f);
|
||||||
int[] min = { housing.getCoordinates().posX + offset[0], housing.getCoordinates().posY + offset[1],
|
int offsetY = -Math.round(area[1] / 2f);
|
||||||
housing.getCoordinates().posZ + offset[2] };
|
int offsetZ = -Math.round(area[2] / 2f);
|
||||||
int[] max = { housing.getCoordinates().posX + offset[0] + area[0],
|
int minX = housing.getCoordinates().posX + offsetX;
|
||||||
housing.getCoordinates().posY + offset[1] + area[1],
|
int minY = housing.getCoordinates().posY + offsetY;
|
||||||
housing.getCoordinates().posZ + offset[2] + area[2] };
|
int minZ = housing.getCoordinates().posZ + offsetZ;
|
||||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
|
int maxX = housing.getCoordinates().posX + offsetX + area[0];
|
||||||
|
int maxY = housing.getCoordinates().posY + offsetY + area[1];
|
||||||
|
int maxZ = housing.getCoordinates().posZ + offsetZ + area[2];
|
||||||
|
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
return housing.getWorld().getEntitiesWithinAABB(eClass, box);
|
return housing.getWorld().getEntitiesWithinAABB(eClass, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.extrabees.genetics.items;
|
package binnie.extrabees.genetics.items;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -25,6 +27,8 @@ public class ItemDictionary extends Item {
|
|||||||
setCreativeTab(Tabs.tabApiculture);
|
setCreativeTab(Tabs.tabApiculture);
|
||||||
setUnlocalizedName("dictionary");
|
setUnlocalizedName("dictionary");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
|
||||||
|
registerItem(this, getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,14 +2,16 @@ package binnie.extrabees.gui;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.TileEntityMachine;
|
import binnie.core.machines.TileEntityMachine;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.extrabees.ExtraBees;
|
import binnie.extrabees.ExtraBees;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
@@ -32,10 +34,11 @@ public class WindowAlvearyFrame extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
setTitle(I18N.localise("extrabees.machine.alveay.frame"));
|
setTitle(machine.getPackage().getGuiDisplayName());
|
||||||
playerInventory = new ControlPlayerInventory(this);
|
final NBTTagList actions = new NBTTagList();
|
||||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
playerInventory = new ControlPlayerInventory(this).create(actions);
|
||||||
slot.assign(0);
|
new ControlSlot(this, 79.0f, 30.0f).assign(actions, InventoryType.Machine, 0);
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,14 +2,16 @@ package binnie.extrabees.gui;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.TileEntityMachine;
|
import binnie.core.machines.TileEntityMachine;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.extrabees.ExtraBees;
|
import binnie.extrabees.ExtraBees;
|
||||||
import binnie.extrabees.apiary.machine.hatchery.AlvearyHatchery;
|
import binnie.extrabees.apiary.machine.hatchery.AlvearyHatchery;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -33,10 +35,11 @@ public class WindowAlvearyHatchery extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
setTitle(I18N.localise("extrabees.machine.alveay.hatchery"));
|
final NBTTagList actions = new NBTTagList();
|
||||||
playerInventory = new ControlPlayerInventory(this);
|
setTitle(machine.getPackage().getGuiDisplayName());
|
||||||
ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1);
|
playerInventory = new ControlPlayerInventory(this).create(actions);
|
||||||
slot.create(AlvearyHatchery.SLOT_LARVAE);
|
new ControlSlotArray(this, 43, 30, 5, 1).create(actions, InventoryType.Machine, AlvearyHatchery.SLOT_LARVAE);
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,17 +3,21 @@ package binnie.extrabees.gui;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.craftgui.controls.ControlText;
|
import binnie.core.craftgui.controls.ControlText;
|
||||||
import binnie.core.craftgui.geometry.IArea;
|
import binnie.core.craftgui.geometry.IArea;
|
||||||
|
import binnie.core.craftgui.geometry.IPoint;
|
||||||
import binnie.core.craftgui.geometry.TextJustification;
|
import binnie.core.craftgui.geometry.TextJustification;
|
||||||
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.TileEntityMachine;
|
import binnie.core.machines.TileEntityMachine;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import binnie.extrabees.ExtraBees;
|
import binnie.extrabees.ExtraBees;
|
||||||
import binnie.extrabees.apiary.machine.mutator.AlvearyMutator;
|
import binnie.extrabees.apiary.machine.mutator.AlvearyMutator;
|
||||||
@@ -38,17 +42,18 @@ public class WindowAlvearyMutator extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
setTitle(I18N.localise("extrabees.machine.alveay.mutator"));
|
final NBTTagList actions = new NBTTagList();
|
||||||
playerInventory = new ControlPlayerInventory(this);
|
|
||||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
setTitle(machine.getPackage().getGuiDisplayName());
|
||||||
slot.assign(AlvearyMutator.SLOT_MUTATOR);
|
playerInventory = new ControlPlayerInventory(this).create(actions);
|
||||||
|
new ControlSlot(this, 79.0f, 30.0f).assign(actions, InventoryType.Machine, AlvearyMutator.SLOT_MUTATOR);
|
||||||
new ControlText(
|
new ControlText(
|
||||||
this,
|
this,
|
||||||
new IArea(0.0f, 52.0f, w(), 16.0f),
|
new IArea(0.0f, 52.0f, w(), 16.0f),
|
||||||
I18N.localise("extrabees.machine.alveay.mutator.mutagens"),
|
I18N.localise("extrabees.machine.alveay.mutator.mutagens"),
|
||||||
TextJustification.MIDDLE_CENTER).setColor(0x555555);
|
TextJustification.MIDDLE_CENTER).setColor(0x555555);
|
||||||
int size = AlvearyMutator.getMutagens().size();
|
int size = AlvearyMutator.getMutagens().size();
|
||||||
int w = size * 18;
|
int w = size * 17;
|
||||||
|
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
return;
|
return;
|
||||||
@@ -58,9 +63,12 @@ public class WindowAlvearyMutator extends Window {
|
|||||||
for (ItemStack stack : AlvearyMutator.getMutagens()) {
|
for (ItemStack stack : AlvearyMutator.getMutagens()) {
|
||||||
ControlItemDisplay display = new ControlItemDisplay(this, x, 66.0f);
|
ControlItemDisplay display = new ControlItemDisplay(this, x, 66.0f);
|
||||||
display.setItemStack(stack);
|
display.setItemStack(stack);
|
||||||
|
display.setSize(new IPoint(14, 14));
|
||||||
display.hastooltip = true;
|
display.hastooltip = true;
|
||||||
x += 18.0f;
|
x += 17.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,16 +2,18 @@ package binnie.extrabees.gui;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.craftgui.geometry.Position;
|
import binnie.core.craftgui.geometry.Position;
|
||||||
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.TileEntityMachine;
|
import binnie.core.machines.TileEntityMachine;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.extrabees.ExtraBees;
|
import binnie.extrabees.ExtraBees;
|
||||||
import binnie.extrabees.apiary.machine.stimulator.AlvearyStimulator;
|
import binnie.extrabees.apiary.machine.stimulator.AlvearyStimulator;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -35,11 +37,12 @@ public class WindowAlvearyStimulator extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
setTitle(I18N.localise("extrabees.machine.alveay.stimulator"));
|
final NBTTagList actions = new NBTTagList();
|
||||||
|
setTitle(machine.getPackage().getGuiDisplayName());
|
||||||
|
playerInventory = new ControlPlayerInventory(this).create(actions);
|
||||||
|
new ControlSlot(this, 41.0f, 28.0f).assign(actions, InventoryType.Machine, AlvearyStimulator.SLOT_CIRCUIT);
|
||||||
new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT);
|
new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT);
|
||||||
ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f);
|
MessageCraftGUI.sendToServer(actions);
|
||||||
slot.assign(AlvearyStimulator.SLOT_CIRCUIT);
|
|
||||||
playerInventory = new ControlPlayerInventory(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ public class ControlClimateBar extends Control implements ITooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isHumidity) {
|
if (isHumidity) {
|
||||||
tooltip.add(EnumHumidity.values()[type].name);
|
tooltip.add(EnumHumidity.VALUES[type].name);
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(EnumTemperature.values()[type + 1].name);
|
tooltip.add(EnumTemperature.VALUES[type + 1].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ public enum EnumHoneyComb implements IItemEnum {
|
|||||||
CYANITE(new Color(0x27204d), new Color(0x86ed)),
|
CYANITE(new Color(0x27204d), new Color(0x86ed)),
|
||||||
BLUTONIUM(new Color(0x27204d), new Color(0x1b00e6));
|
BLUTONIUM(new Color(0x27204d), new Color(0x1b00e6));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumHoneyComb[] VALUES = values();
|
||||||
public final Map<ItemStack, Float> products;
|
public final Map<ItemStack, Float> products;
|
||||||
public final int primaryColor;
|
public final int primaryColor;
|
||||||
public final int secondaryColor;
|
public final int secondaryColor;
|
||||||
@@ -117,10 +121,10 @@ public enum EnumHoneyComb implements IItemEnum {
|
|||||||
|
|
||||||
public static EnumHoneyComb get(ItemStack itemStack) {
|
public static EnumHoneyComb get(ItemStack itemStack) {
|
||||||
int i = itemStack.getItemDamage();
|
int i = itemStack.getItemDamage();
|
||||||
if (i >= 0 && i < values().length) {
|
if (i >= 0 && i < VALUES.length) {
|
||||||
return values()[i];
|
return VALUES[i];
|
||||||
}
|
}
|
||||||
return values()[0];
|
return VALUES[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe() {
|
public void addRecipe() {
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ public enum EnumHoneyDrop implements IItemEnum {
|
|||||||
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc), "for.honey"),
|
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc), "for.honey"),
|
||||||
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9), "for.honey");
|
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9), "for.honey");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumHoneyDrop[] VALUES = values();
|
||||||
public final int primaryColor;
|
public final int primaryColor;
|
||||||
public final int secondaryColor;
|
public final int secondaryColor;
|
||||||
|
|
||||||
@@ -58,10 +62,10 @@ public enum EnumHoneyDrop implements IItemEnum {
|
|||||||
|
|
||||||
public static EnumHoneyDrop get(ItemStack itemStack) {
|
public static EnumHoneyDrop get(ItemStack itemStack) {
|
||||||
int i = itemStack.getItemDamage();
|
int i = itemStack.getItemDamage();
|
||||||
if (i >= 0 && i < values().length) {
|
if (i >= 0 && i < VALUES.length) {
|
||||||
return values()[i];
|
return VALUES[i];
|
||||||
}
|
}
|
||||||
return values()[0];
|
return VALUES[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRemenant(ItemStack stack) {
|
public void addRemenant(ItemStack stack) {
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ public enum EnumPropolis implements IItemEnum {
|
|||||||
// GLACIAL,
|
// GLACIAL,
|
||||||
// PEAT
|
// PEAT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||||
|
*/
|
||||||
|
public static final EnumPropolis[] VALUES = values();
|
||||||
public final int secondaryColor;
|
public final int secondaryColor;
|
||||||
public final int primaryColor;
|
public final int primaryColor;
|
||||||
public final String liquidName;
|
public final String liquidName;
|
||||||
@@ -36,10 +40,10 @@ public enum EnumPropolis implements IItemEnum {
|
|||||||
|
|
||||||
public static EnumPropolis get(ItemStack itemStack) {
|
public static EnumPropolis get(ItemStack itemStack) {
|
||||||
int i = itemStack.getItemDamage();
|
int i = itemStack.getItemDamage();
|
||||||
if (i >= 0 && i < values().length) {
|
if (i >= 0 && i < VALUES.length) {
|
||||||
return values()[i];
|
return VALUES[i];
|
||||||
}
|
}
|
||||||
return values()[0];
|
return VALUES[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe() {
|
public void addRecipe() {
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ public class ItemHoneyComb extends ItemProduct {
|
|||||||
protected IIcon icon2;
|
protected IIcon icon2;
|
||||||
|
|
||||||
public ItemHoneyComb() {
|
public ItemHoneyComb() {
|
||||||
super(EnumHoneyComb.values());
|
super("honeyComb", EnumHoneyComb.VALUES);
|
||||||
setCreativeTab(Tabs.tabApiculture);
|
setCreativeTab(Tabs.tabApiculture);
|
||||||
setUnlocalizedName("honeyComb");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addSubtypes() {
|
public static void addSubtypes() {
|
||||||
@@ -149,7 +148,9 @@ public class ItemHoneyComb extends ItemProduct {
|
|||||||
|
|
||||||
EnumHoneyComb.COFFEE.addProduct(beeswax, 0.90f);
|
EnumHoneyComb.COFFEE.addProduct(beeswax, 0.90f);
|
||||||
EnumHoneyComb.COFFEE.addProduct(honeyDrop, 0.75f);
|
EnumHoneyComb.COFFEE.addProduct(honeyDrop, 0.75f);
|
||||||
EnumHoneyComb.COFFEE.tryAddProduct(Mods.ic2.stack("itemCofeePowder"), 0.75f);
|
if (!OreDictionary.getOres("dustCoffee").isEmpty()) {
|
||||||
|
EnumHoneyComb.COFFEE.tryAddProduct(OreDictionary.getOres("dustCoffee").get(0), 0.75f);
|
||||||
|
}
|
||||||
|
|
||||||
EnumHoneyComb.GLACIAL.tryAddProduct(EnumHoneyDrop.ICE, 0.80f);
|
EnumHoneyComb.GLACIAL.tryAddProduct(EnumHoneyDrop.ICE, 0.80f);
|
||||||
EnumHoneyComb.GLACIAL.addProduct(honeyDrop, 0.75f);
|
EnumHoneyComb.GLACIAL.addProduct(honeyDrop, 0.75f);
|
||||||
@@ -232,15 +233,15 @@ public class ItemHoneyComb extends ItemProduct {
|
|||||||
OreDictionary.registerOre("beeComb", new ItemStack(ExtraBees.comb, 1, 32767));
|
OreDictionary.registerOre("beeComb", new ItemStack(ExtraBees.comb, 1, 32767));
|
||||||
|
|
||||||
for (int i = 0; i < 16; ++i) {
|
for (int i = 0; i < 16; ++i) {
|
||||||
EnumHoneyComb type = EnumHoneyComb.values()[EnumHoneyComb.RED.ordinal() + i];
|
EnumHoneyComb type = EnumHoneyComb.VALUES[EnumHoneyComb.RED.ordinal() + i];
|
||||||
if (type != EnumHoneyComb.RED) {
|
if (type != EnumHoneyComb.RED) {
|
||||||
type.copyProducts(EnumHoneyComb.RED);
|
type.copyProducts(EnumHoneyComb.RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 16; ++i) {
|
for (int i = 0; i < 16; ++i) {
|
||||||
EnumHoneyComb type = EnumHoneyComb.values()[EnumHoneyComb.RED.ordinal() + i];
|
EnumHoneyComb type = EnumHoneyComb.VALUES[EnumHoneyComb.RED.ordinal() + i];
|
||||||
EnumHoneyDrop drop = EnumHoneyDrop.values()[EnumHoneyDrop.RED.ordinal() + i];
|
EnumHoneyDrop drop = EnumHoneyDrop.VALUES[EnumHoneyDrop.RED.ordinal() + i];
|
||||||
int[] dyeC = { 1, 11, 4, 2, 0, 15, 3, 14, 6, 5, 8, 12, 9, 10, 13, 7 };
|
int[] dyeC = { 1, 11, 4, 2, 0, 15, 3, 14, 6, 5, 8, 12, 9, 10, 13, 7 };
|
||||||
int k = dyeC[i];
|
int k = dyeC[i];
|
||||||
ItemStack dye = switch (k) {
|
ItemStack dye = switch (k) {
|
||||||
|
|||||||
Loaded 100 of 2037 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user