mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5c4e9217b | ||
|
|
6610499e7c | ||
|
|
ebcca54ad4 | ||
|
|
89237f644a | ||
|
|
052041f846 | ||
|
|
8f1d0abbeb | ||
|
|
d179ee57e9 | ||
|
|
1e2c85f898 | ||
|
|
f1900cd9b3 | ||
|
|
398af04ea5 | ||
|
|
d5beca8e52 | ||
|
|
db3e5b6388 | ||
|
|
177cb6af04 | ||
|
|
0c89751e53 | ||
|
|
98cb2bb68c | ||
|
|
7d615a0ceb |
No files matched your search
+2
-1602
File diff suppressed because it is too large.
Load diff
+5
-5
@@ -5,12 +5,12 @@ dependencies {
|
||||
|
||||
compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.3:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.0-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.7:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api') {transitive=false}
|
||||
compile('com.github.GTNewHorizons:GTNHLib:0.1.0:dev')
|
||||
compile('com.github.GTNewHorizons:GTNHLib:0.2.11:dev')
|
||||
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
|
||||
|
||||
+146
-26
@@ -1,72 +1,192 @@
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = Botania
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = Botania
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = vazkii.botania
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# 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.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = false
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass =
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile = LibMisc.java
|
||||
gradleTokenModId =
|
||||
gradleTokenModName =
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = botania_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
#customArchiveBaseName =
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to prevent the source code from being published
|
||||
# noPublishedSources =
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment this to disable spotless checks
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Vendored
+10
-10
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
+3
-7
@@ -6,6 +6,7 @@ pluginManagement {
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
@@ -16,12 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An item that implements this will allow some custom render. This will be called while the item is in the inventory,
|
||||
* armor slot or bauble slots.
|
||||
*/
|
||||
public interface IInWorldRenderable
|
||||
{
|
||||
public void renderInWorld(EntityPlayer player, ItemStack stack);
|
||||
}
|
||||
@@ -10,10 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.api.recipe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -22,8 +18,6 @@ import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class RecipePureDaisy {
|
||||
|
||||
private static final Map<String, List<ItemStack>> oreMap = new HashMap();
|
||||
|
||||
Object input;
|
||||
Block output;
|
||||
int outputMeta;
|
||||
@@ -53,21 +47,10 @@ public class RecipePureDaisy {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return false;
|
||||
|
||||
List<ItemStack> ores;
|
||||
if(oreMap.containsKey(entry))
|
||||
ores = oreMap.get(entry);
|
||||
else {
|
||||
ores = OreDictionary.getOres(entry);
|
||||
oreMap.put(entry, ores);
|
||||
}
|
||||
|
||||
for(ItemStack ostack : ores) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack))
|
||||
for(ItemStack ostack : OreDictionary.getOres(entry, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
|
||||
import vazkii.botania.api.item.IInWorldRenderable;
|
||||
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
|
||||
import vazkii.botania.api.wand.ICoordBoundItem;
|
||||
import vazkii.botania.api.wand.IWireframeAABBProvider;
|
||||
@@ -36,6 +37,10 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public final class BoundTileRenderer {
|
||||
|
||||
public static int getWireframeColor(){
|
||||
return Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GL11.glPushMatrix();
|
||||
@@ -49,7 +54,7 @@ public final class BoundTileRenderer {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
int color = getWireframeColor();
|
||||
if(stack != null && stack.getItem() instanceof ICoordBoundItem) {
|
||||
ChunkCoordinates coords = ((ICoordBoundItem) stack.getItem()).getBinding(stack);
|
||||
if(coords != null)
|
||||
@@ -82,6 +87,11 @@ public final class BoundTileRenderer {
|
||||
renderBlockOutlineAt(coords, color, 5F);
|
||||
}
|
||||
}
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IInWorldRenderable) {
|
||||
IInWorldRenderable provider = (IInWorldRenderable) stackInSlot.getItem();
|
||||
provider.renderInWorld(player,stackInSlot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
@@ -3,6 +3,7 @@ package vazkii.botania.client.core.handler;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
import vazkii.botania.common.network.PacketLokiClear;
|
||||
import vazkii.botania.common.network.PacketLokiMirror;
|
||||
import vazkii.botania.common.network.PacketLokiToggle;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -15,11 +16,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class KeyHandler {
|
||||
private static final KeyBinding keyToggleRingOfLoki= new KeyBinding("botaniamisc.toggleLoki", 0, "botaniamisc.keyCategory");
|
||||
private static final KeyBinding keyRingOfLokiClear= new KeyBinding("botaniamisc.ringOfLokiClear", 0, "botaniamisc.keyCategory");
|
||||
private static final KeyBinding keyRingOfLokiMirror= new KeyBinding("botaniamisc.ringOfLokiMirror", 0, "botaniamisc.keyCategory");
|
||||
|
||||
public KeyHandler() {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
ClientRegistry.registerKeyBinding(keyToggleRingOfLoki);
|
||||
ClientRegistry.registerKeyBinding(keyToggleRingOfLoki);
|
||||
ClientRegistry.registerKeyBinding(keyRingOfLokiClear);
|
||||
ClientRegistry.registerKeyBinding(keyRingOfLokiMirror);
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -35,6 +38,9 @@ public class KeyHandler {
|
||||
if(keyRingOfLokiClear.isPressed()){
|
||||
ringOfLokiClear();
|
||||
}
|
||||
if(keyRingOfLokiMirror.isPressed()){
|
||||
toggleRingLokiMirroring();
|
||||
}
|
||||
}
|
||||
|
||||
private static void toggleRingLoki() {
|
||||
@@ -44,4 +50,7 @@ public class KeyHandler {
|
||||
private static void ringOfLokiClear() {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLokiClear());
|
||||
}
|
||||
private static void toggleRingLokiMirroring() {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketLokiMirror());
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
@@ -33,6 +35,8 @@ public final class ShaderHelper {
|
||||
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
|
||||
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
|
||||
|
||||
private static final Int2IntMap TIME_UNIFORM_LOCATIONS = new Int2IntOpenHashMap();
|
||||
|
||||
public static int pylonGlow = 0;
|
||||
public static int enchanterRune = 0;
|
||||
public static int manaPool = 0;
|
||||
@@ -67,8 +71,8 @@ public final class ShaderHelper {
|
||||
ARBShaderObjects.glUseProgramObjectARB(shader);
|
||||
|
||||
if(shader != 0) {
|
||||
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
|
||||
ARBShaderObjects.glUniform1iARB(time, ClientTickHandler.ticksInGame);
|
||||
int timeUniform = TIME_UNIFORM_LOCATIONS.computeIfAbsent(shader, s -> ARBShaderObjects.glGetUniformLocationARB(shader, "time"));
|
||||
ARBShaderObjects.glUniform1iARB(timeUniform, ClientTickHandler.ticksInGame);
|
||||
|
||||
if(callback != null)
|
||||
callback.call(shader);
|
||||
|
||||
@@ -16,13 +16,21 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.world.WorldTypeSkyblock;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public final class SkyblockRenderEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRender(RenderWorldLastEvent event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(ConfigHandler.enableFancySkybox && world.provider.dimensionId == 0 && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))) {
|
||||
|
||||
boolean renderFancySkybox = ConfigHandler.enableFancySkybox && (
|
||||
(ConfigHandler.enableFancySkyboxInNormalWorlds && (world.provider.dimensionId == 0) ) ||
|
||||
(ConfigHandler.enableFancySkyboxInDimension && ConfigHandler.fancySkyboxDimensions.contains(world.provider.dimensionId)) ||
|
||||
(WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))
|
||||
);
|
||||
|
||||
if(renderFancySkybox) {
|
||||
if(!(world.provider.getSkyRenderer() instanceof SkyblockSkyRenderer))
|
||||
world.provider.setSkyRenderer(new SkyblockSkyRenderer());
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -63,11 +65,14 @@ public class TileAlfPortal extends TileMod {
|
||||
|
||||
private static final String TAG_TICKS_OPEN = "ticksOpen";
|
||||
private static final String TAG_TICKS_SINCE_LAST_ITEM = "ticksSinceLastItem";
|
||||
private static final String TAG_STACK_COUNT = "stackCount";
|
||||
private static final String TAG_STACK_COUNT = "stackCount"; // Input stacks
|
||||
private static final String TAG_OUTPUT_COUNT = "outputStackCount";
|
||||
private static final String TAG_STACK = "portalStack";
|
||||
private static final String TAG_OUTPUT_STACK = "outputStack";
|
||||
private static final String TAG_PORTAL_FLAG = "_elvenPortal";
|
||||
|
||||
List<ItemStack> stacksIn = new ArrayList();
|
||||
List<ItemStack> stacksIn = new ArrayList<>();
|
||||
Deque<ItemStack> stacksOut = new ArrayDeque<>();
|
||||
|
||||
public int ticksOpen = 0;
|
||||
int ticksSinceLastItem = 0;
|
||||
@@ -153,8 +158,10 @@ public class TileAlfPortal extends TileMod {
|
||||
}
|
||||
|
||||
if(ticksSinceLastItem >= 4) {
|
||||
if(!worldObj.isRemote)
|
||||
if(!worldObj.isRemote) {
|
||||
resolveRecipes();
|
||||
spawnOutput();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else closeNow = false;
|
||||
@@ -178,6 +185,11 @@ public class TileAlfPortal extends TileMod {
|
||||
}
|
||||
|
||||
private boolean validateItemUsage(ItemStack inputStack) {
|
||||
if (inputStack.getItem() instanceof ILexicon) {
|
||||
// lexicon does not formally have a recipe and is handled in a special branch
|
||||
// in resolveRecipe(), therefore it needs a special branch here as well
|
||||
return true;
|
||||
}
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
for(Object o : recipe.getInputs()) {
|
||||
if(o instanceof String) {
|
||||
@@ -239,12 +251,16 @@ public class TileAlfPortal extends TileMod {
|
||||
}
|
||||
|
||||
void resolveRecipes() {
|
||||
if (stacksIn.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for(ItemStack stack : stacksIn) {
|
||||
if(stack != null && stack.getItem() instanceof ILexicon) {
|
||||
((ILexicon) stack.getItem()).unlockKnowledge(stack, BotaniaAPI.elvenKnowledge);
|
||||
ItemLexicon.setForcedPage(stack, LexiconData.elvenMessage.getUnlocalizedName());
|
||||
spawnItem(stack);
|
||||
addOutput(stack);
|
||||
stacksIn.remove(i);
|
||||
return;
|
||||
}
|
||||
@@ -253,9 +269,48 @@ public class TileAlfPortal extends TileMod {
|
||||
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(recipe.matches(stacksIn, false)) {
|
||||
recipe.matches(stacksIn, true);
|
||||
spawnItem(recipe.getOutput().copy());
|
||||
break;
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
int stackSize = output.stackSize;
|
||||
output.stackSize = 0;
|
||||
while (recipe.matches(stacksIn, true)) {
|
||||
output.stackSize += stackSize;
|
||||
}
|
||||
addOutput(output);
|
||||
if (stacksIn.isEmpty()) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addOutput(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
if (stacksOut.isEmpty()) {
|
||||
stacksOut.addLast(stack);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack lastStack = stacksOut.getLast();
|
||||
if (stack.isItemEqual(lastStack)) {
|
||||
lastStack.stackSize += stack.stackSize;
|
||||
} else {
|
||||
stacksOut.addLast(stack);
|
||||
}
|
||||
}
|
||||
|
||||
void spawnOutput() {
|
||||
if (!stacksOut.isEmpty()) {
|
||||
ItemStack stack = stacksOut.getFirst();
|
||||
if (stack.stackSize > 1) {
|
||||
--stack.stackSize;
|
||||
stack = stack.copy();
|
||||
stack.stackSize = 1;
|
||||
spawnItem(stack);
|
||||
} else if (stack.stackSize == 1) {
|
||||
stacksOut.removeFirst();
|
||||
spawnItem(stack);
|
||||
} else {
|
||||
stacksOut.removeFirst();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,6 +334,15 @@ public class TileAlfPortal extends TileMod {
|
||||
cmp.setTag(TAG_STACK + i, stackcmp);
|
||||
i++;
|
||||
}
|
||||
|
||||
cmp.setInteger(TAG_OUTPUT_COUNT, stacksOut.size());
|
||||
i = 0;
|
||||
for(ItemStack stack : stacksOut) {
|
||||
NBTTagCompound stackcmp = new NBTTagCompound();
|
||||
stack.writeToNBT(stackcmp);
|
||||
cmp.setTag(TAG_OUTPUT_STACK + i, stackcmp);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -292,6 +356,14 @@ public class TileAlfPortal extends TileMod {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
|
||||
stacksIn.add(stack);
|
||||
}
|
||||
|
||||
count = cmp.getInteger(TAG_OUTPUT_COUNT);
|
||||
stacksOut.clear();
|
||||
for(int i = 0; i < count; i++) {
|
||||
NBTTagCompound stackcmp = cmp.getCompoundTag(TAG_OUTPUT_STACK + i);
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
|
||||
stacksOut.addLast(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -66,6 +69,8 @@ public final class ConfigHandler {
|
||||
public static boolean enableArmorModels = true;
|
||||
public static boolean enableFancySkybox = true;
|
||||
public static boolean enableFancySkyboxInNormalWorlds = false;
|
||||
public static boolean enableFancySkyboxInDimension = false;
|
||||
public static HashSet<Integer> fancySkyboxDimensions = new HashSet<Integer>() {};
|
||||
|
||||
public static int manaBarHeight = 29;
|
||||
public static int flightBarHeight = 49;
|
||||
@@ -197,7 +202,13 @@ public final class ConfigHandler {
|
||||
|
||||
desc = "Set this to true to enable the fancy skybox in non Garden of Glass worlds. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)";
|
||||
enableFancySkyboxInNormalWorlds = loadPropBool("fancySkybox.normalWorlds", desc, enableFancySkyboxInNormalWorlds);
|
||||
|
||||
|
||||
desc = "Set this to true to enable the fancy skybox in custom dimension. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)";
|
||||
enableFancySkyboxInDimension = loadPropBool("fancySkybox.customDim", desc, enableFancySkyboxInDimension);
|
||||
|
||||
desc = "The ID of the dimension to use";
|
||||
fancySkyboxDimensions = loadPropIntSet("fancySkybox.customDimID", desc, fancySkyboxDimensions);
|
||||
|
||||
desc = "The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.";
|
||||
manaBarHeight = loadPropInt("manaBar.height", desc, manaBarHeight);
|
||||
|
||||
@@ -364,6 +375,19 @@ public final class ConfigHandler {
|
||||
return prop.getIntList();
|
||||
}
|
||||
|
||||
public static HashSet<Integer> loadPropIntSet(String propName, String desc, HashSet<Integer> intSet) {
|
||||
int[] defaultValues = intSet.stream().mapToInt(Number::intValue).toArray();
|
||||
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, defaultValues);
|
||||
prop.comment = desc;
|
||||
|
||||
if(adaptor != null)
|
||||
adaptor.adaptPropertyIntArray(prop, prop.getIntList());
|
||||
|
||||
return Arrays.stream(prop.getIntList())
|
||||
.boxed()
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
public static int loadPropPotionId(String propName, int default_) {
|
||||
if(!verifiedPotionArray)
|
||||
verifyPotionArray();
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package vazkii.botania.common.core.helper;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
|
||||
public class LokiCursor {
|
||||
private static final String TAG_X_OFFSET = "xOffset";
|
||||
private static final String TAG_Y_OFFSET = "yOffset";
|
||||
private static final String TAG_Z_OFFSET = "zOffset";
|
||||
private static final String TAG_MIRROR_MODE = "mirror";
|
||||
|
||||
private static final byte xAxisBitmask = 4; //100
|
||||
private static final byte yAxisBitmask = 2; //010
|
||||
private static final byte zAxisBitmask = 1; //001
|
||||
|
||||
private byte mirrorMode;
|
||||
private ChunkCoordinates coordinates;
|
||||
|
||||
public LokiCursor(int x, int y, int z, byte mode){
|
||||
coordinates = new ChunkCoordinates(x,y,z);
|
||||
mirrorMode = mode;
|
||||
}
|
||||
|
||||
public static LokiCursor fromNBT(NBTTagCompound cmp){
|
||||
int x = cmp.getInteger(TAG_X_OFFSET);
|
||||
int y = cmp.getInteger(TAG_Y_OFFSET);
|
||||
int z = cmp.getInteger(TAG_Z_OFFSET);
|
||||
byte mirror = cmp.getByte(TAG_MIRROR_MODE);
|
||||
|
||||
return new LokiCursor(x,y,z,mirror);
|
||||
}
|
||||
public static boolean isMirrorX(byte mirrorMode){
|
||||
return (mirrorMode & xAxisBitmask) > 0;
|
||||
}
|
||||
public static boolean isMirrorY(byte mirrorMode){
|
||||
return (mirrorMode & yAxisBitmask) > 0;
|
||||
}
|
||||
public static boolean isMirrorZ(byte mirrorMode){
|
||||
return (mirrorMode & zAxisBitmask) > 0;
|
||||
}
|
||||
public NBTTagCompound toNBT() {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
cmp.setInteger(TAG_X_OFFSET, coordinates.posX);
|
||||
cmp.setInteger(TAG_Y_OFFSET, coordinates.posY);
|
||||
cmp.setInteger(TAG_Z_OFFSET, coordinates.posZ);
|
||||
cmp.setInteger(TAG_MIRROR_MODE, mirrorMode);
|
||||
return cmp;
|
||||
}
|
||||
|
||||
public int getX(){
|
||||
return coordinates.posX;
|
||||
}
|
||||
|
||||
public int getY(){
|
||||
return coordinates.posY;
|
||||
}
|
||||
|
||||
public int getZ(){
|
||||
return coordinates.posZ;
|
||||
}
|
||||
|
||||
public ChunkCoordinates getCoordinates(){
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public boolean isMirrorX(){
|
||||
return isMirrorX(mirrorMode);
|
||||
}
|
||||
public boolean isMirrorY(){
|
||||
return isMirrorY(mirrorMode);
|
||||
}
|
||||
public boolean isMirrorZ(){
|
||||
return isMirrorZ(mirrorMode);
|
||||
}
|
||||
|
||||
public boolean isMirror(){
|
||||
return mirrorMode!=0;
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,16 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.gtnewhorizon.gtnhlib.GTNHLib;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -24,9 +28,11 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -34,13 +40,15 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
|
||||
import vazkii.botania.api.item.IInWorldRenderable;
|
||||
import vazkii.botania.api.item.ISequentialBreaker;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.client.core.handler.BoundTileRenderer;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.ItemTemperanceStone;
|
||||
import vazkii.botania.common.core.helper.LokiCursor;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -52,25 +60,24 @@ import baubles.common.network.PacketSyncBauble;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.common.network.PacketLokiHudNotificationAck;
|
||||
|
||||
|
||||
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, IManaUsingItem {
|
||||
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, IManaUsingItem, IInWorldRenderable {
|
||||
|
||||
private static final String TAG_CURSOR_LIST = "cursorList";
|
||||
private static final String TAG_CURSOR_PREFIX = "cursor";
|
||||
private static final String TAG_CURSOR_COUNT = "cursorCount";
|
||||
private static final String TAG_X_OFFSET = "xOffset";
|
||||
private static final String TAG_Y_OFFSET = "yOffset";
|
||||
private static final String TAG_Z_OFFSET = "zOffset";
|
||||
private static final String TAG_X_ORIGIN = "xOrigin";
|
||||
private static final String TAG_Y_ORIGIN = "yOrigin";
|
||||
private static final String TAG_Z_ORIGIN = "zOrigin";
|
||||
private static final String TAG_MODE = "mode";
|
||||
private static final String TAG_BREAKING_MODE = "breaking";
|
||||
private static final String TAG_MIRROR_MODE = "mirror";
|
||||
private boolean recursion = false;
|
||||
|
||||
public static enum HUD_MESSAGE {
|
||||
MODE, BREAKING, CLEAR
|
||||
MODE, BREAKING, CLEAR, MIRROR, INSUFFICIENT_MANA
|
||||
}
|
||||
|
||||
public ItemLokiRing() {
|
||||
@@ -114,87 +121,162 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
ItemStack heldItemStack = player.getCurrentEquippedItem();
|
||||
ChunkCoordinates originCoords = getOriginPos(lokiRing);
|
||||
MovingObjectPosition lookPos = ToolCommons.raytraceFromEntity(player.worldObj, player, true, 10F);
|
||||
List<ChunkCoordinates> cursors = getCursorList(lokiRing);
|
||||
List<LokiCursor> cursors = getCursorList(lokiRing);
|
||||
int cursorCount = cursors.size();
|
||||
|
||||
int cost = Math.min(cursorCount, (int) Math.pow(Math.E, cursorCount * 0.25));
|
||||
//I don`t think mana for placing should be cruel , so I just made graph with funny line
|
||||
int cost = (int)(50*Math.sin(0.04* cursorCount)+cursorCount+120+20*Math.cos(0.2*cursorCount));
|
||||
|
||||
if (heldItemStack == null && event.action == Action.RIGHT_CLICK_BLOCK && player.isSneaking() && isRingEnabled(lokiRing)) {
|
||||
if(originCoords.posY == -1 && lookPos != null) {
|
||||
setOriginPos(lokiRing, lookPos.blockX, lookPos.blockY, lookPos.blockZ);
|
||||
clearCursors(lokiRing);
|
||||
if(player instanceof EntityPlayerMP)
|
||||
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
|
||||
syncLokiRing(player);
|
||||
} else if(lookPos != null) {
|
||||
if(originCoords.posX == lookPos.blockX && originCoords.posY == lookPos.blockY && originCoords.posZ == lookPos.blockZ) {
|
||||
clearMasterCursor(lokiRing);
|
||||
if(player instanceof EntityPlayerMP)
|
||||
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
|
||||
syncLokiRing(player);
|
||||
} else {
|
||||
addCursor : {
|
||||
int relX = lookPos.blockX - originCoords.posX;
|
||||
int relY = lookPos.blockY - originCoords.posY;
|
||||
int relZ = lookPos.blockZ - originCoords.posZ;
|
||||
|
||||
for(ChunkCoordinates cursor : cursors)
|
||||
if(cursor.posX == relX && cursor.posY == relY && cursor.posZ == relZ) {
|
||||
for(LokiCursor cursor : cursors)
|
||||
if(cursor.getX() == relX && cursor.getY() == relY && cursor.getZ() == relZ) {
|
||||
cursors.remove(cursor);
|
||||
setCursorList(lokiRing, cursors);
|
||||
if(player instanceof EntityPlayerMP)
|
||||
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
|
||||
syncLokiRing(player);
|
||||
break addCursor;
|
||||
}
|
||||
|
||||
addCursor(lokiRing, relX, relY, relZ);
|
||||
addCursor(lokiRing, relX, relY, relZ, getRingMirrorMode(lokiRing) );
|
||||
if(player instanceof EntityPlayerMP)
|
||||
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
|
||||
syncLokiRing(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null && isRingEnabled(lokiRing)) {
|
||||
|
||||
recursion = true;
|
||||
if(!ManaItemHandler.requestManaExact(lokiRing, player, cost, true)){
|
||||
if(player instanceof EntityPlayerMP){
|
||||
vazkii.botania.common.network.PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(HUD_MESSAGE.INSUFFICIENT_MANA),(EntityPlayerMP) player);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderHUDNotification(HUD_MESSAGE.INSUFFICIENT_MANA);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
recursion = true;
|
||||
|
||||
double oldPosX = player.posX;
|
||||
double oldPosY = player.posY;
|
||||
double oldPosZ = player.posZ;
|
||||
float oldPitch = player.rotationPitch;
|
||||
float oldYaw = player.rotationYaw;
|
||||
|
||||
int masterOffsetX = originCoords.posY == -1 ? 0 :lookPos.blockX - originCoords.posX;
|
||||
int masterOffsetY = originCoords.posY == -1 ? 0 :lookPos.blockY - originCoords.posY;
|
||||
int masterOffsetZ = originCoords.posY == -1 ? 0 :lookPos.blockZ - originCoords.posZ;
|
||||
|
||||
double playerOffsetX = player.posX - originCoords.posX;
|
||||
double playerOffsetY = player.posY - originCoords.posY;
|
||||
double playerOffsetZ = player.posZ - originCoords.posZ;
|
||||
|
||||
for(LokiCursor cursor : cursors) {
|
||||
|
||||
int x = lookPos.blockX + cursor.getX();
|
||||
int y = lookPos.blockY + cursor.getY();
|
||||
int z = lookPos.blockZ + cursor.getZ();
|
||||
|
||||
if(cursor.isMirrorX()){
|
||||
x -= 2*masterOffsetX;
|
||||
}
|
||||
if(cursor.isMirrorY()){
|
||||
y -= 2*masterOffsetY;
|
||||
}
|
||||
if(cursor.isMirrorZ()){
|
||||
z -= 2*masterOffsetZ;
|
||||
}
|
||||
|
||||
if (player.worldObj.isAirBlock(x, y, z) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
player.posX = cursor.getX()+oldPosX;
|
||||
player.posY = cursor.getY()+oldPosY;
|
||||
player.posZ = cursor.getZ()+oldPosZ;
|
||||
player.rotationYaw = oldYaw;
|
||||
|
||||
if(cursor.isMirrorX()){
|
||||
player.posX -= 2*playerOffsetX;
|
||||
player.rotationYaw = player.rotationYaw * (-1);
|
||||
}
|
||||
if(cursor.isMirrorY()){
|
||||
player.posY -= 2*playerOffsetY;
|
||||
player.rotationPitch = oldPitch * (-1);
|
||||
}
|
||||
if(cursor.isMirrorZ()){
|
||||
player.posZ -= 2*playerOffsetZ;
|
||||
player.rotationYaw = 180 - (Math.abs(player.rotationYaw));
|
||||
if(oldYaw < 0){
|
||||
player.rotationYaw *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
float hitX = (float) (lookPos.hitVec.xCoord - lookPos.blockX);
|
||||
float hitY = (float) (lookPos.hitVec.yCoord - lookPos.blockY);
|
||||
float hitZ = (float) (lookPos.hitVec.zCoord - lookPos.blockZ);
|
||||
if(cursor.isMirrorX()){
|
||||
hitX = 1-hitX;
|
||||
}
|
||||
if(cursor.isMirrorY()){
|
||||
hitY = 1-hitY;
|
||||
}
|
||||
if(cursor.isMirrorZ()){
|
||||
hitZ = 1-hitZ;
|
||||
}
|
||||
|
||||
int hitSide = lookPos.sideHit;
|
||||
if(cursor.isMirrorX() && (hitSide == ForgeDirection.EAST.ordinal() || hitSide == ForgeDirection.WEST.ordinal()) ){
|
||||
hitSide = hitSide ^ 1;
|
||||
}
|
||||
if(cursor.isMirrorY() && (hitSide == ForgeDirection.DOWN.ordinal() || hitSide == ForgeDirection.UP.ordinal()) ){
|
||||
hitSide = hitSide ^ 1;
|
||||
}
|
||||
if(cursor.isMirrorZ() && (hitSide == ForgeDirection.NORTH.ordinal() || hitSide == ForgeDirection.SOUTH.ordinal()) ){
|
||||
hitSide = hitSide ^ 1;
|
||||
}
|
||||
|
||||
for(ChunkCoordinates cursor : cursors) {
|
||||
int x = lookPos.blockX + cursor.posX;
|
||||
int y = lookPos.blockY + cursor.posY;
|
||||
int z = lookPos.blockZ + cursor.posZ;
|
||||
Item item = heldItemStack.getItem();
|
||||
if (!player.worldObj.isAirBlock(x, y, z) && ManaItemHandler.requestManaExact(lokiRing, player, cost, true)) {
|
||||
player.posX = cursor.posX+oldPosX;
|
||||
player.posY = cursor.posY+oldPosY;
|
||||
player.posZ = cursor.posZ+oldPosZ;
|
||||
Block markedBlock = player.worldObj.getBlock(x, y, z);
|
||||
|
||||
float hitX = (float) (lookPos.hitVec.xCoord - lookPos.blockX);
|
||||
float hitY = (float) (lookPos.hitVec.yCoord - lookPos.blockY);
|
||||
float hitZ = (float) (lookPos.hitVec.zCoord - lookPos.blockZ);
|
||||
|
||||
Block markedBlock = player.worldObj.getBlock(x, y, z);
|
||||
boolean wasActivated = markedBlock.onBlockActivated(player.worldObj, x, y, z, player, lookPos.sideHit, hitX,hitY,hitZ);
|
||||
|
||||
if (heldItemStack.stackSize == 0 ) {
|
||||
boolean wasActivated = markedBlock.onBlockActivated(player.worldObj, x, y, z, player, hitSide, hitX,hitY,hitZ);
|
||||
|
||||
if (heldItemStack.stackSize == 0 ) {
|
||||
event.setCanceled(true);
|
||||
break;
|
||||
}
|
||||
if (!wasActivated) {
|
||||
item.onItemUse(player.capabilities.isCreativeMode ? heldItemStack.copy() : heldItemStack, player, player.worldObj, x, y, z, hitSide, (float) lookPos.hitVec.xCoord - x, (float) lookPos.hitVec.yCoord - y, (float) lookPos.hitVec.zCoord - z);
|
||||
if(heldItemStack.stackSize == 0) {
|
||||
event.setCanceled(true);
|
||||
break;
|
||||
}
|
||||
if (!wasActivated) {
|
||||
item.onItemUse(player.capabilities.isCreativeMode ? heldItemStack.copy() : heldItemStack, player, player.worldObj, x, y, z, lookPos.sideHit, (float) lookPos.hitVec.xCoord - x, (float) lookPos.hitVec.yCoord - y, (float) lookPos.hitVec.zCoord - z);
|
||||
if(heldItemStack.stackSize == 0) {
|
||||
event.setCanceled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
recursion = false;
|
||||
player.posX = oldPosX;
|
||||
player.posY = oldPosY;
|
||||
player.posZ = oldPosZ;
|
||||
player.rotationPitch = oldPitch;
|
||||
player.rotationYaw = oldYaw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setMode(ItemStack stack, boolean state) {
|
||||
stack.stackTagCompound.setBoolean(TAG_MODE, state);
|
||||
}
|
||||
@@ -203,6 +285,10 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
stack.stackTagCompound.setBoolean(TAG_BREAKING_MODE, state);
|
||||
}
|
||||
|
||||
public static void setMirrorMode (ItemStack stack, byte state) {
|
||||
stack.stackTagCompound.setByte(TAG_MIRROR_MODE, state);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderHUDNotification(HUD_MESSAGE type){
|
||||
@@ -218,6 +304,12 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
case CLEAR:
|
||||
text = getLokiCearText(getLokiRing(mc.thePlayer));
|
||||
break;
|
||||
case MIRROR:
|
||||
text = getLokiMirrorText(getLokiRing(mc.thePlayer));
|
||||
break;
|
||||
case INSUFFICIENT_MANA:
|
||||
text = EnumChatFormatting.RED + StatCollector.translateToLocal("botaniamisc.insufficient_mana");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -231,18 +323,33 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
EnumChatFormatting.RED + StatCollector.translateToLocal("botaniamisc.lokiOff");
|
||||
}
|
||||
|
||||
public static String getAxisString(byte state) {
|
||||
EnumChatFormatting x = LokiCursor.isMirrorX(state) ? EnumChatFormatting.GREEN : EnumChatFormatting.RED;
|
||||
EnumChatFormatting y = LokiCursor.isMirrorY(state) ? EnumChatFormatting.GREEN : EnumChatFormatting.RED;
|
||||
EnumChatFormatting z = LokiCursor.isMirrorZ(state) ? EnumChatFormatting.GREEN : EnumChatFormatting.RED;
|
||||
|
||||
return x + "X " + y + "Y " + z + "Z";
|
||||
}
|
||||
|
||||
public static String getLokiModeText(ItemStack stack){
|
||||
return EnumChatFormatting.GOLD + StatCollector.translateToLocal("item.botania:lokiRing.name") + " " + getOnOffString(isRingEnabled(stack));
|
||||
}
|
||||
|
||||
public static String getLokiMirrorText(ItemStack stack){
|
||||
return EnumChatFormatting.GOLD + StatCollector.translateToLocal("botaniamisc.lokiMirror") + " "+
|
||||
getAxisString(getRingMirrorMode(stack));
|
||||
}
|
||||
|
||||
public static String getLokiCearText(ItemStack stack){
|
||||
return EnumChatFormatting.GOLD + StatCollector.translateToLocal("botaniamisc.lokiClear");
|
||||
}
|
||||
|
||||
public static String getLokiBreakingModeText(ItemStack stack){
|
||||
return EnumChatFormatting.GOLD + StatCollector.translateToLocal("item.botania:lokiRing.name") + " "+
|
||||
StatCollector.translateToLocal("botaniamisc.breaking") + " " + getOnOffString(isRingBreakingEnabled(stack));
|
||||
}
|
||||
|
||||
public static String getLokiCearText(ItemStack stack){
|
||||
return EnumChatFormatting.GOLD + StatCollector.translateToLocal("botaniamisc.lokiClear");
|
||||
}
|
||||
|
||||
|
||||
public static boolean isRingEnabled (final ItemStack stack){
|
||||
if (stack.hasTagCompound())
|
||||
@@ -260,11 +367,27 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
return false;
|
||||
}
|
||||
|
||||
public static byte getRingMirrorMode(final ItemStack stack){
|
||||
if(stack.hasTagCompound()){
|
||||
return stack.stackTagCompound.getByte(TAG_MIRROR_MODE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side) {
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if(lokiRing == null || player.worldObj.isRemote || !isRingEnabled(lokiRing) || !isRingBreakingEnabled(lokiRing))
|
||||
if (lokiRing == null || player.worldObj.isRemote || !isRingEnabled(lokiRing) || !isRingBreakingEnabled(lokiRing))
|
||||
return;
|
||||
List<ChunkCoordinates> cursors = getCursorList(lokiRing);
|
||||
List<LokiCursor> cursors = getCursorList(lokiRing);
|
||||
//In case someone wants to mine ore veins with loki, this should make 1 manapool worth of mana last for 2 veins
|
||||
int cost = 30 * cursors.size();
|
||||
if (!ManaItemHandler.requestManaExact(lokiRing, player, cost, true)) {
|
||||
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
vazkii.botania.common.network.PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(HUD_MESSAGE.INSUFFICIENT_MANA), (EntityPlayerMP) player);
|
||||
} else {
|
||||
renderHUDNotification(HUD_MESSAGE.INSUFFICIENT_MANA);
|
||||
}
|
||||
}
|
||||
ISequentialBreaker breaker = null;
|
||||
if(item instanceof ISequentialBreaker)
|
||||
breaker = (ISequentialBreaker) item;
|
||||
@@ -273,11 +396,39 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack);
|
||||
boolean dispose = breaker == null? true : breaker.disposeOfTrashBlocks(stack);
|
||||
|
||||
ChunkCoordinates originCoords = getOriginPos(lokiRing);
|
||||
|
||||
int masterOffsetX = originCoords.posY == -1 ? 0 :x - originCoords.posX;
|
||||
int masterOffsetY = originCoords.posY == -1 ? 0 :y - originCoords.posY;
|
||||
int masterOffsetZ = originCoords.posY == -1 ? 0 :z - originCoords.posZ;
|
||||
|
||||
for(int i = 0; i < cursors.size(); i++) {
|
||||
ChunkCoordinates coords = cursors.get(i);
|
||||
int xp = x + coords.posX;
|
||||
int yp = y + coords.posY;
|
||||
int zp = z + coords.posZ;
|
||||
LokiCursor cursor = cursors.get(i);
|
||||
int xp = x + cursor.getX();
|
||||
int yp = y + cursor.getY();
|
||||
int zp = z + cursor.getZ();
|
||||
if(cursor.isMirrorX()){
|
||||
xp -= 2*masterOffsetX;
|
||||
}
|
||||
if(cursor.isMirrorY()){
|
||||
yp -= 2*masterOffsetY;
|
||||
}
|
||||
if(cursor.isMirrorZ()){
|
||||
zp -= 2*masterOffsetZ;
|
||||
}
|
||||
|
||||
if(cursor.isMirrorX() && (side == ForgeDirection.EAST.ordinal() || side == ForgeDirection.WEST.ordinal()) ){
|
||||
side = side ^ 1;
|
||||
}
|
||||
if(cursor.isMirrorY() && (side == ForgeDirection.DOWN.ordinal() || side == ForgeDirection.UP.ordinal()) ){
|
||||
side = side ^ 1;
|
||||
}
|
||||
if(cursor.isMirrorZ() && (side == ForgeDirection.NORTH.ordinal() || side == ForgeDirection.SOUTH.ordinal()) ){
|
||||
side = side ^ 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Block block = world.getBlock(xp, yp, zp);
|
||||
if(breaker != null)
|
||||
breaker.breakOtherBlock(player, stack, xp, yp, zp, x, y, z, side);
|
||||
@@ -303,6 +454,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
addStringToTooltip(EnumChatFormatting.WHITE +StatCollector.translateToLocal("botaniamisc.lokiCurrent"), list);
|
||||
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiState") + ": " + getOnOffString(isRingEnabled(stack)), list);
|
||||
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.breaking") + ": " + getOnOffString(isRingBreakingEnabled(stack)), list);
|
||||
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiMirror") + getAxisString(getRingMirrorMode(stack)), list);
|
||||
addStringToTooltip("", list);
|
||||
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiToggleDescription") + " " + getOnOffString(true) + EnumChatFormatting.RESET + "/"+ getOnOffString(false), list);
|
||||
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiBreakingDescription") + " " + getOnOffString(true) + EnumChatFormatting.RESET+"/" + getOnOffString(false), list);
|
||||
@@ -318,23 +470,28 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
|
||||
MovingObjectPosition lookPos = Minecraft.getMinecraft().objectMouseOver;
|
||||
|
||||
if(lookPos != null && !player.worldObj.isAirBlock(lookPos.blockX, lookPos.blockY, lookPos.blockZ) && lookPos.entityHit == null) {
|
||||
List<ChunkCoordinates> list = getCursorList(stack);
|
||||
if(lookPos != null && lookPos.entityHit == null) {
|
||||
List<LokiCursor> list = getCursorList(stack);
|
||||
ChunkCoordinates origin = getOriginPos(stack);
|
||||
List<ChunkCoordinates> toDraw = new ArrayList<>();
|
||||
|
||||
if(origin.posY != -1) {
|
||||
for(ChunkCoordinates coords : list) {
|
||||
for(LokiCursor cursor : list) {
|
||||
ChunkCoordinates coords = cursor.getCoordinates();
|
||||
coords.posX += origin.posX;
|
||||
coords.posY += origin.posY;
|
||||
coords.posZ += origin.posZ;
|
||||
toDraw.add(coords);
|
||||
}
|
||||
} else for(ChunkCoordinates coords : list) {
|
||||
} else for(LokiCursor cursor : list) {
|
||||
ChunkCoordinates coords = cursor.getCoordinates();
|
||||
coords.posX += lookPos.blockX;
|
||||
coords.posY += lookPos.blockY;
|
||||
coords.posZ += lookPos.blockZ;
|
||||
toDraw.add(coords);
|
||||
}
|
||||
|
||||
return list;
|
||||
return toDraw;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -360,6 +517,17 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : null;
|
||||
}
|
||||
|
||||
public static int getLokiRingSlot(EntityPlayer player) {
|
||||
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isLokiRing(stack1) ? 1 : isLokiRing(stack2) ? 2 : null;
|
||||
}
|
||||
|
||||
public static void syncLokiRing(EntityPlayer player){
|
||||
baubles.common.network.PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, getLokiRingSlot(player)), (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
private static boolean isLokiRing(ItemStack stack) {
|
||||
return stack != null && (stack.getItem() == ModItems.lokiRing || stack.getItem() == ModItems.aesirRing);
|
||||
}
|
||||
@@ -377,28 +545,26 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
ItemNBTHelper.setInt(stack, TAG_Z_ORIGIN, z);
|
||||
}
|
||||
|
||||
private static List<ChunkCoordinates> getCursorList(ItemStack stack) {
|
||||
private static List<LokiCursor> getCursorList(ItemStack stack) {
|
||||
NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_CURSOR_LIST, false);
|
||||
List<ChunkCoordinates> cursors = new ArrayList();
|
||||
List<LokiCursor> cursors = new ArrayList();
|
||||
|
||||
int count = cmp.getInteger(TAG_CURSOR_COUNT);
|
||||
for(int i = 0; i < count; i++) {
|
||||
NBTTagCompound cursorCmp = cmp.getCompoundTag(TAG_CURSOR_PREFIX + i);
|
||||
int x = cursorCmp.getInteger(TAG_X_OFFSET);
|
||||
int y = cursorCmp.getInteger(TAG_Y_OFFSET);
|
||||
int z = cursorCmp.getInteger(TAG_Z_OFFSET);
|
||||
cursors.add(new ChunkCoordinates(x, y, z));
|
||||
cursors.add(LokiCursor.fromNBT(cursorCmp));
|
||||
|
||||
}
|
||||
|
||||
return cursors;
|
||||
}
|
||||
|
||||
private static void setCursorList(ItemStack stack, List<ChunkCoordinates> cursors) {
|
||||
private static void setCursorList(ItemStack stack, List<LokiCursor> cursors) {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
if(cursors != null) {
|
||||
int i = 0;
|
||||
for(ChunkCoordinates cursor : cursors) {
|
||||
NBTTagCompound cursorCmp = cursorToCmp(cursor.posX, cursor.posY, cursor.posZ);
|
||||
for(LokiCursor cursor : cursors) {
|
||||
NBTTagCompound cursorCmp = cursor.toNBT();
|
||||
cmp.setTag(TAG_CURSOR_PREFIX + i, cursorCmp);
|
||||
i++;
|
||||
}
|
||||
@@ -408,18 +574,12 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
ItemNBTHelper.setCompound(stack, TAG_CURSOR_LIST, cmp);
|
||||
}
|
||||
|
||||
private static NBTTagCompound cursorToCmp(int x, int y, int z) {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
cmp.setInteger(TAG_X_OFFSET, x);
|
||||
cmp.setInteger(TAG_Y_OFFSET, y);
|
||||
cmp.setInteger(TAG_Z_OFFSET, z);
|
||||
return cmp;
|
||||
}
|
||||
|
||||
private static void addCursor(ItemStack stack, int x, int y, int z) {
|
||||
|
||||
private static void addCursor(ItemStack stack, int x, int y, int z, byte mirrorMode) {
|
||||
NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_CURSOR_LIST, false);
|
||||
int count = cmp.getInteger(TAG_CURSOR_COUNT);
|
||||
cmp.setTag(TAG_CURSOR_PREFIX + count, cursorToCmp(x, y, z));
|
||||
cmp.setTag(TAG_CURSOR_PREFIX + count, new LokiCursor(x,y,z, mirrorMode).toNBT());
|
||||
cmp.setInteger(TAG_CURSOR_COUNT, count + 1);
|
||||
ItemNBTHelper.setCompound(stack, TAG_CURSOR_LIST, cmp);
|
||||
}
|
||||
@@ -429,5 +589,117 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInWorld(EntityPlayer player, ItemStack stack){
|
||||
renderMirrors(player,stack);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void renderMirrors(EntityPlayer player,ItemStack stack) {
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if(lokiRing != stack || !isRingEnabled(lokiRing) )
|
||||
return;
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
List<LokiCursor> cursors = getCursorList(stack);
|
||||
ChunkCoordinates origin = getOriginPos(stack);
|
||||
MovingObjectPosition lookPos = Minecraft.getMinecraft().objectMouseOver;
|
||||
|
||||
|
||||
for(LokiCursor cursor : cursors) {
|
||||
if(!cursor.isMirror()) {
|
||||
continue;
|
||||
}
|
||||
ChunkCoordinates pos = cursor.getCoordinates();
|
||||
if(origin.posY != -1){
|
||||
|
||||
pos.posX += origin.posX;
|
||||
pos.posY += origin.posY;
|
||||
pos.posZ += origin.posZ;
|
||||
}else{
|
||||
pos.posX += lookPos.blockX;
|
||||
pos.posY += lookPos.blockY;
|
||||
pos.posZ += lookPos.blockZ;
|
||||
}
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ + 1);
|
||||
Color colorRGB = new Color(BoundTileRenderer.getWireframeColor());
|
||||
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255);
|
||||
Block block = world.getBlock(pos.posX, pos.posY, pos.posZ);
|
||||
|
||||
if (block != null) {
|
||||
AxisAlignedBB axis = block.getSelectedBoundingBoxFromPool(world, pos.posX, pos.posY, pos.posZ);
|
||||
|
||||
if (axis != null) {
|
||||
axis.minX -= pos.posX;
|
||||
axis.maxX -= pos.posX;
|
||||
axis.minY -= pos.posY;
|
||||
axis.maxY -= pos.posY;
|
||||
axis.minZ -= pos.posZ + 1;
|
||||
axis.maxZ -= pos.posZ + 1;
|
||||
|
||||
GL11.glScalef(1F, 1F, 1F);
|
||||
|
||||
GL11.glLineWidth(1F);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawing(GL11.GL_LINES);
|
||||
if (cursor.isMirrorX()) {
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.minY,axis.minZ);
|
||||
tessellator.addVertex(axis.minX,axis.maxY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.maxY,axis.minZ);
|
||||
tessellator.addVertex(axis.minX,axis.minY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.maxX,axis.minY,axis.minZ);
|
||||
tessellator.addVertex(axis.maxX,axis.maxY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.maxX,axis.maxY,axis.minZ);
|
||||
tessellator.addVertex(axis.maxX,axis.minY,axis.maxZ);
|
||||
|
||||
}
|
||||
if (cursor.isMirrorY()) {
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.minY,axis.minZ);
|
||||
tessellator.addVertex(axis.maxX,axis.minY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.maxX,axis.minY,axis.minZ);
|
||||
tessellator.addVertex(axis.minX,axis.minY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.maxY,axis.minZ);
|
||||
tessellator.addVertex(axis.maxX,axis.maxY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.maxX,axis.maxY,axis.minZ);
|
||||
tessellator.addVertex(axis.minX,axis.maxY,axis.maxZ);
|
||||
|
||||
}
|
||||
if (cursor.isMirrorZ()) {
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.minY,axis.minZ);
|
||||
tessellator.addVertex(axis.maxX,axis.maxY,axis.minZ);
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.maxY,axis.minZ);
|
||||
tessellator.addVertex(axis.maxX,axis.minY,axis.minZ);
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.minY,axis.maxZ);
|
||||
tessellator.addVertex(axis.maxX,axis.maxY,axis.maxZ);
|
||||
|
||||
tessellator.addVertex(axis.minX,axis.maxY,axis.maxZ);
|
||||
tessellator.addVertex(axis.maxX,axis.minY,axis.maxZ);
|
||||
|
||||
|
||||
}
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,9 +14,8 @@ public class PacketHandler {
|
||||
|
||||
public static void initPackets() {
|
||||
INSTANCE.registerMessage(PacketLokiToggle.class, PacketLokiToggle.class, 1, Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketLokiToggleAck.class, PacketLokiToggleAck.class, 2, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketLokiToggleBreakingAck.class, PacketLokiToggleBreakingAck.class, 3, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketLokiClear.class, PacketLokiClear.class, 4, Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketLokiClearAck.class, PacketLokiClearAck.class, 5, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketLokiClear.class, PacketLokiClear.class, 2, Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketLokiMirror.class, PacketLokiMirror.class, 3, Side.SERVER);
|
||||
INSTANCE.registerMessage(PacketLokiHudNotificationAck.class, PacketLokiHudNotificationAck.class, 4, Side.CLIENT);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import baubles.common.network.PacketSyncBauble;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -27,8 +28,8 @@ public class PacketLokiClear implements IMessage, IMessageHandler<PacketLokiClea
|
||||
if (aRing != null) {
|
||||
ItemLokiRing.clearCursors(aRing);
|
||||
ItemLokiRing.clearMasterCursor(aRing);
|
||||
PacketLokiClearAck ackMessage = new PacketLokiClearAck();
|
||||
PacketHandler.INSTANCE.sendTo(ackMessage, player);
|
||||
ItemLokiRing.syncLokiRing(player);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(ItemLokiRing.HUD_MESSAGE.CLEAR), player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PacketLokiClearAck implements IMessage, IMessageHandler<PacketLokiClearAck, IMessage> {
|
||||
|
||||
public boolean state;
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf byteBuf) {
|
||||
state = byteBuf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf byteBuf) {
|
||||
byteBuf.writeBoolean(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(PacketLokiClearAck message, MessageContext ctx) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
final ItemStack aRing = ItemLokiRing.getLokiRing(mc.thePlayer) ;
|
||||
if (aRing != null) {
|
||||
ItemLokiRing.renderHUDNotification(ItemLokiRing.HUD_MESSAGE.CLEAR);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
|
||||
public class PacketLokiHudNotificationAck implements IMessage, IMessageHandler<PacketLokiHudNotificationAck, IMessage> {
|
||||
|
||||
|
||||
public ItemLokiRing.HUD_MESSAGE hudMessage;
|
||||
|
||||
public PacketLokiHudNotificationAck(){
|
||||
|
||||
}
|
||||
|
||||
public PacketLokiHudNotificationAck(ItemLokiRing.HUD_MESSAGE aHudMessage){
|
||||
hudMessage = aHudMessage;
|
||||
}
|
||||
@Override
|
||||
public void fromBytes(ByteBuf byteBuf) {
|
||||
int ordinal = byteBuf.readInt();
|
||||
if (ordinal >= 0 && ordinal < ItemLokiRing.HUD_MESSAGE.values().length) {
|
||||
hudMessage = ItemLokiRing.HUD_MESSAGE.values()[ordinal];
|
||||
} else {
|
||||
hudMessage = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf byteBuf) {
|
||||
byteBuf.writeInt(hudMessage.ordinal());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(PacketLokiHudNotificationAck message, MessageContext ctx) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
final ItemStack aRing = ItemLokiRing.getLokiRing(mc.thePlayer) ;
|
||||
if (aRing != null && message.hudMessage != null) {
|
||||
ItemLokiRing.renderHUDNotification(message.hudMessage);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import baubles.common.network.PacketSyncBauble;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
|
||||
public class PacketLokiMirror implements IMessage, IMessageHandler<PacketLokiMirror, IMessage> {
|
||||
@Override
|
||||
public void fromBytes(ByteBuf byteBuf) {
|
||||
// not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf byteBuf) {
|
||||
// not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketLokiMirror message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
final ItemStack aRing = ItemLokiRing.getLokiRing(player);
|
||||
if (aRing != null) {
|
||||
byte mode = ItemLokiRing.getRingMirrorMode(aRing);
|
||||
ItemLokiRing.setMirrorMode(aRing,(byte) ((mode+1)%8));
|
||||
ItemLokiRing.syncLokiRing(player);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(ItemLokiRing.HUD_MESSAGE.MIRROR), player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -28,17 +28,15 @@ public class PacketLokiToggle implements IMessage, IMessageHandler<PacketLokiTog
|
||||
if(player.isSneaking()){
|
||||
boolean ringState = !ItemLokiRing.isRingBreakingEnabled(aRing);
|
||||
ItemLokiRing.setBreakingMode(aRing, ringState);
|
||||
PacketLokiToggleBreakingAck ackMessage = new PacketLokiToggleBreakingAck();
|
||||
ackMessage.state = ringState;
|
||||
PacketHandler.INSTANCE.sendTo(ackMessage, player);
|
||||
ItemLokiRing.syncLokiRing(player);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(ItemLokiRing.HUD_MESSAGE.BREAKING), player);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean ringState = !ItemLokiRing.isRingEnabled(aRing);
|
||||
ItemLokiRing.setMode(aRing, ringState);
|
||||
PacketLokiToggleAck ackMessage = new PacketLokiToggleAck();
|
||||
ackMessage.state = ringState;
|
||||
PacketHandler.INSTANCE.sendTo(ackMessage, player);
|
||||
ItemLokiRing.syncLokiRing(player);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(ItemLokiRing.HUD_MESSAGE.MODE), player);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PacketLokiToggleAck implements IMessage, IMessageHandler<PacketLokiToggleAck, IMessage> {
|
||||
|
||||
public boolean state;
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf byteBuf) {
|
||||
state = byteBuf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf byteBuf) {
|
||||
byteBuf.writeBoolean(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(PacketLokiToggleAck message, MessageContext ctx) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
final ItemStack aRing = ItemLokiRing.getLokiRing(mc.thePlayer) ;
|
||||
if (aRing != null) {
|
||||
ItemLokiRing.setMode(aRing, message.state);
|
||||
ItemLokiRing.renderHUDNotification(ItemLokiRing.HUD_MESSAGE.MODE);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.relic.ItemLokiRing;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PacketLokiToggleBreakingAck implements IMessage, IMessageHandler<PacketLokiToggleBreakingAck, IMessage> {
|
||||
|
||||
public boolean state;
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf byteBuf) {
|
||||
state = byteBuf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf byteBuf) {
|
||||
byteBuf.writeBoolean(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IMessage onMessage(PacketLokiToggleBreakingAck message, MessageContext ctx) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
final ItemStack aRing = ItemLokiRing.getLokiRing(mc.thePlayer) ;
|
||||
if (aRing != null) {
|
||||
ItemLokiRing.setBreakingMode(aRing, message.state);
|
||||
ItemLokiRing.renderHUDNotification(ItemLokiRing.HUD_MESSAGE.BREAKING);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -165,10 +165,12 @@ botaniamisc.breaking=Breaking
|
||||
botaniamisc.lokiClear=Successfully cleared all selection
|
||||
botaniamisc.lokiDescription=Builder's wand but §c§oC§6§oo§e§oo§a§ol§9§oe§5§or
|
||||
botaniamisc.lokiDescription2=Can Place/Interact/Break with multiple blocks at once!
|
||||
botaniamisc.lokiToggleDescription=Mode Switch Key to turn ring
|
||||
botaniamisc.lokiBreakingDescription=Mode Switch Key + Shift to toggle breaking
|
||||
botaniamisc.lokiToggleDescription=Loki Switch Key to turn ring
|
||||
botaniamisc.lokiBreakingDescription=Loki Switch Key + Shift to toggle breaking
|
||||
botaniamisc.lokiCurrent=Current
|
||||
botaniamisc.lokiState=Ring
|
||||
botaniamisc.lokiMirror=Current mirror:
|
||||
botaniamisc.insufficient_mana=Not enough mana!
|
||||
|
||||
# NEI INTEGRATION
|
||||
botania.nei.brewery=Botanical Brewery
|
||||
|
||||
Reference in new issue
Block a user