diff --git a/.gitignore b/.gitignore
index 5fabe22c3..ae3937ec4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/rebuild.bat
/doAllTheThings.bat
/.gradle
/build
diff --git a/LICENSE.md b/LICENSE.md
index 399f876a1..8714aaf52 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -4,27 +4,27 @@ The things listed below are special cases and exceptions from the above. They ha
Everything that is not listed below applies to the above.
### YOU MAY
-* Fork and modify the Code
-* Submit Pull Requests
-* Copy (SMALL!) Parts of the Code for other Projects
-* Make a Review/Spotlight of the Mod or use it in a Modpack
-* Make Let's Play (and similar) Videos containing the Mod
+* Fork and modify the code.
+* Submit pull requests.
+* Copy small parts of code for other projects.
+* Make a review/spotlight of the mod or use it in a modpack.
+* Make Let's Play (and similar) videos containing the mod.
### YOU CAN NOT
-* Copy the entire Code or claim it is yours.
-* Reupload the Code or Mod to another website or claim you made it.
-* Copy entire Classes, Methods or other big Parts of Code.
+* Copy entire classes, methods or features or claim you made them.
+* Redistribute the mod. This does not apply, however, when it comes to pre-packaged modpacks.
### YOU HAVE TO
-* Always credit me. Don't be a jerk and copy entire portions of the code and claim they're yours.
-* When it comes to the code, always link back to this Repository.
-* When it comes to the Mod, always link back to the the Forum Thread linked above.
+* When modifying or using code, always explicitly credit Ellpeck as the creator.
+* When making a review/spotlight containing the mod or using it in a modpack, always make clear that Actually Additions is used.
+* When it comes to the code, always link back to the official repository.
+* When it comes to the mod, always link back to the the official Minecraft Forum thread or CurseForge page.
### NOTES
* The Actually Additions API can be excerpted for use in other projects, however it should not be modified. It can be redistributed with other mods (if it is getting used), however it should still be visible that it is a part of Actually Additions. Do not remove the copyright header from any of the API's files.
-* The above License only applies for Code I wrote myself, any APIs used (such as the CoFH API) have their own License that is being respected.
-* There are some excerpts from other code used (such as the OpenBlocks XP System). Credit to the creators of these parts is always given and their Permission is granted or their License is respected.
-* Almost all of the Assets used in this Mod are made by Glenthor and are owned by me. You are not allowed to copy them for any other Project.
-* Parts of this License, especially restrictive ones, can be ignored with Personal Permission. Said Permission, however, will only be given to people I know or someone who has a very good reason for needing it. If you don't, don't ask.
+* The above License only applies for code I wrote myself, any APIs used (such as the CoFH API) have their own License that is being respected.
+* There are some excerpts from other code used (such as the OpenBlocks XP system). Credit to the creators of these parts is always given and their permission is granted or their license is respected.
+* Almost all of the assets used in this mod are made by Glenthor and are owned by me. You are not allowed to copy them for any other project.
+* Parts of this license, especially restrictive ones, can be ignored with personal permission. Said permission, however, will only be given to people I know or someone who has a very good reason for needing it.
© 2015-2016 Ellpeck
\ No newline at end of file
diff --git a/README.md b/README.md
index e0c360ad9..f63b8d05a 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-![](https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/pics/logoBig.png)
+![](https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/pics/logo.png)
##It's a Minecraft Mod!
-For more information, visit the main Minecraft Forum Thread at http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2551118
\ No newline at end of file
+For more information, visit the main Minecraft Forum Thread by [clicking here](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2551118)!
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 922d1dfb2..3d26e29f4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,22 +7,24 @@ buildscript {
}
}
dependencies {
- classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
+ classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
-apply plugin: 'net.minecraftforge.gradle.forge'
-version = "1.8.9-r25"
+apply plugin: 'net.minecraftforge.gradle.forge'
+apply plugin: 'idea'
+
+version = "1.10.2-r47"
group = "de.ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions"
minecraft {
- version = "1.8.9-11.15.1.1732"
+ version = "1.10.2-12.18.0.2002-1.10.0"
runDir = "idea"
- mappings = "stable_20"
+ mappings = "snapshot_20160519"
makeObfSourceJar = false
- useDepAts = true
+ //useDepAts = true
replaceIn "ModUtil.java"
replace "@VERSION@", project.version.toString()
@@ -35,6 +37,9 @@ repositories {
maven {
url "http://dvs1.progwml6.com/files/maven"
}
+ maven {
+ url "http://maven.epoxide.xyz"
+ }
}
dependencies {
@@ -42,7 +47,8 @@ dependencies {
//compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev"
//compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev"
- deobfCompile "mezz.jei:jei_1.8.9:2.25.6.140"
+ compile "net.darkhax.tesla:Tesla:1.9.4-1.1.0.24"
+ deobfCompile "mezz.jei:jei_1.10:3.7.1.219"
}
processResources {
@@ -60,10 +66,13 @@ processResources {
}
}
-jar {}
+jar {
+
+}
task deobfJar(type: Jar) {
from sourceSets.main.output
+ from sourceSets.main.java
classifier = 'dev'
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 9397848f1..6917d27a0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
diff --git a/pics/forum1.png b/pics/forum1.png
deleted file mode 100644
index 58192e5b7..000000000
Binary files a/pics/forum1.png and /dev/null differ
diff --git a/pics/forum2.png b/pics/forum2.png
deleted file mode 100644
index 83e404485..000000000
Binary files a/pics/forum2.png and /dev/null differ
diff --git a/pics/items.png b/pics/items.png
deleted file mode 100644
index df042775b..000000000
Binary files a/pics/items.png and /dev/null differ
diff --git a/pics/logo.png b/pics/logo.png
new file mode 100644
index 000000000..1de278c31
Binary files /dev/null and b/pics/logo.png differ
diff --git a/pics/logoBig.png b/pics/logoBig.png
deleted file mode 100644
index b0e6da87b..000000000
Binary files a/pics/logoBig.png and /dev/null differ
diff --git a/pics/logoSquare.png b/pics/logoSquare.png
index 6b5cce0a0..d717e634c 100644
Binary files a/pics/logoSquare.png and b/pics/logoSquare.png differ
diff --git a/specialPeopleStuff.properties b/specialPeopleStuff.properties
index 8d03c5a99..54ebcf149 100644
--- a/specialPeopleStuff.properties
+++ b/specialPeopleStuff.properties
@@ -1,12 +1,15 @@
#Because he's me
-ellpeck=ActuallyAdditions:itemBooklet@0
+ellpeck=actuallyadditions:itemBooklet@0
#Because he submitted tons of ideas for the mod
dqmhose=minecraft:torch@0
#Because he does all of the textures
-twoofeight=ActuallyAdditions:blockHeatCollector@0
+twoofeight=actuallyadditions:blockHeatCollector@0
#Because she is awesome and squids are cool
-larixine=ActuallyAdditions:blockBlackLotus@0
+larixine=actuallyadditions:blockBlackLotus@0
#Because he helps me with models and stuff
-canitzp=ActuallyAdditions:blockCoffeeMachine@0
+canitzp=actuallyadditions:blockCoffeeMachine@0
#Because he's an awesome guy and helps with lots of stuff
-xdjackiexd=ActuallyAdditions:itemDrill@14
+xdjackiexd=actuallyadditions:itemDrill@14
+
+#Patreon stuff
+ftog_thorgal=actuallyadditions:itemCrystal@0
\ No newline at end of file
diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java
index 9b528304a..eb2e05ade 100644
--- a/src/main/java/cofh/api/CoFHAPIProps.java
+++ b/src/main/java/cofh/api/CoFHAPIProps.java
@@ -6,6 +6,6 @@ public class CoFHAPIProps {
}
- public static final String VERSION = "1.7.10R1.0.2";
+ public static final String VERSION = "1.8.9R1.2.0B1";
}
diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java
index 25e0126ab..dd7dd3e02 100644
--- a/src/main/java/cofh/api/energy/EnergyStorage.java
+++ b/src/main/java/cofh/api/energy/EnergyStorage.java
@@ -51,29 +51,33 @@ public class EnergyStorage implements IEnergyStorage {
return nbt;
}
- public void setCapacity(int capacity) {
+ public EnergyStorage setCapacity(int capacity) {
this.capacity = capacity;
if (energy > capacity) {
energy = capacity;
}
+ return this;
}
- public void setMaxTransfer(int maxTransfer) {
+ public EnergyStorage setMaxTransfer(int maxTransfer) {
setMaxReceive(maxTransfer);
setMaxExtract(maxTransfer);
+ return this;
}
- public void setMaxReceive(int maxReceive) {
+ public EnergyStorage setMaxReceive(int maxReceive) {
this.maxReceive = maxReceive;
+ return this;
}
- public void setMaxExtract(int maxExtract) {
+ public EnergyStorage setMaxExtract(int maxExtract) {
this.maxExtract = maxExtract;
+ return this;
}
public int getMaxReceive() {
@@ -87,7 +91,7 @@ public class EnergyStorage implements IEnergyStorage {
}
/**
- * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
+ * This function is included to allow for server to client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
* are guaranteed to have it.
*
* @param energy
diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java
index 268721a92..29ef0a1ce 100644
--- a/src/main/java/cofh/api/energy/IEnergyConnection.java
+++ b/src/main/java/cofh/api/energy/IEnergyConnection.java
@@ -2,6 +2,7 @@ package cofh.api.energy;
import net.minecraft.util.EnumFacing;
+
/**
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
* accept it; otherwise just use IEnergyHandler.
diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java
index 1f8967bea..16b236e7a 100644
--- a/src/main/java/cofh/api/energy/IEnergyHandler.java
+++ b/src/main/java/cofh/api/energy/IEnergyHandler.java
@@ -6,53 +6,22 @@ import net.minecraft.util.EnumFacing;
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
*
* A reference implementation is provided {@link TileEnergyHandler}.
+ *
+ * Note that {@link IEnergyReceiver} and {@link IEnergyProvider} are extensions of this.
*
* @author King Lemming
*
*/
-public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
-
- // merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things)
-
- /**
- * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
- *
- * @param from
- * Orientation the energy is received from.
- * @param maxReceive
- * Maximum amount of energy to receive.
- * @param simulate
- * If TRUE, the charge will only be simulated.
- * @return Amount of energy that was (or would have been, if simulated) received.
- */
- @Override
- int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
-
- /**
- * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
- *
- * @param from
- * Orientation the energy is extracted from.
- * @param maxExtract
- * Maximum amount of energy to extract.
- * @param simulate
- * If TRUE, the extraction will only be simulated.
- * @return Amount of energy that was (or would have been, if simulated) extracted.
- */
- @Override
- int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
-
+public interface IEnergyHandler extends IEnergyConnection {
/**
* Returns the amount of energy currently stored.
*/
- @Override
int getEnergyStored(EnumFacing from);
/**
* Returns the maximum amount of energy that can be stored.
*/
- @Override
int getMaxEnergyStored(EnumFacing from);
}
diff --git a/src/main/java/cofh/api/energy/IEnergyProvider.java b/src/main/java/cofh/api/energy/IEnergyProvider.java
index 584c1ebcf..ef0e09d06 100644
--- a/src/main/java/cofh/api/energy/IEnergyProvider.java
+++ b/src/main/java/cofh/api/energy/IEnergyProvider.java
@@ -2,6 +2,7 @@ package cofh.api.energy;
import net.minecraft.util.EnumFacing;
+
/**
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
*
@@ -10,7 +11,7 @@ import net.minecraft.util.EnumFacing;
* @author King Lemming
*
*/
-public interface IEnergyProvider extends IEnergyConnection {
+public interface IEnergyProvider extends IEnergyHandler {
/**
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
@@ -25,14 +26,4 @@ public interface IEnergyProvider extends IEnergyConnection {
*/
int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
- /**
- * Returns the amount of energy currently stored.
- */
- int getEnergyStored(EnumFacing from);
-
- /**
- * Returns the maximum amount of energy that can be stored.
- */
- int getMaxEnergyStored(EnumFacing from);
-
}
diff --git a/src/main/java/cofh/api/energy/IEnergyReceiver.java b/src/main/java/cofh/api/energy/IEnergyReceiver.java
index 775cc11b6..989e9baa5 100644
--- a/src/main/java/cofh/api/energy/IEnergyReceiver.java
+++ b/src/main/java/cofh/api/energy/IEnergyReceiver.java
@@ -2,6 +2,7 @@ package cofh.api.energy;
import net.minecraft.util.EnumFacing;
+
/**
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
*
@@ -10,7 +11,7 @@ import net.minecraft.util.EnumFacing;
* @author King Lemming
*
*/
-public interface IEnergyReceiver extends IEnergyConnection {
+public interface IEnergyReceiver extends IEnergyHandler {
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
@@ -25,14 +26,4 @@ public interface IEnergyReceiver extends IEnergyConnection {
*/
int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
- /**
- * Returns the amount of energy currently stored.
- */
- int getEnergyStored(EnumFacing from);
-
- /**
- * Returns the maximum amount of energy that can be stored.
- */
- int getMaxEnergyStored(EnumFacing from);
-
}
diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java
index 5fee42639..0fb36dab6 100644
--- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java
+++ b/src/main/java/cofh/api/energy/ItemEnergyContainer.java
@@ -43,27 +43,30 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
return this;
}
- public void setMaxTransfer(int maxTransfer) {
+ public ItemEnergyContainer setMaxTransfer(int maxTransfer) {
setMaxReceive(maxTransfer);
setMaxExtract(maxTransfer);
+ return this;
}
- public void setMaxReceive(int maxReceive) {
+ public ItemEnergyContainer setMaxReceive(int maxReceive) {
this.maxReceive = maxReceive;
+ return this;
}
- public void setMaxExtract(int maxExtract) {
+ public ItemEnergyContainer setMaxExtract(int maxExtract) {
this.maxExtract = maxExtract;
+ return this;
}
/* IEnergyContainerItem */
@Override
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
- if (container.getTagCompound() == null) {
+ if (!container.hasTagCompound()) {
container.setTagCompound(new NBTTagCompound());
}
int energy = container.getTagCompound().getInteger("Energy");
diff --git a/src/main/java/cofh/api/energy/TileEnergyHandler.java b/src/main/java/cofh/api/energy/TileEnergyHandler.java
deleted file mode 100644
index 175ee6676..000000000
--- a/src/main/java/cofh/api/energy/TileEnergyHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package cofh.api.energy;
-
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumFacing;
-
-/**
- * Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
- *
- * @author King Lemming
- *
- */
-public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
-
- protected EnergyStorage storage = new EnergyStorage(32000);
-
- @Override
- public void readFromNBT(NBTTagCompound nbt) {
-
- super.readFromNBT(nbt);
- storage.readFromNBT(nbt);
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt) {
-
- super.writeToNBT(nbt);
- storage.writeToNBT(nbt);
- }
-
- /* IEnergyConnection */
- @Override
- public boolean canConnectEnergy(EnumFacing from) {
-
- return true;
- }
-
- /* IEnergyReceiver */
- @Override
- public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
-
- return storage.receiveEnergy(maxReceive, simulate);
- }
-
- /* IEnergyProvider */
- @Override
- public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) {
-
- return storage.extractEnergy(maxExtract, simulate);
- }
-
- /* IEnergyReceiver and IEnergyProvider */
- @Override
- public int getEnergyStored(EnumFacing from) {
-
- return storage.getEnergyStored();
- }
-
- @Override
- public int getMaxEnergyStored(EnumFacing from) {
-
- return storage.getMaxEnergyStored();
- }
-
-}
diff --git a/src/main/java/cofh/api/energy/package-info.java b/src/main/java/cofh/api/energy/package-info.java
index 880844fca..da8566735 100644
--- a/src/main/java/cofh/api/energy/package-info.java
+++ b/src/main/java/cofh/api/energy/package-info.java
@@ -1,10 +1,10 @@
/**
- * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
+ * (C) 2014-2016 Team CoFH / CoFH / Cult of the Full Hub
* http://www.teamcofh.com
*/
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
package cofh.api.energy;
-import cofh.api.CoFHAPIProps;
import net.minecraftforge.fml.common.API;
+import cofh.api.CoFHAPIProps;
diff --git a/src/main/java/cofh/api/package-info.java b/src/main/java/cofh/api/package-info.java
index 25e1ecc5d..e2847daad 100644
--- a/src/main/java/cofh/api/package-info.java
+++ b/src/main/java/cofh/api/package-info.java
@@ -1,8 +1,9 @@
/**
- * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
+ * (C) 2014-2016 Team CoFH / CoFH / Cult of the Full Hub
* http://www.teamcofh.com
*/
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
package cofh.api;
-import net.minecraftforge.fml.common.API;
\ No newline at end of file
+import net.minecraftforge.fml.common.API;
+
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java
index 840c6e8cc..f061d87ec 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java
@@ -1,44 +1,53 @@
/*
- * This file ("ActuallyAdditionsAPI.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ActuallyAdditionsAPI.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
-import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn;
-import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
-import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
-import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
-import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
+import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
+import de.ellpeck.actuallyadditions.api.lens.Lens;
+import de.ellpeck.actuallyadditions.api.lens.LensConversion;
+import de.ellpeck.actuallyadditions.api.recipe.*;
+import net.minecraft.block.Block;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-public class ActuallyAdditionsAPI{
+public final class ActuallyAdditionsAPI{
- public static final String MOD_ID = "ActuallyAdditions";
- public static final String API_ID = MOD_ID+"API";
- public static final String API_VERSION = "8";
-
- public static List crusherRecipes = new ArrayList();
- public static List ballOfFurReturnItems = new ArrayList();
- public static List treasureChestLoot = new ArrayList();
- public static List reconstructorLensNoneRecipes = new ArrayList();
- public static List coffeeMachineIngredients = new ArrayList();
-
- public static List bookletEntries = new ArrayList();
- public static List bookletPagesWithItemStackData = new ArrayList();
-
- //These are getting initlized in Actually Additions' PreInit phase
+ public static final String MOD_ID = "actuallyadditions";
+ public static final String API_ID = MOD_ID+"api";
+ public static final String API_VERSION = "17";
+ public static final List CRUSHER_RECIPES = new ArrayList();
+ public static final List BALL_OF_FUR_RETURN_ITEMS = new ArrayList();
+ public static final List TREASURE_CHEST_LOOT = new ArrayList();
+ public static final List RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList();
+ public static final Map- RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap
- ();
+ public static final List COFFEE_MACHINE_INGREDIENTS = new ArrayList();
+ public static final List COMPOST_RECIPES = new ArrayList();
+ public static final List BOOKLET_ENTRIES = new ArrayList();
+ public static final List BOOKLET_PAGES_WITH_ITEM_DATA = new ArrayList();
+ /**
+ * Use this to handle things that aren't based in the API itself
+ * DO NOT CHANGE/OVERRIDE THIS!!
+ * This is getting initialized in Actually Additions' PreInit phase
+ */
+ public static IMethodHandler methodHandler;
+ //These are getting initialized in Actually Additions' PreInit phase
+ //DO NOT CHANGE/OVERRIDE THESE!!
public static IBookletEntry entryGettingStarted;
public static IBookletEntry entryFunctionalNonRF;
public static IBookletEntry entryFunctionalRF;
@@ -48,6 +57,14 @@ public class ActuallyAdditionsAPI{
public static IBookletEntry entryMisc;
public static IBookletEntry allAndSearch;
+ //These are getting initialized in Actually Additions' PreInit phase
+ //DO NOT CHANGE/OVERRIDE THESE!!
+ public static LensConversion lensDefaultConversion;
+ public static Lens lensDetonation;
+ public static Lens lensDeath;
+ public static Lens lensColor;
+ public static Lens lensDisruption;
+
/**
* Adds a Recipe to the Crusher Recipe Registry
* The second output will be nothing
@@ -71,8 +88,8 @@ public class ActuallyAdditionsAPI{
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/
public static void addCrusherRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){
- if(!OreDictionary.getOres(input).isEmpty() && !OreDictionary.getOres(outputOne).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo).isEmpty())){
- crusherRecipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
+ if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){
+ CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
}
}
@@ -97,7 +114,7 @@ public class ActuallyAdditionsAPI{
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
- crusherRecipes.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance));
+ CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance));
}
/**
@@ -109,11 +126,24 @@ public class ActuallyAdditionsAPI{
* @param outputOneAmount The amount of the first output
*/
public static void addCrusherRecipe(ItemStack input, String outputOne, int outputOneAmount){
- if(!OreDictionary.getOres(outputOne).isEmpty()){
- crusherRecipes.add(new CrusherRecipe(input, outputOne, outputOneAmount));
+ if(!OreDictionary.getOres(outputOne, false).isEmpty()){
+ CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputOneAmount));
}
}
+ /**
+ * Adds a new conversion recipe to the compost.
+ * StackSize is regarded on both input and output and they can be different.
+ *
+ * @param input The itemstack to be input into the compost
+ * @param inputDisplay The block to display when there is input in the compost
+ * @param output The itemstack to be output from the compost once conversion finishes
+ * @param outputDisplay The block to display when there is output in the compost
+ */
+ public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
+ COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
+ }
+
/**
* Adds an item to the list of possible items to be returned when right-clicking a Ball Of Fur
*
@@ -121,7 +151,7 @@ public class ActuallyAdditionsAPI{
* @param chance The chance (this is from WeightedRandom.Item)
*/
public static void addBallOfFurReturnItem(ItemStack stack, int chance){
- ActuallyAdditionsAPI.ballOfFurReturnItems.add(new BallOfFurReturn(stack, chance));
+ BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
}
/**
@@ -133,30 +163,55 @@ public class ActuallyAdditionsAPI{
* @param maxAmount The maximum stacksize of the returned stack
*/
public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount){
- ActuallyAdditionsAPI.treasureChestLoot.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
+ TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
}
/**
- * Adds a recipe to the Atomic Reconstructor conversion without lens
+ * Adds a recipe to the Atomic Reconstructor conversion lenses
* StackSizes can only be 1 and greater ones will be ignored
*
* @param input The input as an ItemStack
* @param output The output as an ItemStack
* @param energyUse The amount of RF used per conversion
+ * @param type The type of lens used for the conversion. To use the default type, use method below.
+ * Note how this always has to be the same instance of the lens type that the item also has for it to work!
*/
- public static void addReconstructorLensNoneRecipe(ItemStack input, ItemStack output, int energyUse){
- reconstructorLensNoneRecipes.add(new LensNoneRecipe(input, output, energyUse));
+ public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
+ RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
+ }
+
+ public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
+ addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
}
/**
- * Adds a recipe to the Atomic Reconstructor conversion without lens
+ * Adds a recipe to the Atomic Reconstructor conversion lenses
*
* @param input The input's OreDictionary name
* @param output The output's OreDictionary name
* @param energyUse The amount of RF used per conversion
+ * @param type The type of lens used for the conversion. To use the default type, use method below
+ * Note how this always has to be the same instance of the lens type that the item also has for it to work!
*/
- public static void addReconstructorLensNoneRecipe(String input, String output, int energyUse){
- reconstructorLensNoneRecipes.add(new LensNoneRecipe(input, output, energyUse));
+ public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse, LensConversion type){
+ RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
+ }
+
+ public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){
+ addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
+ }
+
+ /**
+ * Adds an item and the way it is modified to the Atomic Reconstructor's color lens.
+ * This also works for blocks, but they have to be in their item form.
+ * The way it is modified is an instance of IColorLensChanger. When modifying the item,
+ * its modifyItem() method will be called with a stack containing the item.
+ *
+ * @param item The item (or block's item) to add
+ * @param changer The change mechanism
+ */
+ public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer){
+ RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
}
/**
@@ -165,7 +220,7 @@ public class ActuallyAdditionsAPI{
* @param ingredient The ingredient to add
*/
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient){
- coffeeMachineIngredients.add(ingredient);
+ COFFEE_MACHINE_INGREDIENTS.add(ingredient);
}
/**
@@ -174,7 +229,7 @@ public class ActuallyAdditionsAPI{
* @param entry The entry to add
*/
public static void addBookletEntry(IBookletEntry entry){
- bookletEntries.add(entry);
+ BOOKLET_ENTRIES.add(entry);
}
/**
@@ -184,6 +239,6 @@ public class ActuallyAdditionsAPI{
* @param page The page to add
*/
public static void addPageWithItemStackData(BookletPage page){
- bookletPagesWithItemStackData.add(page);
+ BOOKLET_PAGES_WITH_ITEM_DATA.add(page);
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/BookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/BookletPage.java
index e22994256..bc8aaee35 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/BookletPage.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/BookletPage.java
@@ -1,16 +1,17 @@
/*
- * This file ("IBookletPage.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletPage.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.booklet;
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -20,6 +21,18 @@ public abstract class BookletPage{
public boolean arePageStacksWildcard;
protected IBookletChapter chapter;
+ public void onOpened(IBookletGui gui){
+
+ }
+
+ public void onClosed(IBookletGui gui){
+
+ }
+
+ public boolean onActionPerformed(IBookletGui gui, GuiButton button){
+ return false;
+ }
+
/**
* The ID of the page, for the page number etc.
* Don't make two pages in the same chapter with the same ID.
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java
index 85900c627..41179427b 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java
@@ -1,11 +1,11 @@
/*
- * This file ("IBookletChapter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IBookletChapter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.booklet;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java
index c053dfa1f..a46b9dc44 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java
@@ -1,11 +1,11 @@
/*
- * This file ("IBookletEntry.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IBookletEntry.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.booklet;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java
index b4625cc17..bcd2153c3 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java
@@ -1,15 +1,16 @@
/*
- * This file ("IAtomicReconstructor.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IAtomicReconstructor.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.internal;
+import de.ellpeck.actuallyadditions.api.lens.Lens;
import net.minecraft.world.World;
/**
@@ -49,4 +50,6 @@ public interface IAtomicReconstructor{
* Gets the amount of energy the Reconstructor has stored in its RF storage
*/
int getEnergy();
+
+ Lens getLens();
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IBookletGui.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IBookletGui.java
index 96d279db3..ca92ace10 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IBookletGui.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IBookletGui.java
@@ -1,20 +1,23 @@
/*
- * This file ("IBookletGui.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IBookletGui.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.internal;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
+import java.util.List;
+
/**
* This is a helper interface for BookletPage
* This is not supposed to be implemented.
@@ -27,9 +30,8 @@ public interface IBookletGui{
* This method should be used when drawing an ItemStack to a booklet page
* It displays the hoverover text of the item and also contains the "show more info"-text and clickable part
*
- * @param renderTransferButton if the "show more info"-text and clickable part should exist-
+ * @param renderTransferButton if the "show more info"-text and clickable part should exist
*/
- @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
void renderTooltipAndTransferButton(BookletPage from, ItemStack stack, int x, int y, boolean renderTransferButton, boolean mousePressed);
@@ -43,5 +45,7 @@ public interface IBookletGui{
void drawRect(int startX, int startY, int u, int v, int xSize, int ySize);
- EntrySet getCurrentEntrySet();
+ IEntrySet getCurrentEntrySet();
+
+ List getButtonList();
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEntrySet.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEntrySet.java
new file mode 100644
index 000000000..7340e315b
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IEntrySet.java
@@ -0,0 +1,41 @@
+/*
+ * This file ("IEntrySet.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.internal;
+
+import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
+import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
+import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
+import net.minecraft.nbt.NBTTagCompound;
+
+public interface IEntrySet{
+
+ void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex);
+
+ void removeEntry();
+
+ NBTTagCompound writeToNBT();
+
+ BookletPage getCurrentPage();
+
+ IBookletEntry getCurrentEntry();
+
+ IBookletChapter getCurrentChapter();
+
+ int getPageInIndex();
+
+ void setPage(BookletPage page);
+
+ void setEntry(IBookletEntry entry);
+
+ void setChapter(IBookletChapter chapter);
+
+ void setPageInIndex(int page);
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java
new file mode 100644
index 000000000..388c1971b
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java
@@ -0,0 +1,37 @@
+/*
+ * This file ("IMethodHandler.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.internal;
+
+import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.math.BlockPos;
+
+/**
+ * This is the internal method handler.
+ * Use ActuallyAdditionsAPI.methodHandler for calling
+ * This is not supposed to be implemented.
+ */
+public interface IMethodHandler{
+
+ boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
+
+ PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect);
+
+ void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp);
+
+ void addEffectToStack(ItemStack stack, PotionEffect effect);
+
+ PotionEffect[] getEffectsFromStack(ItemStack stack);
+
+ boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/ILensItem.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/ILensItem.java
index e1faa032f..339e24820 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/ILensItem.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/ILensItem.java
@@ -1,11 +1,11 @@
/*
- * This file ("ILensItem.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ILensItem.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.lens;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java
index de2bd038c..d1a1c3004 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java
@@ -1,22 +1,22 @@
/*
- * This file ("Lens.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("Lens.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.lens;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
/**
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
- * You need to call register() to register the type
*/
public abstract class Lens{
@@ -32,7 +32,7 @@ public abstract class Lens{
* @param tile The tile the lens was invoked from
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
*/
- public abstract boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile);
+ public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
/**
* Returns the color in an array of 3 float values that are r, g, b
@@ -40,12 +40,12 @@ public abstract class Lens{
public abstract float[] getColor();
/**
- * Gets the maximum distance the beam goes with this lense
+ * Gets the maximum distance the beam goes with this lens
*/
public abstract int getDistance();
/**
- * Sets the item corresponding to the lense
+ * Sets the item corresponding to the lens
*/
public void setLensItem(Item item){
this.lensItem = item;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java
new file mode 100644
index 000000000..186210036
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java
@@ -0,0 +1,43 @@
+/*
+ * This file ("LensConversion.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.lens;
+
+
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
+import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.util.math.BlockPos;
+
+/**
+ * This is the base class for a Reconstructor Lens Type that converts two items
+ * via the ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES list.
+ *
+ * If you want to make a new type of conversion, just use your type in the recipe
+ * If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion.
+ */
+public class LensConversion extends Lens{
+
+ @Override
+ public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
+ return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
+ }
+
+ @Override
+ public float[] getColor(){
+ return new float[]{27F/255F, 109F/255F, 1F};
+ }
+
+ @Override
+ public int getDistance(){
+ return 10;
+ }
+
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java b/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java
new file mode 100644
index 000000000..5ca033915
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/misc/IDisplayStandItem.java
@@ -0,0 +1,21 @@
+/*
+ * This file ("IDisplayStandItem.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.misc;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public interface IDisplayStandItem{
+
+ boolean update(ItemStack stack, TileEntity tile, int elapsedTicks);
+
+ int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks);
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/package-info.java b/src/main/java/de/ellpeck/actuallyadditions/api/package-info.java
index f2612d9f4..1a290e29b 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/package-info.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/package-info.java
@@ -1,11 +1,11 @@
/*
- * This file ("package-info.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("package-info.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
@API(owner = ActuallyAdditionsAPI.MOD_ID, apiVersion = ActuallyAdditionsAPI.API_VERSION, provides = ActuallyAdditionsAPI.API_ID)
package de.ellpeck.actuallyadditions.api;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/BallOfFurReturn.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/BallOfFurReturn.java
index 845a3e17b..e2006733c 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/BallOfFurReturn.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/BallOfFurReturn.java
@@ -1,11 +1,11 @@
/*
- * This file ("BallOfFurReturn.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BallOfFurReturn.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.recipe;
@@ -15,7 +15,7 @@ import net.minecraft.util.WeightedRandom;
public class BallOfFurReturn extends WeightedRandom.Item{
- public ItemStack returnItem;
+ public final ItemStack returnItem;
public BallOfFurReturn(ItemStack returnItem, int chance){
super(chance);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeIngredient.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java
similarity index 76%
rename from src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeIngredient.java
rename to src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java
index 53f67a3b4..b195fc671 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeIngredient.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java
@@ -1,15 +1,16 @@
/*
- * This file ("CoffeeIngredient.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("CoffeeIngredient.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
-package de.ellpeck.actuallyadditions.api.recipe.coffee;
+package de.ellpeck.actuallyadditions.api.recipe;
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
@@ -30,7 +31,7 @@ public class CoffeeIngredient{
}
public boolean effect(ItemStack stack){
- return CoffeeBrewing.addEffectToStack(stack, this);
+ return ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
}
public String getExtraText(){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java
new file mode 100644
index 000000000..87b6095e7
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java
@@ -0,0 +1,36 @@
+/*
+ * This file ("ColorLensChangerByDyeMeta.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.recipe;
+
+import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.math.BlockPos;
+
+/**
+ * Changes an item's color by changing its metadata.
+ * Much like dye and wool, 0 is white and 15 is black and it will cycle around.
+ */
+public class ColorLensChangerByDyeMeta implements IColorLensChanger{
+
+ @Override
+ public ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile){
+ ItemStack newStack = stack.copy();
+ int meta = newStack.getItemDamage();
+ if(meta >= 15){
+ newStack.setItemDamage(0);
+ }
+ else{
+ newStack.setItemDamage(meta+1);
+ }
+ return newStack;
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java
new file mode 100644
index 000000000..cab1f74ee
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java
@@ -0,0 +1,30 @@
+/*
+ * This file ("CompostRecipe.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.recipe;
+
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+
+public class CompostRecipe{
+
+ public final ItemStack input;
+ public final ItemStack output;
+ public final Block inputDisplay;
+ public final Block outputDisplay;
+
+ public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
+ this.input = input;
+ this.output = output;
+ this.inputDisplay = inputDisplay;
+ this.outputDisplay = outputDisplay;
+ }
+
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java
index 31c326130..530b892cd 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java
@@ -1,11 +1,11 @@
/*
- * This file ("CrusherRecipe.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("CrusherRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.recipe;
@@ -60,7 +60,7 @@ public class CrusherRecipe{
return null;
}
- List stacks = OreDictionary.getOres(this.outputOne);
+ List stacks = OreDictionary.getOres(this.outputOne, false);
if(stacks != null && !stacks.isEmpty()){
List stacksCopy = new ArrayList();
for(ItemStack stack : stacks){
@@ -84,7 +84,7 @@ public class CrusherRecipe{
return null;
}
- List stacks = OreDictionary.getOres(this.outputTwo);
+ List stacks = OreDictionary.getOres(this.outputTwo, false);
if(stacks != null && !stacks.isEmpty()){
List stacksCopy = new ArrayList();
for(ItemStack stack : stacks){
@@ -108,7 +108,7 @@ public class CrusherRecipe{
return null;
}
- List stacks = OreDictionary.getOres(this.input);
+ List stacks = OreDictionary.getOres(this.input, false);
if(stacks != null && !stacks.isEmpty()){
List stacksCopy = new ArrayList();
for(ItemStack stack : stacks){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java
new file mode 100644
index 000000000..e80da6b2a
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java
@@ -0,0 +1,40 @@
+/*
+ * This file ("IColorLensChanger.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.api.recipe;
+
+import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.math.BlockPos;
+
+/**
+ * Used for the Atomic Reconstructor's Color Lens changing algorythm.
+ * When registering a new item to be changed, it needs an IColorLensChanger which
+ * is the method with which the item will be changed.
+ *
+ * See ColorLensChangerByDyeMeta for reference.
+ */
+public interface IColorLensChanger{
+
+ /**
+ * Modifies the given item.
+ * Will only be called with stacks containing items that are registered with
+ * this IColorLensChanger.
+ *
+ * @param stack the stack to modify
+ * @param hitBlockState The state of the block that was hit
+ * @param hitBlock the block that was hit (usually air, or the block that is also in the stack)
+ * @param tile the Reconstructor doing the color conversion
+ * @return the modified stack. Please make sure to return a modified COPY of the input stack.
+ */
+ ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile);
+
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensNoneRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java
similarity index 79%
rename from src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensNoneRecipe.java
rename to src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java
index 12d7b8aa1..43edbcc13 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensNoneRecipe.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java
@@ -1,15 +1,16 @@
/*
- * This file ("LensNoneRecipe.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("LensConversionRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.recipe;
+import de.ellpeck.actuallyadditions.api.lens.LensConversion;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
@@ -17,24 +18,27 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-public class LensNoneRecipe{
+public class LensConversionRecipe{
- public int energyUse;
+ public final int energyUse;
+ public final LensConversion type;
private String input;
private String output;
private ItemStack inputStack;
private ItemStack outputStack;
- public LensNoneRecipe(ItemStack input, ItemStack output, int energyUse){
+ public LensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
this.inputStack = input;
this.outputStack = output;
this.energyUse = energyUse;
+ this.type = type;
}
- public LensNoneRecipe(String input, String output, int energyUse){
+ public LensConversionRecipe(String input, String output, int energyUse, LensConversion type){
this.input = input;
this.output = output;
this.energyUse = energyUse;
+ this.type = type;
}
public List getOutputs(){
@@ -46,7 +50,7 @@ public class LensNoneRecipe{
return null;
}
- List stacks = OreDictionary.getOres(this.output);
+ List stacks = OreDictionary.getOres(this.output, false);
if(stacks != null && !stacks.isEmpty()){
List stacksCopy = new ArrayList();
for(ItemStack stack : stacks){
@@ -70,7 +74,7 @@ public class LensNoneRecipe{
return null;
}
- List stacks = OreDictionary.getOres(this.input);
+ List stacks = OreDictionary.getOres(this.input, false);
if(stacks != null && !stacks.isEmpty()){
List stacksCopy = new ArrayList();
for(ItemStack stack : stacks){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/TreasureChestLoot.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/TreasureChestLoot.java
index 7c02f8855..df310f16f 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/TreasureChestLoot.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/TreasureChestLoot.java
@@ -1,11 +1,11 @@
/*
- * This file ("TreasureChestLoot.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("TreasureChestLoot.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.recipe;
@@ -15,9 +15,9 @@ import net.minecraft.util.WeightedRandom;
public class TreasureChestLoot extends WeightedRandom.Item{
- public ItemStack returnItem;
- public int minAmount;
- public int maxAmount;
+ public final ItemStack returnItem;
+ public final int minAmount;
+ public final int maxAmount;
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount){
super(chance);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java
deleted file mode 100644
index b7ec3e8b6..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * This file ("CoffeeBrewing.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.api.recipe.coffee;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.potion.PotionEffect;
-
-import java.util.ArrayList;
-
-/**
- * This is a util class for adding Ingredients to ItemStacks
- * Use when making a custom Coffee Ingredient
- */
-public class CoffeeBrewing{
-
- public static boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient){
- boolean worked = false;
- if(ingredient != null){
- PotionEffect[] effects = ingredient.getEffects();
- if(effects != null && effects.length > 0){
- for(PotionEffect effect : effects){
- PotionEffect effectHas = getSameEffectFromStack(stack, effect);
- if(effectHas != null){
- if(effectHas.getAmplifier() < ingredient.maxAmplifier-1){
- addEffectProperties(stack, effect, false, true);
- worked = true;
- }
- }
- else{
- addEffectToStack(stack, effect);
- worked = true;
- }
- }
- }
- }
- return worked;
- }
-
- public static PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect){
- PotionEffect[] effectsStack = getEffectsFromStack(stack);
- if(effectsStack != null && effectsStack.length > 0){
- for(PotionEffect effectStack : effectsStack){
- if(effect.getPotionID() == effectStack.getPotionID()){
- return effectStack;
- }
- }
- }
- return null;
- }
-
- public static void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp){
- PotionEffect[] effects = getEffectsFromStack(stack);
- stack.setTagCompound(new NBTTagCompound());
- for(int i = 0; i < effects.length; i++){
- if(effects[i].getPotionID() == effect.getPotionID()){
- effects[i] = new PotionEffect(effects[i].getPotionID(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0));
- }
- addEffectToStack(stack, effects[i]);
- }
- }
-
- public static void addEffectToStack(ItemStack stack, PotionEffect effect){
- NBTTagCompound tag = stack.getTagCompound();
- if(tag == null){
- tag = new NBTTagCompound();
- }
-
- int prevCounter = tag.getInteger("Counter");
- NBTTagCompound compound = new NBTTagCompound();
- compound.setInteger("ID", effect.getPotionID());
- compound.setInteger("Duration", effect.getDuration());
- compound.setInteger("Amplifier", effect.getAmplifier());
-
- int counter = prevCounter+1;
- tag.setTag(counter+"", compound);
- tag.setInteger("Counter", counter);
-
- stack.setTagCompound(tag);
- }
-
- public static PotionEffect[] getEffectsFromStack(ItemStack stack){
- ArrayList effects = new ArrayList();
- NBTTagCompound tag = stack.getTagCompound();
- if(tag != null){
- int counter = tag.getInteger("Counter");
- while(counter > 0){
- NBTTagCompound compound = (NBTTagCompound)tag.getTag(counter+"");
- PotionEffect effect = new PotionEffect(compound.getInteger("ID"), compound.getInteger("Duration"), compound.getByte("Amplifier"));
- if(effect.getPotionID() > 0){
- effects.add(effect);
- }
- counter--;
- }
- }
- return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null;
- }
-
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java b/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java
index e034a2228..80b6729ae 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java
@@ -1,16 +1,16 @@
/*
- * This file ("IPhantomTile.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IPhantomTile.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.tile;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
/**
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java
index bbd2131d6..856379623 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java
@@ -1,15 +1,16 @@
/*
- * This file ("ActuallyAdditions.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ActuallyAdditions.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod;
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
@@ -17,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.ItemCrafting;
-import de.ellpeck.actuallyadditions.mod.event.InitEvents;
+import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.InitVillager;
import de.ellpeck.actuallyadditions.mod.gen.OreGen;
@@ -25,10 +26,14 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitForeignPaxels;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
-import de.ellpeck.actuallyadditions.mod.items.lens.LensNoneRecipeHandler;
+import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
+import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials;
-import de.ellpeck.actuallyadditions.mod.misc.*;
+import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
+import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
+import de.ellpeck.actuallyadditions.mod.misc.MethodHandler;
+import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.ore.InitOreDict;
import de.ellpeck.actuallyadditions.mod.proxy.IProxy;
@@ -37,16 +42,16 @@ import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
-import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.Util;
-import net.minecraft.init.Items;
-import net.minecraft.server.MinecraftServer;
+import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
-import net.minecraftforge.fml.common.event.*;
+import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
+import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import java.util.Locale;
@@ -57,13 +62,22 @@ public class ActuallyAdditions{
@Instance(ModUtil.MOD_ID)
public static ActuallyAdditions instance;
- @SidedProxy(clientSide = "de.ellpeck.actuallyadditions.mod.proxy.ClientProxy", serverSide = "de.ellpeck.actuallyadditions.mod.proxy.ServerProxy")
+ @SidedProxy(clientSide = ModUtil.PROXY_CLIENT, serverSide = ModUtil.PROXY_SERVER)
public static IProxy proxy;
+ static{
+ //For some reason, this has to be done here
+ FluidRegistry.enableUniversalBucket();
+ }
+
@EventHandler
public void preInit(FMLPreInitializationEvent event){
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
+ ActuallyAdditionsAPI.methodHandler = new MethodHandler();
+ Lenses.init();
+ InitBooklet.preInit();
+
new ConfigurationHandler(event.getSuggestedConfigurationFile());
PacketHandler.init();
InitToolMaterials.init();
@@ -72,8 +86,9 @@ public class ActuallyAdditions{
InitFluids.init();
InitItems.init();
FuelHandler.init();
- UpdateChecker.init();
- InitBooklet.preInit();
+ BannerHelper.init();
+ SoundHandler.init();
+ new UpdateChecker();
proxy.preInit(event);
ModUtil.LOGGER.info("PreInitialization Finished.");
@@ -86,11 +101,12 @@ public class ActuallyAdditions{
InitOreDict.init();
InitAchievements.init();
GuiHandler.init();
- OreGen.init();
+ new OreGen();
TileEntityBase.init();
- InitEvents.init();
+ new CommonEvents();
InitCrafting.init();
DungeonLoot.init();
+
proxy.init(event);
ModUtil.LOGGER.info("Initialization Finished.");
@@ -106,41 +122,25 @@ public class ActuallyAdditions{
ItemCrafting.initMashedFoodRecipes();
HairyBallHandler.init();
TreasureChestHandler.init();
- LensNoneRecipeHandler.init();
+ LensRecipeHandler.init();
InitForeignPaxels.init();
InitBooklet.postInit();
proxy.postInit(event);
ModUtil.LOGGER.info("PostInitialization Finished.");
- FakePlayerUtil.info();
- }
-
- @EventHandler
- public void serverStarting(FMLServerStartingEvent event){
- Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
- Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
- Util.registerDispenserHandler(Items.bucket, new DispenserHandlerFillBucket());
- Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
- }
-
- @EventHandler
- public void serverStarted(FMLServerStartedEvent event){
- if(LaserRelayConnectionHandler.getInstance() == null){
- LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
- }
-
- WorldData.init(MinecraftServer.getServer());
}
@EventHandler
public void missingMapping(FMLMissingMappingsEvent event){
for(FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){
- //Ignore removal of foreign paxels
- if(mapping.name != null && mapping.name.toLowerCase(Locale.ROOT).startsWith(ModUtil.MOD_ID_LOWER+":")){
- if(mapping.name.contains("paxel") || mapping.name.contains("itemSpecial") || mapping.name.contains("blockBookStand")){
- mapping.ignore();
- ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
+ if(mapping.name != null){
+ String name = mapping.name.toLowerCase(Locale.ROOT);
+ if(name.startsWith(ModUtil.MOD_ID+":")){
+ if(name.contains("paxel") || name.contains("itemspecial") || name.contains("blockbookstand") || name.contains("rarmor") || name.contains("bucket") || name.contains("modulereconstructor")){
+ mapping.ignore();
+ ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
+ }
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java
index e8bf4f7eb..077190796 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/InitAchievements.java
@@ -1,11 +1,11 @@
/*
- * This file ("InitAchievements.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitAchievements.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.achievement;
@@ -17,20 +17,20 @@ import net.minecraftforge.common.AchievementPage;
import java.util.ArrayList;
-public class InitAchievements{
+public final class InitAchievements{
+ public static final ArrayList ACHIEVEMENT_LIST = new ArrayList();
public static int pageNumber;
public static AchievementPage theAchievementPage;
- public static ArrayList achievementList = new ArrayList();
public static void init(){
ModUtil.LOGGER.info("Initializing Achievements...");
for(int i = 0; i < TheAchievements.values().length; i++){
- achievementList.add(TheAchievements.values()[i].ach);
+ ACHIEVEMENT_LIST.add(TheAchievements.values()[i].chieve);
}
- theAchievementPage = new AchievementPage(StringUtil.localize("achievement.page."+ModUtil.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()]));
+ theAchievementPage = new AchievementPage(StringUtil.localize("achievement.page."+ModUtil.MOD_ID), ACHIEVEMENT_LIST.toArray(new Achievement[ACHIEVEMENT_LIST.size()]));
pageNumber = AchievementPage.getAchievementPages().size();
AchievementPage.registerAchievementPage(theAchievementPage);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java
index 09043220f..b0a338a99 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java
@@ -1,26 +1,28 @@
/*
- * This file ("TheAchievements.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("TheAchievements.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.achievement;
+import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements.Type;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public enum TheAchievements{
- OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, InitAchievements.Type.MISC),
- NAME_SMILEY_CLOUD("nameSmileyCloud", 4, 2, new ItemStack(InitBlocks.blockSmileyCloud), null, InitAchievements.Type.MISC, true),
- OPEN_TREASURE_CHEST("openTreasureChest", 1, -3, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET, InitAchievements.Type.MISC),
+ OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, Type.MISC),
+ NAME_SMILEY_CLOUD("nameSmileyCloud", 4, 2, new ItemStack(InitBlocks.blockSmileyCloud), null, Type.MISC, true),
+ OPEN_TREASURE_CHEST("openTreasureChest", 1, -3, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET, Type.MISC),
CRAFT_COAL_GEN("craftCoalGen", -2, 0, new ItemStack(InitBlocks.blockCoalGenerator), OPEN_BOOKLET),
CRAFT_LEAF_GEN("craftLeafGen", -3, -2, new ItemStack(InitBlocks.blockLeafGenerator), CRAFT_COAL_GEN),
CRAFT_RECONSTRUCTOR("craftReconstructor", -5, 0, new ItemStack(InitBlocks.blockAtomicReconstructor), CRAFT_COAL_GEN),
@@ -29,29 +31,31 @@ public enum TheAchievements{
CRAFT_ENERGYFACE("craftEnergyface", 2, -2, new ItemStack(InitBlocks.blockPhantomEnergyface), CRAFT_PHANTOMFACE),
CRAFT_LASER_RELAY("craftLaserRelay", -7, -2, new ItemStack(InitBlocks.blockLaserRelay), CRAFT_RECONSTRUCTOR),
CRAFT_CRUSHER("craftCrusher", -8, 0, new ItemStack(InitBlocks.blockGrinder), CRAFT_RECONSTRUCTOR),
- PICK_UP_COFFEE("pickUpCoffee", -4, 2, new ItemStack(InitItems.itemCoffeeBean), CRAFT_RECONSTRUCTOR, InitAchievements.Type.PICK_UP),
- CRAFT_COFFEE_MACHINE("craftCoffeeMachine", -3, 3, new ItemStack(InitBlocks.blockCoffeeMachine), PICK_UP_COFFEE);
+ PICK_UP_COFFEE("pickUpCoffee", -4, 2, new ItemStack(InitItems.itemCoffeeBean), CRAFT_RECONSTRUCTOR, Type.PICK_UP),
+ CRAFT_COFFEE_MACHINE("craftCoffeeMachine", -3, 3, new ItemStack(InitBlocks.blockCoffeeMachine), PICK_UP_COFFEE),
+ OBSCURED("obscured", 5, -5, new ItemStack(Items.RECORD_11), null, Type.MISC, true),
+ CRAFT_FIREWORK_BOX("craftFireworkBox", -6, -4, new ItemStack(InitBlocks.blockFireworkBox), null, Type.CRAFTING, true);
- public final Achievement ach;
- public final InitAchievements.Type type;
+ public final Achievement chieve;
+ public final Type type;
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore){
- this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.Type.CRAFTING, false);
+ this(name, x, y, displayStack, hasToHaveBefore, Type.CRAFTING, false);
}
- TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type, boolean special){
- this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.ach);
+ TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type, boolean special){
+ this.chieve = new Achievement("achievement."+ModUtil.MOD_ID+"."+name, ModUtil.MOD_ID+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.chieve);
if(hasToHaveBefore == null){
- this.ach.initIndependentStat();
+ this.chieve.initIndependentStat();
}
if(special){
- this.ach.setSpecial();
+ this.chieve.setSpecial();
}
- this.ach.registerStat();
+ this.chieve.registerStat();
this.type = type;
}
- TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, InitAchievements.Type type){
+ TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type){
this(name, x, y, displayStack, hasToHaveBefore, type, false);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java
index e96154ccf..26b623ba7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java
@@ -1,22 +1,24 @@
/*
- * This file ("BlockAtomicReconstructor.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockAtomicReconstructor.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
+import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.util.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -24,14 +26,17 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -45,38 +50,45 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public BlockAtomicReconstructor(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(10F);
this.setResistance(80F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){
return true;
}
if(!world.isRemote){
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(pos);
if(reconstructor != null){
- ItemStack heldItem = player.getCurrentEquippedItem();
if(heldItem != null){
- if(heldItem.getItem() instanceof ILensItem && reconstructor.getStackInSlot(0) == null){
+ Item item = heldItem.getItem();
+ if(item instanceof ILensItem && reconstructor.getStackInSlot(0) == null){
ItemStack toPut = heldItem.copy();
toPut.stackSize = 1;
reconstructor.setInventorySlotContents(0, toPut);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
+ //Shush, don't tell anyone!
+ else if(item == Items.RECORD_11){
+ reconstructor.counter++;
+ reconstructor.markDirty();
+ player.addStat(TheAchievements.OBSCURED.chieve);
+ }
}
else{
- if(reconstructor.getStackInSlot(0) != null){
- player.inventory.setInventorySlotContents(player.inventory.currentItem, reconstructor.getStackInSlot(0).copy());
+ ItemStack slot = reconstructor.getStackInSlot(0);
+ if(slot != null){
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, slot.copy());
reconstructor.setInventorySlotContents(0, null);
}
}
@@ -85,6 +97,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
return true;
}
+
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityAtomicReconstructor();
@@ -98,26 +111,26 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override
@SideOnly(Side.CLIENT)
- public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityAtomicReconstructor){
ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
String strg;
if(slot == null){
- strg = StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".noLens");
+ strg = StringUtil.localize("info."+ModUtil.MOD_ID+".noLens");
}
else{
strg = slot.getItem().getItemStackDisplayName(slot);
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
}
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
}
}
@Override
- protected Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
@@ -127,8 +140,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
- int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
- PosUtil.setMetadata(pos, world, rotation, 2);
+ int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
+ world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@@ -150,6 +163,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
this.setMaxDamage(0);
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
@@ -170,7 +184,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
this.toPick2 = Util.RANDOM.nextInt(NAME_FLAVOR_AMOUNTS_2)+1;
}
- String base = "tile."+ModUtil.MOD_ID_LOWER+"."+((BlockAtomicReconstructor)this.block).getBaseName()+".info.";
+ String base = "tile."+ModUtil.MOD_ID+"."+((BlockAtomicReconstructor)this.block).getBaseName()+".info.";
list.add(StringUtil.localize(base+"1."+this.toPick1)+" "+StringUtil.localize(base+"2."+this.toPick2));
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBlackLotus.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBlackLotus.java
index da6fdd6d2..ffcab7678 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBlackLotus.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBlackLotus.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockBlackLotus.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockBlackLotus.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBookletStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBookletStand.java
new file mode 100644
index 000000000..aba005c2c
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBookletStand.java
@@ -0,0 +1,166 @@
+/*
+ * This file ("BlockBookletStand.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks;
+
+import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
+import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
+import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
+import de.ellpeck.actuallyadditions.mod.items.InitItems;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.block.SoundType;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.properties.PropertyInteger;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.profiler.Profiler;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+public class BlockBookletStand extends BlockContainerBase implements IHudDisplay{
+
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
+
+ private static final AxisAlignedBB AABB_1 = new AxisAlignedBB(0, 3*0.0625, 0, 1, 14*0.0625, 0.0625);
+ private static final AxisAlignedBB AABB_2 = new AxisAlignedBB(0, 3*0.0625, 0, 0.0625, 14*0.0625, 1);
+ private static final AxisAlignedBB AABB_3 = new AxisAlignedBB(1-0.0625, 3*0.0625, 0, 1, 14*0.0625, 1);
+ private static final AxisAlignedBB AABB_4 = new AxisAlignedBB(1, 3*0.0625, 1-0.0625, 0, 14*0.0625, 1);
+
+ public BlockBookletStand(String name){
+ super(Material.WOOD, name);
+ this.setHarvestLevel("axe", 0);
+ this.setHardness(1.0F);
+ this.setResistance(4.0F);
+ this.setSoundType(SoundType.WOOD);
+ }
+
+ @Override
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ int meta = this.getMetaFromState(state);
+ switch(meta){
+ case 0:
+ return AABB_4;
+ case 1:
+ return AABB_1;
+ case 2:
+ return AABB_3;
+ case 3:
+ return AABB_2;
+ }
+ return super.getBoundingBox(state, source, pos);
+ }
+
+ @Override
+ public boolean isFullCube(IBlockState state){
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube(IBlockState state){
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK_STAND.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ return true;
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack stack){
+ return EnumRarity.RARE;
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
+ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
+
+ if(rotation == 0){
+ world.setBlockState(pos, this.getStateFromMeta(0), 2);
+ }
+ if(rotation == 1){
+ world.setBlockState(pos, this.getStateFromMeta(3), 2);
+ }
+ if(rotation == 2){
+ world.setBlockState(pos, this.getStateFromMeta(1), 2);
+ }
+ if(rotation == 3){
+ world.setBlockState(pos, this.getStateFromMeta(2), 2);
+ }
+
+ TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(pos);
+ if(tile != null){
+ if(tile.assignedPlayer == null){
+ tile.assignedPlayer = player.getName();
+ tile.markDirty();
+ tile.sendUpdate();
+ }
+ }
+
+ super.onBlockPlacedBy(world, pos, state, player, stack);
+ }
+
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int par2){
+ return new TileEntityBookletStand();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
+ TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
+ if(tile instanceof TileEntityBookletStand){
+ EntrySet set = ((TileEntityBookletStand)tile).assignedEntry;
+
+ String strg1;
+ String strg2;
+ if(set.entry == null){
+ strg1 = "No entry saved! Save one if";
+ strg2 = "you are the player who placed it!";
+ }
+ else if(set.chapter == null){
+ strg1 = set.entry.getLocalizedName();
+ strg2 = "Page "+set.pageInIndex;
+ }
+ else{
+ strg1 = set.chapter.getLocalizedName();
+ strg2 = "Page "+set.page.getID();
+
+ AssetUtil.renderStackToGui(set.chapter.getDisplayItemStack() != null ? set.chapter.getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+10, 1F);
+ }
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg1, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+8, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg2, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+18, StringUtil.DECIMAL_COLOR_WHITE);
+ }
+ }
+
+ @Override
+ protected PropertyInteger getMetaProperty(){
+ return META;
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java
index a09f346c6..7a8ee49a3 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockBreaker.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockBreaker.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,8 +15,9 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
import net.minecraft.block.BlockPistonBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -25,31 +26,33 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockBreaker extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
- private boolean isPlacer;
+ private final boolean isPlacer;
public BlockBreaker(boolean isPlacer, String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
- return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker();
+ return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){
return true;
}
@@ -70,8 +73,8 @@ public class BlockBreaker extends BlockContainerBase{
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
- int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
- PosUtil.setMetadata(pos, world, rotation, 2);
+ int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
+ world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java
index 1487ff364..2b3634294 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockCanolaPress.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockCanolaPress.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,37 +14,42 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockCanolaPress extends BlockContainerBase{
public BlockCanolaPress(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityCanolaPress();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos);
if(press != null){
- player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ if(this.checkFailUseItemOnTank(player, stack, press.tank)){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ }
}
return true;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java
index 9bb60e771..213c79544 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockCoalGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockCoalGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,17 +16,17 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
-import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -35,17 +35,16 @@ import java.util.Random;
public class BlockCoalGenerator extends BlockContainerBase{
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
-
public BlockCoalGenerator(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityCoalGenerator();
@@ -53,18 +52,19 @@ public class BlockCoalGenerator extends BlockContainerBase{
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
- int meta = PosUtil.getMetadata(pos, world);
-
- if(meta == 1){
- for(int i = 0; i < 5; i++){
- world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
+ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityCoalGenerator){
+ if(((TileEntityCoalGenerator)tile).currentBurnTime > 0){
+ for(int i = 0; i < 5; i++){
+ world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
+ }
}
}
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(pos);
if(press != null){
@@ -80,11 +80,6 @@ public class BlockCoalGenerator extends BlockContainerBase{
return EnumRarity.RARE;
}
- @Override
- protected PropertyInteger getMetaProperty(){
- return META;
- }
-
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java
index 7c49c7e23..281e67f21 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockCoffeeMachine.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -23,48 +23,58 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.MathHelper;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCoffeeMachine extends BlockContainerBase{
+ private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625, 1-0.0625*2, 1-0.0625);
+
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
public BlockCoffeeMachine(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
-
- float f = 1/16F;
- this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f);
+ this.setSoundType(SoundType.STONE);
}
@Override
- public boolean isFullCube(){
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ return AABB;
+ }
+
+ @Override
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos);
if(machine != null){
- player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ if(this.checkFailUseItemOnTank(player, stack, machine.tank)){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ }
}
return true;
}
return true;
}
+
@Override
public TileEntity createNewTileEntity(World world, int meta){
return new TileEntityCoffeeMachine();
@@ -86,16 +96,16 @@ public class BlockCoffeeMachine extends BlockContainerBase{
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0){
- PosUtil.setMetadata(pos, world, 0, 2);
+ world.setBlockState(pos, this.getStateFromMeta(0), 2);
}
if(rotation == 1){
- PosUtil.setMetadata(pos, world, 3, 2);
+ world.setBlockState(pos, this.getStateFromMeta(3), 2);
}
if(rotation == 2){
- PosUtil.setMetadata(pos, world, 1, 2);
+ world.setBlockState(pos, this.getStateFromMeta(1), 2);
}
if(rotation == 3){
- PosUtil.setMetadata(pos, world, 2, 2);
+ world.setBlockState(pos, this.getStateFromMeta(2), 2);
}
super.onBlockPlacedBy(world, pos, state, player, stack);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java
index 743dc70d8..eb5d2ce7f 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockColoredLamp.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockColoredLamp.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -27,9 +26,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -41,12 +40,12 @@ import java.util.Random;
public class BlockColoredLamp extends BlockBase{
- public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values();
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, allLampTypes.length-1);
- public boolean isOn;
+ public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, ALL_LAMP_TYPES.length-1);
+ public final boolean isOn;
public BlockColoredLamp(boolean isOn, String name){
- super(Material.redstoneLight, name);
+ super(Material.REDSTONE_LIGHT, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(3.0F);
@@ -64,16 +63,15 @@ public class BlockColoredLamp extends BlockBase{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ){
//Turning On
if(player.isSneaking()){
if(!world.isRemote){
- PosUtil.setBlock(pos, world, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, PosUtil.getMetadata(pos, world), 2);
+ world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getStateFromMeta(this.getMetaFromState(state)), 2);
}
return true;
}
- ItemStack stack = player.getCurrentEquippedItem();
if(stack != null){
//Changing Colors
int[] oreIDs = OreDictionary.getOreIDs(stack);
@@ -82,9 +80,9 @@ public class BlockColoredLamp extends BlockBase{
String name = OreDictionary.getOreName(oreID);
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
if(color != null){
- if(PosUtil.getMetadata(pos, world) != color.ordinal()){
+ if(this.getMetaFromState(state) != color.ordinal()){
if(!world.isRemote){
- PosUtil.setMetadata(pos, world, color.ordinal(), 2);
+ world.setBlockState(pos, this.getStateFromMeta(color.ordinal()), 2);
if(!player.capabilities.isCreativeMode){
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
@@ -106,37 +104,27 @@ public class BlockColoredLamp extends BlockBase{
@Override
@SideOnly(Side.CLIENT)
- public Item getItem(World world, BlockPos pos){
- return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
- }
-
- @SuppressWarnings("all")
- @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allLampTypes.length; j++){
+ for(int j = 0; j < ALL_LAMP_TYPES.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override
- public int getLightValue(IBlockAccess world, BlockPos pos){
+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
return this.isOn ? 15 : 0;
}
@Override
- public Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length];
- for(int i = 0; i < allLampTypes.length; i++){
- String name = this.getBaseName()+allLampTypes[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ for(int i = 0; i < ALL_LAMP_TYPES.length; i++){
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), META.getName()+"="+i);
}
- ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
@@ -157,17 +145,19 @@ public class BlockColoredLamp extends BlockBase{
this.setMaxDamage(0);
}
+
@Override
public String getItemStackDisplayName(ItemStack stack){
- if(stack.getItemDamage() >= allLampTypes.length){
- return null;
+ if(stack.getItemDamage() >= ALL_LAMP_TYPES.length){
+ return StringUtil.BUGGED_ITEM_NAME;
}
- return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : "");
+ return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".onSuffix.desc")+")" : "");
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
- return InitBlocks.blockColoredLamp.getUnlocalizedName()+allLampTypes[stack.getItemDamage()].name;
+ return InitBlocks.blockColoredLamp.getUnlocalizedName()+ALL_LAMP_TYPES[stack.getItemDamage()].name;
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java
index 6023cdf34..8be3e66eb 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java
@@ -1,22 +1,21 @@
/*
- * This file ("BlockCompost.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockCompost.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
+import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
-import de.ellpeck.actuallyadditions.mod.items.ItemFertilizer;
-import de.ellpeck.actuallyadditions.mod.items.ItemMisc;
-import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -27,7 +26,13 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.*;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -36,77 +41,104 @@ import java.util.List;
public class BlockCompost extends BlockContainerBase implements IHudDisplay{
+ protected static final AxisAlignedBB AABB_LEGS = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.3125D, 1.0D);
+ protected static final AxisAlignedBB AABB_WALL_NORTH = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
+ protected static final AxisAlignedBB AABB_WALL_SOUTH = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
+ protected static final AxisAlignedBB AABB_WALL_EAST = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
+ protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
+ private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625, 11*0.0625, 1-0.0625);
+
public BlockCompost(String name){
- super(Material.wood, name);
+ super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
- this.setStepSound(soundTypeWood);
-
- this.setBlockBoundsForItemRender();
+ this.setSoundType(SoundType.WOOD);
}
@Override
- public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){
- this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
- super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
- float f = 0.125F;
- this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
- super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
- this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
- super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
- this.setBlockBounds(1.0F-f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
- this.setBlockBounds(0.0F, 0.0F, 1.0F-f, 1.0F, 1.0F, 1.0F);
- super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
- this.setBlockBoundsForItemRender();
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ return AABB;
}
@Override
- public boolean isOpaqueCube(){
+ public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn){
+ addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
+ addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
+ addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
+ addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
+ addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
+ }
+
+ @Override
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
- if(!world.isRemote){
- ItemStack stackPlayer = player.getCurrentEquippedItem();
- TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos);
- //Add items to be composted
- if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){
- if(tile.slots[0] == null){
- tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal());
- }
- else{
- tile.slots[0].stackSize++;
- }
- if(!player.capabilities.isCreativeMode){
- player.inventory.getCurrentItem().stackSize--;
- }
- tile.markDirty();
- }
-
- //Add Fertilizer to player's inventory
- else if(tile.slots[0] != null && (stackPlayer == null || (stackPlayer.getItem() instanceof ItemFertilizer && stackPlayer.stackSize <= stackPlayer.getMaxStackSize()-tile.slots[0].stackSize)) && tile.slots[0].getItem() instanceof ItemFertilizer){
- if(stackPlayer == null){
- player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
- }
- else{
- player.getCurrentEquippedItem().stackSize += tile.slots[0].stackSize;
- }
- tile.slots[0] = null;
- tile.markDirty();
- }
- }
- return true;
+ public boolean isFullCube(IBlockState state){
+ return false;
}
@Override
- public void setBlockBoundsForItemRender(){
- float f = 1.0F/16.0F;
- this.setBlockBounds(f, 0.0F, f, 1.0F-f, 1.0F, 1.0F-f);
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stackPlayer, EnumFacing f6, float f7, float f8, float f9){
+ if(!world.isRemote){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityCompost){
+ TileEntityCompost compost = (TileEntityCompost)tile;
+ ItemStack slot = compost.getStackInSlot(0);
+ CompostRecipe recipeIn = TileEntityCompost.getRecipeForInput(slot);
+ if(slot == null || recipeIn != null){
+ if(stackPlayer != null){
+ CompostRecipe recipeHand = TileEntityCompost.getRecipeForInput(stackPlayer);
+ if(recipeHand != null && (recipeIn == null || recipeIn == recipeHand)){
+ int maxAdd = Math.min(recipeHand.input.stackSize, stackPlayer.stackSize);
+
+ if(slot == null){
+ ItemStack stackToAdd = stackPlayer.copy();
+ stackToAdd.stackSize = maxAdd;
+ compost.setInventorySlotContents(0, stackToAdd);
+ player.inventory.decrStackSize(player.inventory.currentItem, maxAdd);
+ return true;
+ }
+ else{
+ ItemStack stackIn = slot.copy();
+ if(stackIn.stackSize < recipeHand.input.stackSize){
+ int sizeAdded = Math.min(maxAdd, recipeHand.input.stackSize-stackIn.stackSize);
+ stackIn.stackSize += sizeAdded;
+ compost.setInventorySlotContents(0, stackIn);
+ player.inventory.decrStackSize(player.inventory.currentItem, sizeAdded);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ else{
+ if(stackPlayer == null){
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, slot.copy());
+ compost.setInventorySlotContents(0, null);
+ return true;
+ }
+ else if(stackPlayer.isItemEqual(slot)){
+ int addedStackSize = Math.min(slot.stackSize, stackPlayer.getMaxStackSize()-stackPlayer.stackSize);
+ ItemStack stackToAdd = stackPlayer.copy();
+ stackToAdd.stackSize += addedStackSize;
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, stackToAdd);
+ compost.decrStackSize(0, addedStackSize);
+ return true;
+
+ }
+ }
+ }
+ }
+ else{
+ return true;
+ }
+ return false;
}
+
@Override
public TileEntity createNewTileEntity(World world, int meta){
return new TileEntityCompost();
@@ -125,7 +157,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
@Override
@SideOnly(Side.CLIENT)
- public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityCompost){
ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0);
@@ -138,7 +170,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
}
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java
index 99f96dc5e..f7165ced5 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockCrystal.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockCrystal.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -24,7 +23,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -32,11 +30,11 @@ import java.util.List;
public class BlockCrystal extends BlockBase{
- public static final TheCrystals[] allCrystals = TheCrystals.values();
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, allCrystals.length-1);
+ public static final TheCrystals[] ALL_CRYSTALS = TheCrystals.values();
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, ALL_CRYSTALS.length-1);
public BlockCrystal(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setHarvestLevel("pickaxe", 1);
@@ -47,33 +45,29 @@ public class BlockCrystal extends BlockBase{
return this.getMetaFromState(state);
}
- @SuppressWarnings("all")
+ @Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allCrystals.length; j++){
+ for(int j = 0; j < ALL_CRYSTALS.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override
- public Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length];
- for(int i = 0; i < allCrystals.length; i++){
- String name = this.getBaseName()+allCrystals[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ for(int i = 0; i < ALL_CRYSTALS.length; i++){
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), META.getName()+"="+i);
}
- ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= allCrystals.length ? EnumRarity.COMMON : allCrystals[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= ALL_CRYSTALS.length ? EnumRarity.COMMON : ALL_CRYSTALS[stack.getItemDamage()].rarity;
}
@Override
@@ -89,9 +83,10 @@ public class BlockCrystal extends BlockBase{
this.setMaxDamage(0);
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allCrystals[stack.getItemDamage()].name;
+ return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_CRYSTALS[stack.getItemDamage()].name;
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java
index bbc3db8cf..9f37f45b5 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockDirectionalBreaker.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockDirectionalBreaker.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,8 +15,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.BlockPistonBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -25,8 +25,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDirectionalBreaker extends BlockContainerBase{
@@ -34,20 +35,21 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public BlockDirectionalBreaker(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityDirectionalBreaker();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){
return true;
}
@@ -68,8 +70,8 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
- int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
- PosUtil.setMetadata(pos, world, rotation, 2);
+ int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
+ world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java
new file mode 100644
index 000000000..85d95d5c7
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java
@@ -0,0 +1,88 @@
+/*
+ * This file ("BlockDisplayStand.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks;
+
+import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
+import net.minecraft.block.SoundType;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+public class BlockDisplayStand extends BlockContainerBase{
+
+ public BlockDisplayStand(String name){
+ super(Material.ROCK, name);
+
+ this.setHarvestLevel("pickaxe", 0);
+ this.setHardness(1.5F);
+ this.setResistance(10.0F);
+ this.setSoundType(SoundType.STONE);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World worldIn, int meta){
+ return new TileEntityDisplayStand();
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
+ if(!world.isRemote){
+ TileEntityDisplayStand stand = (TileEntityDisplayStand)world.getTileEntity(pos);
+ if(stand != null){
+ ItemStack display = stand.getStackInSlot(0);
+ if(heldItem != null){
+ if(display == null){
+ ItemStack toPut = heldItem.copy();
+ toPut.stackSize = 1;
+ stand.setInventorySlotContents(0, toPut);
+ player.inventory.decrStackSize(player.inventory.currentItem, 1);
+ return true;
+ }
+ }
+ else{
+ if(display != null){
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, display.copy());
+ stand.setInventorySlotContents(0, null);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+
+ @Override
+ public boolean isOpaqueCube(IBlockState state){
+ return false;
+ }
+
+ @Override
+ public void breakBlock(World worldIn, BlockPos pos, IBlockState state){
+ this.dropInventory(worldIn, pos);
+ super.breakBlock(worldIn, pos, state);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack stack){
+ return EnumRarity.RARE;
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java
index 44d0e2c50..517c1134a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockDropper.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockDropper.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,8 +14,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.BlockPistonBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -24,8 +24,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDropper extends BlockContainerBase{
@@ -33,20 +34,21 @@ public class BlockDropper extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public BlockDropper(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityDropper();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){
return true;
}
@@ -67,8 +69,8 @@ public class BlockDropper extends BlockContainerBase{
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
- int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
- PosUtil.setMetadata(pos, world, rotation, 2);
+ int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
+ world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java
index f778ebd5a..8be3a2da6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockEnergizer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockEnergizer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,36 +15,39 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockEnergizer extends BlockContainerBase{
- private boolean isEnergizer;
+ private final boolean isEnergizer;
public BlockEnergizer(boolean isEnergizer, String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.isEnergizer = isEnergizer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
if(this.isEnergizer){
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(pos);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java
index a65c7b701..b1e5c1765 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockFeeder.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFeeder.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,33 +14,36 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFeeder extends BlockContainerBase{
public BlockFeeder(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(6.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFeeder();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos);
if(feeder != null){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java
index b7c5922e1..b945d1462 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockFermentingBarrel.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFermentingBarrel.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,26 +14,29 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFermentingBarrel extends BlockContainerBase{
public BlockFermentingBarrel(String name){
- super(Material.wood, name);
+ super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
- this.setStepSound(soundTypeWood);
+ this.setSoundType(SoundType.WOOD);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFermentingBarrel();
@@ -46,11 +49,13 @@ public class BlockFermentingBarrel extends BlockContainerBase{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos);
if(press != null){
- player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ if(this.checkFailUseItemOnTank(player, heldItem, press.canolaTank) && this.checkFailUseItemOnTank(player, heldItem, press.oilTank)){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ }
}
return true;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java
index 0b53d74b7..240fac039 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockFireworkBox.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFireworkBox.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -13,33 +13,36 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFireworkBox extends BlockContainerBase{
public BlockFireworkBox(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFireworkBox();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
return this.tryToggleRedstone(world, pos, player);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java
index e1edeea3b..25640345d 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java
@@ -1,46 +1,58 @@
/*
- * This file ("BlockFishingNet.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFishingNet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFishingNet extends BlockContainerBase{
+ private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
+
public BlockFishingNet(String name){
- super(Material.wood, name);
+ super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(3.0F);
- this.setStepSound(soundTypeWood);
- this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F);
+ this.setSoundType(SoundType.WOOD);
}
+ @Override
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ return AABB;
+ }
+
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFishingNet();
}
@Override
- public boolean isFullCube(){
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java
index 431e0c54d..c6152b475 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockFluidCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFluidCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,8 +15,9 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import net.minecraft.block.BlockPistonBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -25,39 +26,43 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockFluidCollector extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
- private boolean isPlacer;
+ private final boolean isPlacer;
public BlockFluidCollector(boolean isPlacer, String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
- return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector();
+ return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){
return true;
}
if(!world.isRemote){
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(pos);
if(collector != null){
- player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ if(this.checkFailUseItemOnTank(player, stack, collector.tank)){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ }
}
return true;
}
@@ -71,8 +76,8 @@ public class BlockFluidCollector extends BlockContainerBase{
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
- int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
- PosUtil.setMetadata(pos, world, rotation, 2);
+ int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
+ world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java
index 815b9fe56..f28fdb5ae 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockFurnaceDouble.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFurnaceDouble.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -24,10 +24,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
-import net.minecraft.util.MathHelper;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -40,14 +41,15 @@ public class BlockFurnaceDouble extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 7);
public BlockFurnaceDouble(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFurnaceDouble();
@@ -55,8 +57,8 @@ public class BlockFurnaceDouble extends BlockContainerBase{
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
- int meta = PosUtil.getMetadata(pos, world);
+ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
+ int meta = this.getMetaFromState(state);
if(meta > 3){
float f = (float)pos.getX()+0.5F;
@@ -89,7 +91,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(pos);
if(furnace != null){
@@ -101,8 +103,8 @@ public class BlockFurnaceDouble extends BlockContainerBase{
}
@Override
- public int getLightValue(IBlockAccess world, BlockPos pos){
- return PosUtil.getMetadata(pos, world) > 3 ? 12 : 0;
+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
+ return this.getMetaFromState(state) > 3 ? 12 : 0;
}
@Override
@@ -115,16 +117,16 @@ public class BlockFurnaceDouble extends BlockContainerBase{
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0){
- PosUtil.setMetadata(pos, world, 0, 2);
+ world.setBlockState(pos, this.getStateFromMeta(0), 2);
}
if(rotation == 1){
- PosUtil.setMetadata(pos, world, 3, 2);
+ world.setBlockState(pos, this.getStateFromMeta(3), 2);
}
if(rotation == 2){
- PosUtil.setMetadata(pos, world, 1, 2);
+ world.setBlockState(pos, this.getStateFromMeta(1), 2);
}
if(rotation == 3){
- PosUtil.setMetadata(pos, world, 2, 2);
+ world.setBlockState(pos, this.getStateFromMeta(2), 2);
}
super.onBlockPlacedBy(world, pos, state, player, stack);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java
index 391bf1903..587a52f97 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java
@@ -1,46 +1,58 @@
/*
- * This file ("BlockFurnaceSolar.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFurnaceSolar.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFurnaceSolar extends BlockContainerBase{
+ private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6*0.0625, 1);
+
public BlockFurnaceSolar(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
- this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F);
+ this.setSoundType(SoundType.STONE);
}
+ @Override
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ return AABB;
+ }
+
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFurnaceSolar();
}
@Override
- public boolean isFullCube(){
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java
index a1a584a64..43582bdd6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java
@@ -1,16 +1,17 @@
/*
- * This file ("BlockGeneric.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockGeneric.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
@@ -18,11 +19,15 @@ import net.minecraft.item.ItemStack;
public class BlockGeneric extends BlockBase{
public BlockGeneric(String name){
- super(Material.rock, name);
- this.setHarvestLevel("pickaxe", 0);
- this.setHardness(1.5F);
- this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this(name, Material.ROCK, SoundType.STONE, 1.5F, 10.0F, "pickaxe", 0);
+ }
+
+ public BlockGeneric(String name, Material material, SoundType sound, float hardness, float resistance, String harvestTool, int harvestLevel){
+ super(material, name);
+ this.setHarvestLevel(harvestTool, harvestLevel);
+ this.setHardness(hardness);
+ this.setResistance(resistance);
+ this.setSoundType(sound);
}
@Override
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java
index 0794f9d29..a2f76b152 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java
@@ -1,21 +1,26 @@
/*
- * This file ("BlockGiantChest.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockGiantChest.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
+import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@@ -25,30 +30,42 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.ArrayList;
+import java.util.List;
public class BlockGiantChest extends BlockContainerBase{
- public BlockGiantChest(String name){
- super(Material.wood, name);
+ public final int type;
+
+ public BlockGiantChest(String name, int type){
+ super(Material.WOOD, name);
+ this.type = type;
+
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(15.0F);
- this.setStepSound(soundTypeWood);
+ this.setSoundType(SoundType.WOOD);
+
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
- return new TileEntityGiantChest();
+ switch(this.type){
+ case 1: return new TileEntityGiantChestMedium();
+ case 2: return new TileEntityGiantChestLarge();
+ default: return new TileEntityGiantChest();
+ }
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos);
if(chest != null){
@@ -73,7 +90,10 @@ public class BlockGiantChest extends BlockContainerBase{
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
for(int i = 0; i < list.tagCount(); i++){
- slots[i] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
+ NBTTagCompound compound = list.getCompoundTagAt(i);
+ if(compound != null && compound.hasKey("id")){
+ slots[i] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
+ }
}
}
}
@@ -81,6 +101,7 @@ public class BlockGiantChest extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, entity, stack);
}
+
@Override
public ArrayList getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
ArrayList drops = super.getDrops(world, pos, state, fortune);
@@ -94,9 +115,11 @@ public class BlockGiantChest extends BlockContainerBase{
for(int i = 0; i < slots.length; i++){
//Destroy the keeper
if(i != place){
+ NBTTagCompound compound = new NBTTagCompound();
if(slots[i] != null){
- list.appendTag(slots[i].writeToNBT(new NBTTagCompound()));
+ slots[i].writeToNBT(compound);
}
+ list.appendTag(compound);
}
}
@@ -126,4 +149,27 @@ public class BlockGiantChest extends BlockContainerBase{
super.breakBlock(world, pos, state);
}
+
+ @Override
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
+ }
+
+ public static class TheItemBlock extends ItemBlockBase{
+
+ public TheItemBlock(Block block){
+ super(block);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced){
+ int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest)this.block).type : -1;
+ if(type == 2){
+ tooltip.add(TextFormatting.ITALIC+"Supersolid");
+ }
+ else if(type == 0){
+ tooltip.add(TextFormatting.ITALIC+"'Small'");
+ }
+ }
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java
index b23451304..4070549d4 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockGreenhouseGlass.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockGreenhouseGlass.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -13,14 +13,15 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGreenhouseGlass;
import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.EnumWorldBlockLayer;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -29,36 +30,37 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockGreenhouseGlass extends BlockContainerBase{
public BlockGreenhouseGlass(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
@Override
- public boolean isFullCube(){
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
@SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
- IBlockState state = worldIn.getBlockState(pos);
- Block block = state.getBlock();
- return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side);
+ public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side){
+ IBlockState otherState = world.getBlockState(pos.offset(side));
+ Block block = otherState.getBlock();
+
+ return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side);
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
@SideOnly(Side.CLIENT)
- public EnumWorldBlockLayer getBlockLayer(){
- return EnumWorldBlockLayer.CUTOUT;
+ public BlockRenderLayer getBlockLayer(){
+ return BlockRenderLayer.CUTOUT;
}
@Override
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java
index bf4c3571b..773b4ea58 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockGrinder.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockGrinder.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,7 +15,8 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -23,9 +24,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -39,24 +41,25 @@ public class BlockGrinder extends BlockContainerBase{
private final boolean isDouble;
public BlockGrinder(boolean isDouble, String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.isDouble = isDouble;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
- return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder();
+ return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
}
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
- int meta = PosUtil.getMetadata(pos, world);
+ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
+ int meta = this.getMetaFromState(state);
if(meta == 1){
for(int i = 0; i < 5; i++){
@@ -69,7 +72,7 @@ public class BlockGrinder extends BlockContainerBase{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(pos);
if(grinder != null){
@@ -81,8 +84,8 @@ public class BlockGrinder extends BlockContainerBase{
}
@Override
- public int getLightValue(IBlockAccess world, BlockPos pos){
- return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
+ return this.getMetaFromState(state) == 1 ? 12 : 0;
}
@Override
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java
index cc02ddf0f..348478f9e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java
@@ -1,17 +1,18 @@
/*
- * This file ("BlockHeatCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockHeatCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
@@ -21,13 +22,14 @@ import net.minecraft.world.World;
public class BlockHeatCollector extends BlockContainerBase{
public BlockHeatCollector(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityHeatCollector();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java
index e33c2a118..e5b13e238 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockInputter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockInputter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,44 +16,48 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputterAdvanced;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockInputter extends BlockContainerBase{
public static final int NAME_FLAVOR_AMOUNTS = 15;
- public boolean isAdvanced;
+ public final boolean isAdvanced;
public BlockInputter(boolean isAdvanced, String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
this.isAdvanced = isAdvanced;
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
- return this.isAdvanced ? new TileEntityInputter.TileEntityInputterAdvanced() : new TileEntityInputter();
+ return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(pos);
if(inputter != null){
@@ -77,8 +81,8 @@ public class BlockInputter extends BlockContainerBase{
}
@Override
- public Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
@@ -86,6 +90,16 @@ public class BlockInputter extends BlockContainerBase{
return EnumRarity.EPIC;
}
+ @Override
+ public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
+ if(!world.isRemote){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityInputter){
+ ((TileEntityInputter)tile).initVars();
+ }
+ }
+ }
+
public static class TheItemBlock extends ItemBlockBase{
private long lastSysTime;
@@ -97,6 +111,7 @@ public class BlockInputter extends BlockContainerBase{
this.setMaxDamage(0);
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
@@ -107,6 +122,7 @@ public class BlockInputter extends BlockContainerBase{
return damage;
}
+
@Override
public String getItemStackDisplayName(ItemStack stack){
long sysTime = System.currentTimeMillis();
@@ -116,7 +132,7 @@ public class BlockInputter extends BlockContainerBase{
this.toPick = Util.RANDOM.nextInt(NAME_FLAVOR_AMOUNTS)+1;
}
- return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID_LOWER+".blockInputter.add."+this.toPick+".name")+")";
+ return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID+".blockInputter.add."+this.toPick+".name")+")";
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java
index 18f1baee6..0aefdaf7d 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockItemRepairer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockItemRepairer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,36 +15,38 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockItemRepairer extends BlockContainerBase{
public BlockItemRepairer(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(20.0F);
this.setResistance(15.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityItemRepairer();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos);
if(repairer != null){
@@ -56,8 +58,8 @@ public class BlockItemRepairer extends BlockContainerBase{
}
@Override
- public int getLightValue(IBlockAccess world, BlockPos pos){
- return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
+ return this.getMetaFromState(state) == 1 ? 12 : 0;
}
@Override
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java
new file mode 100644
index 000000000..f6224fb32
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java
@@ -0,0 +1,55 @@
+/*
+ * This file ("BlockItemViewer.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks;
+
+import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer;
+import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+public class BlockItemViewer extends BlockContainerBase{
+
+ public BlockItemViewer(String name){
+ super(Material.ROCK, name);
+ this.setHarvestLevel("pickaxe", 0);
+ this.setHardness(1.5F);
+ this.setResistance(10.0F);
+ this.setSoundType(SoundType.STONE);
+ }
+
+
+ @Override
+ public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
+ if(!world.isRemote){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityItemViewer){
+ ((TileEntityItemViewer)tile).saveConnectedRelay();
+ }
+ }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World worldIn, int meta){
+ return new TileEntityItemViewer();
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack stack){
+ return EnumRarity.RARE;
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java
index 73b9d2f89..3f36b7f38 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java
@@ -1,28 +1,28 @@
/*
- * This file ("BlockLampPowerer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockLampPowerer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockLampPowerer extends BlockBase{
@@ -30,16 +30,16 @@ public class BlockLampPowerer extends BlockBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
public BlockLampPowerer(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
@Override
- public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
- this.updateLamp(world, pos);
+ public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn){
+ this.updateLamp(worldIn, pos);
}
@Override
@@ -49,24 +49,27 @@ public class BlockLampPowerer extends BlockBase{
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
- int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
- PosUtil.setMetadata(pos, world, rotation, 2);
+ int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
+ world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
private void updateLamp(World world, BlockPos pos){
if(!world.isRemote){
- BlockPos coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionByPistonRotation(PosUtil.getMetadata(pos, world)), pos, 0);
- if(coords != null && PosUtil.getBlock(coords, world) instanceof BlockColoredLamp){
+ IBlockState state = world.getBlockState(pos);
+ BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)));
+ IBlockState coordsState = world.getBlockState(coords);
+ if(coordsState.getBlock() instanceof BlockColoredLamp){
+ int meta = coordsState.getBlock().getMetaFromState(coordsState);
if(world.isBlockIndirectlyGettingPowered(pos) > 0){
- if(!((BlockColoredLamp)PosUtil.getBlock(coords, world)).isOn){
- PosUtil.setBlock(coords, world, InitBlocks.blockColoredLampOn, PosUtil.getMetadata(coords, world), 2);
+ if(!((BlockColoredLamp)coordsState.getBlock()).isOn){
+ world.setBlockState(coords, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 2);
}
}
else{
- if(((BlockColoredLamp)PosUtil.getBlock(coords, world)).isOn){
- PosUtil.setBlock(coords, world, InitBlocks.blockColoredLamp, PosUtil.getMetadata(coords, world), 2);
+ if(((BlockColoredLamp)coordsState.getBlock()).isOn){
+ world.setBlockState(coords, InitBlocks.blockColoredLamp.getStateFromMeta(meta), 2);
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java
index 2b02cccb3..0e654d4ef 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java
@@ -1,92 +1,97 @@
/*
- * This file ("BlockLaserRelay.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockLaserRelay.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
+import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
+import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
-import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-import java.util.List;
-
public class BlockLaserRelay extends BlockContainerBase{
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
+ //This took way too much fiddling around. I'm not good with numbers.
+ private static final float F = 1/16F;
+ private static final AxisAlignedBB AABB_UP = new AxisAlignedBB(2*F, 0, 2*F, 1-2*F, 1-F, 1-2*F);
+ private static final AxisAlignedBB AABB_DOWN = new AxisAlignedBB(2*F, F, 2*F, 1-2*F, 1, 1-2*F);
+ private static final AxisAlignedBB AABB_NORTH = new AxisAlignedBB(2*F, F, F, 1-2*F, 1-F, 1);
+ private static final AxisAlignedBB AABB_EAST = new AxisAlignedBB(0, F, 2*F, 1-F, 1-F, 1-2*F);
+ private static final AxisAlignedBB AABB_SOUTH = new AxisAlignedBB(2*F, F, 0, 1-2*F, 1-F, 1-F);
+ private static final AxisAlignedBB AABB_WEST = new AxisAlignedBB(F, F, 2*F, 1, 1-F, 1-2*F);
- public BlockLaserRelay(String name){
- super(Material.rock, name);
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
+ private final Type type;
+
+ public BlockLaserRelay(String name, Type type){
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
+
+ this.type = type;
}
@Override
- public boolean isFullCube(){
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ switch(this.getMetaFromState(state)){
+ case 1:
+ return AABB_UP;
+ case 2:
+ return AABB_NORTH;
+ case 3:
+ return AABB_SOUTH;
+ case 4:
+ return AABB_WEST;
+ case 5:
+ return AABB_EAST;
+ default:
+ return AABB_DOWN;
+ }
+ }
+
+ @Override
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
- public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
- this.setBlockBoundsBasedOnState(world, pos);
- super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
- }
-
- @Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
+
@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
return this.getStateFromMeta(side.ordinal());
}
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
- int meta = PosUtil.getMetadata(pos, world);
-
- float pixel = 1F/16F;
- if(meta == 0){
- this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F, 1F-3*pixel);
- }
- else if(meta == 1){
- this.setBlockBounds(3*pixel, 0F, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
- }
- else if(meta == 2){
- this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F);
- }
- else if(meta == 3){
- this.setBlockBounds(3*pixel, 3*pixel, 0F, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
- }
- else if(meta == 4){
- this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F, 1F-3*pixel, 1F-3*pixel);
- }
- else if(meta == 5){
- this.setBlockBounds(0F, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
- }
- }
-
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
@@ -97,8 +102,45 @@ public class BlockLaserRelay extends BlockContainerBase{
return META;
}
+ @Override
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
+ if(player.isSneaking()){
+ TileEntityLaserRelay relay = (TileEntityLaserRelay)world.getTileEntity(pos);
+ if(relay instanceof TileEntityLaserRelayItemWhitelist){
+ if(!world.isRemote){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.LASER_RELAY_ITEM_WHITELIST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
+ if(!world.isRemote){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityLaserRelay){
+ ((TileEntityLaserRelay)tile).saveAllHandlersAround();
+ }
+ }
+ }
+
@Override
public TileEntity createNewTileEntity(World world, int i){
- return new TileEntityLaserRelay();
+ switch(this.type){
+ case ITEM:
+ return new TileEntityLaserRelayItem();
+ case ITEM_WHITELIST:
+ return new TileEntityLaserRelayItemWhitelist();
+ default:
+ return new TileEntityLaserRelayEnergy();
+ }
+ }
+
+ public enum Type{
+ ENERGY,
+ ITEM,
+ ITEM_WHITELIST
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java
index 6788bc528..ac9f4bb47 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockLavaFactoryController.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockLavaFactoryController.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
@@ -22,7 +23,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -30,13 +31,14 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay{
public BlockLavaFactoryController(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(20.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityLavaFactoryController();
@@ -49,15 +51,15 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
@Override
@SideOnly(Side.CLIENT)
- public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(factory != null){
int state = factory.isMultiblock();
if(state == TileEntityLavaFactoryController.NOT_MULTI){
- StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
+ StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localize("tooltip."+ModUtil.MOD_ID+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
}
else if(state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA){
- StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
+ StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localize("tooltip."+ModUtil.MOD_ID+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java
index 66214b816..ffe2ac44d 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java
@@ -1,35 +1,37 @@
/*
- * This file ("BlockLeafGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockLeafGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockLeafGenerator extends BlockContainerBase{
public BlockLeafGenerator(String name){
- super(Material.iron, name);
+ super(Material.IRON, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(5.0F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeMetal);
+ this.setSoundType(SoundType.METAL);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityLeafGenerator();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java
index 8b66b8363..cfed5206d 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockMiner.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockMiner.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -25,9 +26,10 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -35,20 +37,20 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockMiner extends BlockContainerBase implements IHudDisplay{
public BlockMiner(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(8F);
this.setResistance(30F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityMiner){
@@ -63,6 +65,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
return EnumRarity.RARE;
}
+
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityMiner();
@@ -76,7 +79,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
@Override
@SideOnly(Side.CLIENT)
- public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityMiner){
String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+".";
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java
index a9aa228cb..b535656bb 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockMisc.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockMisc.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -24,7 +23,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -32,11 +30,11 @@ import java.util.List;
public class BlockMisc extends BlockBase{
- public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values();
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, allMiscBlocks.length-1);
+ public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, ALL_MISC_BLOCKS.length-1);
public BlockMisc(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setHarvestLevel("pickaxe", 1);
@@ -47,33 +45,29 @@ public class BlockMisc extends BlockBase{
return this.getMetaFromState(state);
}
- @SuppressWarnings("all")
+ @Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allMiscBlocks.length; j++){
+ for(int j = 0; j < ALL_MISC_BLOCKS.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override
- public Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length];
- for(int i = 0; i < allMiscBlocks.length; i++){
- String name = this.getBaseName()+allMiscBlocks[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ for(int i = 0; i < ALL_MISC_BLOCKS.length; i++){
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), META.getName()+"="+i);
}
- ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? EnumRarity.COMMON : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
}
@Override
@@ -89,9 +83,10 @@ public class BlockMisc extends BlockBase{
this.setMaxDamage(0);
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= allMiscBlocks.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allMiscBlocks[stack.getItemDamage()].name;
+ return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_MISC_BLOCKS[stack.getItemDamage()].name;
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java
index 8b72114ef..de01e8298 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockOilGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockOilGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,17 +16,17 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
-import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -35,17 +35,16 @@ import java.util.Random;
public class BlockOilGenerator extends BlockContainerBase{
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
-
public BlockOilGenerator(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityOilGenerator();
@@ -53,20 +52,25 @@ public class BlockOilGenerator extends BlockContainerBase{
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
- if(PosUtil.getMetadata(pos, world) == 1){
- for(int i = 0; i < 5; i++){
- world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
+ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityOilGenerator){
+ if(((TileEntityOilGenerator)tile).currentBurnTime > 0){
+ for(int i = 0; i < 5; i++){
+ world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
+ }
}
}
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
if(generator != null){
- player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ if(this.checkFailUseItemOnTank(player, stack, generator.tank)){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
+ }
}
return true;
}
@@ -78,11 +82,6 @@ public class BlockOilGenerator extends BlockContainerBase{
return EnumRarity.RARE;
}
- @Override
- protected PropertyInteger getMetaProperty(){
- return META;
- }
-
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state){
this.dropInventory(world, pos);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java
index d5234313e..92f036abf 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockPhantom.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockPhantom.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,8 +15,9 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -27,30 +28,55 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.*;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.math.Vec3d;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
- public Type type;
- public int range;
+ public final Type type;
public BlockPhantom(Type type, String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.type = type;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
+ }
- if(type == Type.FACE || type == Type.LIQUIFACE || type == Type.ENERGYFACE){
- this.range = TileEntityPhantomface.RANGE;
+ @Override
+ public boolean canProvidePower(IBlockState state){
+ return this.type == Type.REDSTONEFACE;
+ }
+
+ @Override
+ public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side){
+ if(this.type == Type.REDSTONEFACE){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityPhantomRedstoneface){
+ return ((TileEntityPhantomRedstoneface)tile).providesWeak[side.ordinal()];
+ }
}
- else if(type == Type.BREAKER || type == Type.PLACER){
- this.range = TileEntityPhantomPlacer.RANGE;
+ return super.getWeakPower(state, world, pos, side);
+ }
+
+ @Override
+ public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side){
+ if(this.type == Type.REDSTONEFACE){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityPhantomRedstoneface){
+ return ((TileEntityPhantomRedstoneface)tile).providesStrong[side.ordinal()];
+ }
}
+ return super.getStrongPower(state, world, pos, side);
}
@Override
@@ -61,24 +87,27 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
super.breakBlock(world, pos, state);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
switch(this.type){
case PLACER:
return new TileEntityPhantomPlacer();
case BREAKER:
- return new TileEntityPhantomPlacer.TileEntityPhantomBreaker();
+ return new TileEntityPhantomBreaker();
case LIQUIFACE:
return new TileEntityPhantomLiquiface();
case ENERGYFACE:
return new TileEntityPhantomEnergyface();
+ case REDSTONEFACE:
+ return new TileEntityPhantomRedstoneface();
default:
return new TileEntityPhantomItemface();
}
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ){
if(this.tryToggleRedstone(world, pos, player)){
return true;
}
@@ -98,27 +127,29 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
@Override
@SideOnly(Side.CLIENT)
- public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile != null){
if(tile instanceof IPhantomTile){
IPhantomTile phantom = (IPhantomTile)tile;
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
if(phantom.hasBoundPosition()){
- int distance = (int)new Vec3(posHit.getBlockPos()).distanceTo(new Vec3(phantom.getBoundPosition()));
- Item item = PosUtil.getItemBlock(phantom.getBoundPosition(), minecraft.theWorld);
- String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(PosUtil.getBlock(phantom.getBoundPosition(), minecraft.theWorld), 1, PosUtil.getMetadata(phantom.getBoundPosition(), minecraft.theWorld)));
- StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
+ int distance = (int)new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition()));
+ IBlockState state = minecraft.theWorld.getBlockState(phantom.getBoundPosition());
+ Block block = state.getBlock();
+ Item item = Item.getItemFromBlock(block);
+ String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state)));
+ StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
if(phantom.isBoundThingInRange()){
- StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
+ StringUtil.drawSplitString(minecraft.fontRendererObj, TextFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
}
else{
- StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
+ StringUtil.drawSplitString(minecraft.fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
}
}
else{
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE);
}
}
}
@@ -129,6 +160,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
PLACER,
BREAKER,
LIQUIFACE,
- ENERGYFACE
+ ENERGYFACE,
+ REDSTONEFACE
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java
index eef04cd9d..e78749fae 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java
@@ -1,43 +1,52 @@
/*
- * This file ("BlockPhantomBooster.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockPhantomBooster.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockPhantomBooster extends BlockContainerBase{
+ private static final AxisAlignedBB AABB = new AxisAlignedBB(2*0.0625, 0, 2*0.0625, 1-2*0.0625, 1, 1-2*0.0625);
+
public BlockPhantomBooster(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
-
- float f = 1F/16F;
- this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f);
+ this.setSoundType(SoundType.STONE);
}
@Override
- public boolean isFullCube(){
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ return AABB;
+ }
+
+ @Override
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@@ -46,6 +55,7 @@ public class BlockPhantomBooster extends BlockContainerBase{
return EnumRarity.EPIC;
}
+
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityPhantomBooster();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java
new file mode 100644
index 000000000..2985b692c
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java
@@ -0,0 +1,58 @@
+/*
+ * This file ("BlockPlayerInterface.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks;
+
+import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface;
+import net.minecraft.block.SoundType;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+public class BlockPlayerInterface extends BlockContainerBase{
+
+ public BlockPlayerInterface(String name){
+ super(Material.ROCK, name);
+ this.setHarvestLevel("pickaxe", 0);
+ this.setHardness(4.5F);
+ this.setResistance(10.0F);
+ this.setSoundType(SoundType.STONE);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int par2){
+ return new TileEntityPlayerInterface();
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack stack){
+ return EnumRarity.EPIC;
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile != null && tile instanceof TileEntityPlayerInterface){
+ TileEntityPlayerInterface face = (TileEntityPlayerInterface)tile;
+ if(face.connectedPlayer == null){
+ face.connectedPlayer = player.getUniqueID();
+ face.markDirty();
+ }
+ }
+
+ super.onBlockPlacedBy(world, pos, state, player, stack);
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java
index 6d608829a..f8c58bcb4 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockRangedCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockRangedCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,33 +14,36 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockRangedCollector extends BlockContainerBase{
public BlockRangedCollector(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityRangedCollector();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos);
if(breaker != null){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java
new file mode 100644
index 000000000..8b7c110f8
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java
@@ -0,0 +1,108 @@
+/*
+ * This file ("BlockShockSuppressor.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks;
+
+import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
+import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.Entity;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.ExplosionEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class BlockShockSuppressor extends BlockContainerBase{
+
+ public BlockShockSuppressor(String name){
+ super(Material.ROCK, name);
+ this.setHarvestLevel("pickaxe", 0);
+ this.setHardness(20.0F);
+ this.setResistance(2000.0F);
+ this.setSoundType(SoundType.STONE);
+
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @SubscribeEvent
+ public void onExplosion(ExplosionEvent.Detonate event){
+ World world = event.getWorld();
+ if(!world.isRemote){
+ List affectedBlocks = event.getAffectedBlocks();
+ List affectedEntities = event.getAffectedEntities();
+
+ int rangeSq = TileEntityShockSuppressor.RANGE*TileEntityShockSuppressor.RANGE;
+ int use = TileEntityShockSuppressor.USE_PER;
+
+ for(TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS){
+ if(!suppressor.isRedstonePowered){
+ BlockPos supPos = suppressor.getPos();
+
+ List entitiesToRemove = new ArrayList();
+ List posesToRemove = new ArrayList();
+
+ for(BlockPos pos : affectedBlocks){
+ if(pos.distanceSq(supPos) <= rangeSq){
+ posesToRemove.add(pos);
+ }
+ }
+ for(Entity entity : affectedEntities){
+ if(entity.getPositionVector().squareDistanceTo(supPos.getX(), supPos.getY(), supPos.getZ()) <= rangeSq){
+ entitiesToRemove.add(entity);
+ }
+ }
+
+ Collections.shuffle(entitiesToRemove);
+ Collections.shuffle(posesToRemove);
+
+ for(BlockPos pos : posesToRemove){
+ if(suppressor.storage.getEnergyStored() >= use){
+ suppressor.storage.extractEnergy(use, false);
+ affectedBlocks.remove(pos);
+ }
+ else{
+ break;
+ }
+ }
+ for(Entity entity : entitiesToRemove){
+ if(suppressor.storage.getEnergyStored() >= use){
+ suppressor.storage.extractEnergy(use, false);
+ affectedEntities.remove(entity);
+ }
+ else{
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack stack){
+ return EnumRarity.RARE;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World worldIn, int meta){
+ return new TileEntityShockSuppressor();
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java
index 4bc6355c8..95d1ae4a1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java
@@ -1,74 +1,63 @@
/*
- * This file ("BlockSlabs.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockSlabs.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
-import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.SoundCategory;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-
-import java.util.List;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockSlabs extends BlockBase{
+ private static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
+ private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
+
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
- private Block fullBlock;
- private int meta;
+ private final Block fullBlock;
+ private final int meta;
public BlockSlabs(String name, Block fullBlock){
this(name, fullBlock, 0);
}
public BlockSlabs(String name, Block fullBlock, int meta){
- super(fullBlock.getMaterial(), name);
+ super(fullBlock.getMaterial(fullBlock.getDefaultState()), name);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.fullBlock = fullBlock;
this.meta = meta;
}
- @Override
+ /*@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
- @Override
- public boolean isOpaqueCube(){
- return false;
- }
-
- @Override
- public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
- if(facing.ordinal() == 1){
- return this.getStateFromMeta(meta);
- }
- if(facing.ordinal() == 0 || hitY >= 0.5F){
- return this.getStateFromMeta(meta+1);
- }
- return this.getStateFromMeta(meta);
- }
-
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world);
@@ -80,11 +69,33 @@ public class BlockSlabs extends BlockBase{
@Override
public void setBlockBoundsForItemRender(){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
+ }*/
+
+ @Override
+ public boolean isOpaqueCube(IBlockState state){
+ return false;
+ }
+
+
+ @Override
+ public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
+ if(facing.ordinal() == 1){
+ return this.getStateFromMeta(meta);
+ }
+ if(facing.ordinal() == 0 || hitY >= 0.5F){
+ return this.getStateFromMeta(meta+1);
+ }
+ return this.getStateFromMeta(meta);
}
@Override
- public Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ return state.getValue(META) == 1 ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
+ }
+
+ @Override
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
@@ -106,17 +117,68 @@ public class BlockSlabs extends BlockBase{
}
@Override
- public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
- if(PosUtil.getBlock(pos, world) == this.block && ((side.ordinal() == 1 && PosUtil.getMetadata(pos, world) == 0) || (side.ordinal() == 0 && PosUtil.getMetadata(pos, world) == 1))){
- if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){
- world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F);
- stack.stackSize--;
+ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
+ if(stack.stackSize != 0 && playerIn.canPlayerEdit(pos.offset(facing), facing, stack)){
+ IBlockState state = worldIn.getBlockState(pos);
+
+ if(state.getBlock() == this.block){
+ BlockSlabs theBlock = (BlockSlabs)this.block;
+ if((facing == EnumFacing.UP && state.getValue(META) == 0 || facing == EnumFacing.DOWN && state.getValue(META) == 1)){
+ IBlockState newState = theBlock.fullBlock.getStateFromMeta(theBlock.meta);
+ AxisAlignedBB bound = newState.getCollisionBoundingBox(worldIn, pos);
+
+ if(bound != Block.NULL_AABB && worldIn.checkNoEntityCollision(bound.offset(pos)) && worldIn.setBlockState(pos, newState, 11)){
+ SoundType soundtype = theBlock.fullBlock.getSoundType();
+ worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume()+1.0F)/2.0F, soundtype.getPitch()*0.8F);
+ --stack.stackSize;
+ }
+
+ return EnumActionResult.SUCCESS;
+ }
+ }
+
+ return this.tryPlace(playerIn, stack, worldIn, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
+ }
+ else{
+ return EnumActionResult.FAIL;
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack){
+ IBlockState state = worldIn.getBlockState(pos);
+
+ if(state.getBlock() == this.block){
+ if((side == EnumFacing.UP && state.getValue(META) == 0 || side == EnumFacing.DOWN && state.getValue(META) == 1)){
return true;
}
}
- return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
+
+ return worldIn.getBlockState(pos.offset(side)).getBlock() == this.block || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
}
+ private boolean tryPlace(EntityPlayer player, ItemStack stack, World worldIn, BlockPos pos){
+ IBlockState iblockstate = worldIn.getBlockState(pos);
+
+ if(iblockstate.getBlock() == this.block){
+ BlockSlabs theBlock = (BlockSlabs)this.block;
+ IBlockState newState = theBlock.fullBlock.getStateFromMeta(theBlock.meta);
+ AxisAlignedBB bound = newState.getCollisionBoundingBox(worldIn, pos);
+
+ if(bound != Block.NULL_AABB && worldIn.checkNoEntityCollision(bound.offset(pos)) && worldIn.setBlockState(pos, newState, 11)){
+ SoundType soundtype = theBlock.fullBlock.getSoundType();
+ worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume()+1.0F)/2.0F, soundtype.getPitch()*0.8F);
+ --stack.stackSize;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java
index dadc6f880..1c8745557 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockSmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,57 +16,52 @@ import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
-import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.*;
-import net.minecraft.world.IBlockAccess;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-import java.util.List;
import java.util.Random;
public class BlockSmileyCloud extends BlockContainerBase{
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 7);
public BlockSmileyCloud(String name){
- super(Material.cloth, name);
+ super(Material.CLOTH, name);
this.setHardness(0.5F);
this.setResistance(5.0F);
- this.setStepSound(soundTypeCloth);
+ this.setSoundType(SoundType.CLOTH);
this.setTickRandomly(true);
}
@Override
- public boolean isFullCube(){
+ public boolean isFullCube(IBlockState state){
return false;
}
@Override
- public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
- this.setBlockBoundsBasedOnState(world, pos);
- super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
- }
-
- @Override
- public boolean isOpaqueCube(){
+ public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
+ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
if(Util.RANDOM.nextInt(30) == 0){
for(int i = 0; i < 2; i++){
double d = Util.RANDOM.nextGaussian()*0.02D;
@@ -78,36 +73,18 @@ public class BlockSmileyCloud extends BlockContainerBase{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntitySmileyCloud){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
- player.triggerAchievement(TheAchievements.NAME_SMILEY_CLOUD.ach);
+ player.addStat(TheAchievements.NAME_SMILEY_CLOUD.chieve);
}
}
return true;
}
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
- int meta = PosUtil.getMetadata(pos, world);
- float f = 0.0625F;
-
- if(meta == 1){
- this.setBlockBounds(0F, 0F, 0F, 1F, 1F-f*3F, 1F-f*2F);
- }
- if(meta == 3){
- this.setBlockBounds(0F, 0F, 0F, 1F-f*2F, 1F-f*3F, 1F);
- }
- if(meta == 0){
- this.setBlockBounds(0F, 0F, f*2F, 1F, 1F-f*3F, 1F);
- }
- if(meta == 2){
- this.setBlockBounds(f*2F, 0F, 0F, 1F, 1F-f*3F, 1F);
- }
- }
@Override
public TileEntity createNewTileEntity(World world, int meta){
@@ -130,16 +107,16 @@ public class BlockSmileyCloud extends BlockContainerBase{
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0){
- PosUtil.setMetadata(pos, world, 0, 2);
+ world.setBlockState(pos, this.getStateFromMeta(0), 2);
}
if(rotation == 1){
- PosUtil.setMetadata(pos, world, 3, 2);
+ world.setBlockState(pos, this.getStateFromMeta(3), 2);
}
if(rotation == 2){
- PosUtil.setMetadata(pos, world, 1, 2);
+ world.setBlockState(pos, this.getStateFromMeta(1), 2);
}
if(rotation == 3){
- PosUtil.setMetadata(pos, world, 2, 2);
+ world.setBlockState(pos, this.getStateFromMeta(2), 2);
}
super.onBlockPlacedBy(world, pos, state, player, stack);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java
index 18e4745fc..0d806d30a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockTreasureChest.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockTreasureChest.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -14,19 +14,21 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -38,17 +40,17 @@ public class BlockTreasureChest extends BlockBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
public BlockTreasureChest(String name){
- super(Material.wood, name);
+ super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(300.0F);
this.setResistance(50.0F);
- this.setStepSound(soundTypeWood);
+ this.setSoundType(SoundType.WOOD);
this.setTickRandomly(true);
}
@Override
@SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
+ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
for(int i = 0; i < 2; i++){
for(float f = 0; f <= 3; f += 0.5){
float particleX = rand.nextFloat();
@@ -64,13 +66,13 @@ public class BlockTreasureChest extends BlockBase{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
- world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
+ world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
this.dropItems(world, pos);
world.setBlockToAir(pos);
- player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach);
+ player.addStat(TheAchievements.OPEN_TREASURE_CHEST.chieve);
}
return true;
}
@@ -80,16 +82,16 @@ public class BlockTreasureChest extends BlockBase{
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0){
- PosUtil.setMetadata(pos, world, 0, 2);
+ world.setBlockState(pos, this.getStateFromMeta(0), 2);
}
if(rotation == 1){
- PosUtil.setMetadata(pos, world, 3, 2);
+ world.setBlockState(pos, this.getStateFromMeta(3), 2);
}
if(rotation == 2){
- PosUtil.setMetadata(pos, world, 1, 2);
+ world.setBlockState(pos, this.getStateFromMeta(1), 2);
}
if(rotation == 3){
- PosUtil.setMetadata(pos, world, 2, 2);
+ world.setBlockState(pos, this.getStateFromMeta(2), 2);
}
}
@@ -100,7 +102,7 @@ public class BlockTreasureChest extends BlockBase{
private void dropItems(World world, BlockPos pos){
for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
- TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot);
+ TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.TREASURE_CHEST_LOOT);
ItemStack itemStack = theReturn.returnItem.copy();
itemStack.stackSize = MathHelper.getRandomIntegerInRange(Util.RANDOM, theReturn.minAmount, theReturn.maxAmount);
@@ -108,9 +110,6 @@ public class BlockTreasureChest extends BlockBase{
float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, itemStack.copy());
- if(itemStack.hasTagCompound()){
- entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
- }
float factor = 0.05F;
entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java
new file mode 100644
index 000000000..699261da3
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java
@@ -0,0 +1,155 @@
+/*
+ * This file ("BlockWallAA.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks;
+
+import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFenceGate;
+import net.minecraft.block.BlockWall;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.BlockStateContainer;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+import java.util.List;
+
+public class BlockWallAA extends BlockBase{
+
+ protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[]{new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
+ protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[]{AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)};
+
+ private final int meta;
+
+ public BlockWallAA(String name, Block base){
+ this(name, base, 0);
+ }
+
+
+ public BlockWallAA(String name, Block base, int meta){
+ super(base.getMaterial(base.getDefaultState()), name);
+ this.meta = meta;
+
+ this.setHardness(1.5F);
+ this.setResistance(10F);
+ this.setSoundType(base.getSoundType());
+
+ this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
+ }
+
+ private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(IBlockState state){
+ int i = 0;
+
+ if(state.getValue(BlockWall.NORTH)){
+ i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
+ }
+
+ if(state.getValue(BlockWall.EAST)){
+ i |= 1 << EnumFacing.EAST.getHorizontalIndex();
+ }
+
+ if(state.getValue(BlockWall.SOUTH)){
+ i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
+ }
+
+ if(state.getValue(BlockWall.WEST)){
+ i |= 1 << EnumFacing.WEST.getHorizontalIndex();
+ }
+
+ return i;
+ }
+
+ @Override
+ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
+ boolean flag = this.canConnectTo(worldIn, pos.north());
+ boolean flag1 = this.canConnectTo(worldIn, pos.east());
+ boolean flag2 = this.canConnectTo(worldIn, pos.south());
+ boolean flag3 = this.canConnectTo(worldIn, pos.west());
+ boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
+ return state.withProperty(BlockWall.UP, !flag4 || !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, flag).withProperty(BlockWall.EAST, flag1).withProperty(BlockWall.SOUTH, flag2).withProperty(BlockWall.WEST, flag3);
+ }
+
+ @Override
+ public boolean isFullCube(IBlockState state){
+ return false;
+ }
+
+ @Override
+ public boolean isPassable(IBlockAccess worldIn, BlockPos pos){
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
+ return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
+ }
+
+ @Override
+ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
+ state = this.getActualState(state, source, pos);
+ return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
+ }
+
+ @Override
+ public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos){
+ blockState = this.getActualState(blockState, worldIn, pos);
+ return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
+ }
+
+ @Override
+ public boolean isOpaqueCube(IBlockState state){
+ return false;
+ }
+
+ @Override
+ public int damageDropped(IBlockState state){
+ return this.meta;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List list){
+ list.add(new ItemStack(item, 1, 0));
+ }
+
+ public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
+ IBlockState state = worldIn.getBlockState(pos);
+ Block block = state.getBlock();
+ return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.GOURD));
+ }
+
+
+ @Override
+ public IBlockState getStateFromMeta(int meta){
+ return this.getDefaultState();
+ }
+
+ @Override
+ public int getMetaFromState(IBlockState state){
+ return 0;
+ }
+
+
+ @Override
+ protected BlockStateContainer createBlockState(){
+ return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java
index 92dad16a1..502a0cd2e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockWildPlant.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockWildPlant.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,10 +16,9 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -28,9 +27,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -40,39 +39,42 @@ import java.util.List;
public class BlockWildPlant extends BlockBushBase{
- public static final TheWildPlants[] allWildPlants = TheWildPlants.values();
- private static final PropertyInteger META = PropertyInteger.create("meta", 0, allWildPlants.length-1);
+ public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
+ private static final PropertyInteger META = PropertyInteger.create("meta", 0, ALL_WILD_PLANTS.length-1);
public BlockWildPlant(String name){
super(name);
- this.setStepSound(soundTypeGrass);
+ this.setSoundType(SoundType.PLANT);
}
@Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
- BlockPos offset = PosUtil.offset(pos, 0, -1, 0);
- return PosUtil.getMetadata(pos, world) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this);
+ BlockPos offset = pos.down();
+ IBlockState offsetState = world.getBlockState(offset);
+ Block offsetBlock = offsetState.getBlock();
+ return offsetBlock.getMetaFromState(offsetState) == TheWildPlants.RICE.ordinal() ? offsetBlock.getMaterial(offsetState) == Material.WATER : offsetBlock.canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this);
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
+ int metadata = this.getMetaFromState(state);
+ return metadata >= ALL_WILD_PLANTS.length ? null : new ItemStack(((BlockPlant)ALL_WILD_PLANTS[metadata].wildVersionOf).seedItem);
}
@Override
@SideOnly(Side.CLIENT)
- public Item getItem(World world, BlockPos pos){
- int metadata = PosUtil.getMetadata(pos, world);
- return metadata >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem;
- }
-
- @SuppressWarnings("all")
- @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allWildPlants.length; j++){
+ for(int j = 0; j < ALL_WILD_PLANTS.length; j++){
list.add(new ItemStack(item, 1, j));
}
}
@Override
public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
- int metadata = state.getBlock().getMetaFromState(state);
- return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
+ int metadata = this.getMetaFromState(state);
+ return metadata >= ALL_WILD_PLANTS.length ? null : ALL_WILD_PLANTS[metadata].wildVersionOf.getDrops(world, pos, ALL_WILD_PLANTS[metadata].wildVersionOf.getStateFromMeta(7), fortune);
}
@Override
@@ -81,8 +83,8 @@ public class BlockWildPlant extends BlockBushBase{
}
@Override
- public Class extends ItemBlockBase> getItemBlock(){
- return TheItemBlock.class;
+ protected ItemBlockBase getItemBlock(){
+ return new TheItemBlock(this);
}
@Override
@@ -92,18 +94,14 @@ public class BlockWildPlant extends BlockBushBase{
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length];
- for(int i = 0; i < allWildPlants.length; i++){
- String name = this.getBaseName()+allWildPlants[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ for(int i = 0; i < ALL_WILD_PLANTS.length; i++){
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), META.getName()+"="+i);
}
- ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].rarity;
}
@Override
@@ -119,9 +117,10 @@ public class BlockWildPlant extends BlockBushBase{
this.setMaxDamage(0);
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= allWildPlants.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allWildPlants[stack.getItemDamage()].name;
+ return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_WILD_PLANTS[stack.getItemDamage()].name;
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java
index ab5dc92d0..e79c719a7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockXPSolidifier.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockXPSolidifier.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -16,8 +16,8 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -27,9 +27,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.MathHelper;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class BlockXPSolidifier extends BlockContainerBase{
@@ -37,20 +38,21 @@ public class BlockXPSolidifier extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
public BlockXPSolidifier(String name){
- super(Material.rock, name);
+ super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F);
this.setResistance(10.0F);
- this.setStepSound(soundTypeStone);
+ this.setSoundType(SoundType.STONE);
}
+
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityXPSolidifier();
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos);
if(solidifier != null){
@@ -71,16 +73,16 @@ public class BlockXPSolidifier extends BlockContainerBase{
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0){
- PosUtil.setMetadata(pos, world, 0, 2);
+ world.setBlockState(pos, this.getStateFromMeta(0), 2);
}
if(rotation == 1){
- PosUtil.setMetadata(pos, world, 3, 2);
+ world.setBlockState(pos, this.getStateFromMeta(3), 2);
}
if(rotation == 2){
- PosUtil.setMetadata(pos, world, 1, 2);
+ world.setBlockState(pos, this.getStateFromMeta(1), 2);
}
if(rotation == 3){
- PosUtil.setMetadata(pos, world, 2, 2);
+ world.setBlockState(pos, this.getStateFromMeta(2), 2);
}
super.onBlockPlacedBy(world, pos, state, player, stack);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java
index 1cce30d2f..8475604f9 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java
@@ -1,11 +1,11 @@
/*
- * This file ("IHudDisplay.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IHudDisplay.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
@@ -15,13 +15,13 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
-import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IHudDisplay{
@SideOnly(Side.CLIENT)
- void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution);
+ void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java
index 4b4d7e727..f8661ff8a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java
@@ -1,30 +1,31 @@
/*
- * This file ("InitBlocks.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitBlocks.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
-import de.ellpeck.actuallyadditions.mod.blocks.base.BlockWallAA;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
-import de.ellpeck.actuallyadditions.mod.util.CompatUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.block.Block;
-public class InitBlocks{
+public final class InitBlocks{
public static Block blockCompost;
public static Block blockMisc;
public static Block blockWildPlant;
public static Block blockFeeder;
public static Block blockGiantChest;
+ public static Block blockGiantChestMedium;
+ public static Block blockGiantChestLarge;
public static Block blockGrinder;
public static Block blockGrinderDouble;
@@ -57,6 +58,8 @@ public class InitBlocks{
public static Block blockPhantomBreaker;
public static Block blockPhantomLiquiface;
public static Block blockPhantomEnergyface;
+ public static Block blockPhantomRedstoneface;
+ public static Block blockPlayerInterface;
public static Block blockFluidPlacer;
public static Block blockFluidCollector;
@@ -92,6 +95,9 @@ public class InitBlocks{
public static Block blockRangedCollector;
public static Block blockLaserRelay;
+ public static Block blockLaserRelayItem;
+ public static Block blockLaserRelayItemWhitelist;
+ public static Block blockItemViewer;
public static Block blockBlackLotus;
public static Block blockCrystal;
@@ -111,15 +117,26 @@ public class InitBlocks{
public static Block blockPillarQuartzStair;
public static Block blockPillarQuartzSlab;
+ public static Block blockBookletStand;
+ public static Block blockDisplayStand;
+ public static Block blockShockSuppressor;
+
public static void init(){
ModUtil.LOGGER.info("Initializing Blocks...");
+ blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor");
+ blockDisplayStand = new BlockDisplayStand("blockDisplayStand");
+ blockPlayerInterface = new BlockPlayerInterface("blockPlayerInterface");
+ blockBookletStand = new BlockBookletStand("blockBookletStand");
+ blockItemViewer = new BlockItemViewer("blockItemViewer");
blockFireworkBox = new BlockFireworkBox("blockFireworkBox");
blockMiner = new BlockMiner("blockMiner");
blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor");
blockCrystal = new BlockCrystal("blockCrystal");
blockBlackLotus = new BlockBlackLotus("blockBlackLotus");
- blockLaserRelay = new BlockLaserRelay("blockLaserRelay");
+ blockLaserRelay = new BlockLaserRelay("blockLaserRelay", BlockLaserRelay.Type.ENERGY);
+ blockLaserRelayItem = new BlockLaserRelay("blockLaserRelayItem", BlockLaserRelay.Type.ITEM);
+ blockLaserRelayItemWhitelist = new BlockLaserRelay("blockLaserRelayItemWhitelist", BlockLaserRelay.Type.ITEM_WHITELIST);
blockRangedCollector = new BlockRangedCollector("blockRangedCollector");
blockDirectionalBreaker = new BlockDirectionalBreaker("blockDirectionalBreaker");
blockLeafGenerator = new BlockLeafGenerator("blockLeafGenerator");
@@ -145,6 +162,7 @@ public class InitBlocks{
blockPhantomPlacer = new BlockPhantom(BlockPhantom.Type.PLACER, "blockPhantomPlacer");
blockPhantomLiquiface = new BlockPhantom(BlockPhantom.Type.LIQUIFACE, "blockPhantomLiquiface");
blockPhantomEnergyface = new BlockPhantom(BlockPhantom.Type.ENERGYFACE, "blockPhantomEnergyface");
+ blockPhantomRedstoneface = new BlockPhantom(BlockPhantom.Type.REDSTONEFACE, "blockPhantomRedstoneface");
blockPhantomBreaker = new BlockPhantom(BlockPhantom.Type.BREAKER, "blockPhantomBreaker");
blockCoalGenerator = new BlockCoalGenerator("blockCoalGenerator");
blockOilGenerator = new BlockOilGenerator("blockOilGenerator");
@@ -160,7 +178,9 @@ public class InitBlocks{
blockCompost = new BlockCompost("blockCompost");
blockMisc = new BlockMisc("blockMisc");
blockFeeder = new BlockFeeder("blockFeeder");
- blockGiantChest = new BlockGiantChest("blockGiantChest");
+ blockGiantChest = new BlockGiantChest("blockGiantChest", 0);
+ blockGiantChestMedium = new BlockGiantChest("blockGiantChestMedium", 1);
+ blockGiantChestLarge = new BlockGiantChest("blockGiantChestLarge", 2);
blockGrinder = new BlockGrinder(false, "blockGrinder");
blockGrinderDouble = new BlockGrinder(true, "blockGrinderDouble");
blockFurnaceDouble = new BlockFurnaceDouble("blockFurnaceDouble");
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java
index 9cefdf4b2..36a4dbf66 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java
@@ -1,31 +1,28 @@
/*
- * This file ("BlockBase.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockBase.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
-import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
-import net.minecraft.block.state.BlockState;
+import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.fml.common.registry.GameRegistry;
-public class BlockBase extends Block{
+public class BlockBase extends Block implements ItemBlockBase.ICustomRarity{
- private String name;
+ private final String name;
public BlockBase(Material material, String name){
super(material);
@@ -35,14 +32,7 @@ public class BlockBase extends Block{
}
private void register(){
- this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
- GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
- if(this.shouldAddCreative()){
- this.setCreativeTab(CreativeTab.instance);
- }
- else{
- this.setCreativeTab(null);
- }
+ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
this.registerRendering();
}
@@ -51,8 +41,8 @@ public class BlockBase extends Block{
return this.name;
}
- protected Class extends ItemBlockBase> getItemBlock(){
- return ItemBlockBase.class;
+ protected ItemBlockBase getItemBlock(){
+ return new ItemBlockBase(this);
}
public boolean shouldAddCreative(){
@@ -60,9 +50,10 @@ public class BlockBase extends Block{
}
protected void registerRendering(){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
}
+ @Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
@@ -77,9 +68,10 @@ public class BlockBase extends Block{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
+
@Override
- protected BlockState createBlockState(){
- return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
+ protected BlockStateContainer createBlockState(){
+ return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java
index e06ec6201..5cbbb7cac 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java
@@ -1,47 +1,38 @@
/*
- * This file ("BlockBushBase.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockBushBase.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
-import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.BlockBush;
+import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyInteger;
-import net.minecraft.block.state.BlockState;
+import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.fml.common.registry.GameRegistry;
-public class BlockBushBase extends BlockBush{
+public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity{
- private String name;
+ private final String name;
public BlockBushBase(String name){
this.name = name;
- this.setStepSound(soundTypeGrass);
+ this.setSoundType(SoundType.PLANT);
this.register();
}
private void register(){
- this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
- GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
- if(this.shouldAddCreative()){
- this.setCreativeTab(CreativeTab.instance);
- }
- else{
- this.setCreativeTab(null);
- }
+ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
this.registerRendering();
}
@@ -50,8 +41,8 @@ public class BlockBushBase extends BlockBush{
return this.name;
}
- protected Class extends ItemBlockBase> getItemBlock(){
- return ItemBlockBase.class;
+ protected ItemBlockBase getItemBlock(){
+ return new ItemBlockBase(this);
}
public boolean shouldAddCreative(){
@@ -59,9 +50,10 @@ public class BlockBushBase extends BlockBush{
}
protected void registerRendering(){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
}
+ @Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
@@ -76,9 +68,10 @@ public class BlockBushBase extends BlockBush{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
}
+
@Override
- protected BlockState createBlockState(){
- return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
+ protected BlockStateContainer createBlockState(){
+ return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
}
protected PropertyInteger getMetaProperty(){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java
index abc4adbdf..8c65b55a5 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java
@@ -1,26 +1,26 @@
/*
- * This file ("BlockContainerBase.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockContainerBase.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
-import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.tile.*;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockRedstoneTorch;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
-import net.minecraft.block.state.BlockState;
+import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
@@ -29,21 +29,24 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagInt;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.EnumBlockRenderType;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fml.common.registry.GameRegistry;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.FluidUtil;
import java.util.ArrayList;
+import java.util.List;
import java.util.Random;
-public abstract class BlockContainerBase extends BlockContainer{
+public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity{
- private String name;
+ private final String name;
public BlockContainerBase(Material material, String name){
super(material);
@@ -53,14 +56,7 @@ public abstract class BlockContainerBase extends BlockContainer{
}
private void register(){
- this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
- GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
- if(this.shouldAddCreative()){
- this.setCreativeTab(CreativeTab.instance);
- }
- else{
- this.setCreativeTab(null);
- }
+ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
this.registerRendering();
}
@@ -69,8 +65,8 @@ public abstract class BlockContainerBase extends BlockContainer{
return this.name;
}
- protected Class extends ItemBlockBase> getItemBlock(){
- return ItemBlockBase.class;
+ protected ItemBlockBase getItemBlock(){
+ return new ItemBlockBase(this);
}
public boolean shouldAddCreative(){
@@ -78,9 +74,10 @@ public abstract class BlockContainerBase extends BlockContainer{
}
protected void registerRendering(){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
}
+ @Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
@@ -106,9 +103,6 @@ public abstract class BlockContainerBase extends BlockContainer{
float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, stack.copy());
- if(stack.hasTagCompound()){
- entityItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- }
float factor = 0.05F;
entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;
@@ -118,12 +112,13 @@ public abstract class BlockContainerBase extends BlockContainer{
}
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
- ItemStack stack = player.getCurrentEquippedItem();
+ ItemStack stack = player.getHeldItemMainhand();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos);
- if(tile instanceof IRedstoneToggle){
- if(!world.isRemote){
- ((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
+ if(tile instanceof TileEntityBase){
+ TileEntityBase base = (TileEntityBase)tile;
+ if(!world.isRemote && base.isRedstoneToggle()){
+ base.isPulseMode = !base.isPulseMode;
tile.markDirty();
if(tile instanceof TileEntityBase){
@@ -150,36 +145,44 @@ public abstract class BlockContainerBase extends BlockContainer{
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
- if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
- ((IRedstoneToggle)tile).activateOnPulse();
+ if(tile instanceof TileEntityBase){
+ TileEntityBase base = (TileEntityBase)tile;
+ if(base.isRedstoneToggle() && base.isPulseMode){
+ base.activateOnPulse();
+ }
}
}
}
@Override
- public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
- this.updateRedstoneState(world, pos);
+ public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn){
+ this.updateRedstoneState(worldIn, pos);
}
public void updateRedstoneState(World world, BlockPos pos){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityBase){
+ TileEntityBase base = (TileEntityBase)tile;
boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0;
- boolean wasPowered = ((TileEntityBase)tile).isRedstonePowered;
+ boolean wasPowered = base.isRedstonePowered;
if(powered && !wasPowered){
- if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
+ if(base.isRedstoneToggle() && base.isPulseMode){
world.scheduleUpdate(pos, this, this.tickRate(world));
}
- ((TileEntityBase)tile).setRedstonePowered(true);
+ base.setRedstonePowered(true);
}
else if(!powered && wasPowered){
- ((TileEntityBase)tile).setRedstonePowered(false);
+ base.setRedstonePowered(false);
}
}
}
}
+ protected boolean checkFailUseItemOnTank(EntityPlayer player, ItemStack heldItem, FluidTank tank){
+ return heldItem == null || !FluidUtil.interactWithFluidHandler(heldItem, tank, player);
+ }
+
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
this.updateRedstoneState(world, pos);
@@ -187,31 +190,12 @@ public abstract class BlockContainerBase extends BlockContainer{
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
- if(stack.getTagCompound() != null){
+ if(stack.hasTagCompound()){
TileEntity tile = world.getTileEntity(pos);
-
- if(tile instanceof IEnergySaver){
- ((IEnergySaver)tile).setEnergy(stack.getTagCompound().getInteger("Energy"));
- stack.getTagCompound().removeTag("Energy");
- }
-
- if(tile instanceof IFluidSaver){
- int amount = stack.getTagCompound().getInteger("FluidAmount");
- stack.getTagCompound().removeTag("FluidAmount");
-
- if(amount > 0){
- FluidStack[] fluids = new FluidStack[amount];
-
- for(int i = 0; i < amount; i++){
- NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i);
- stack.getTagCompound().removeTag("Fluid"+i);
- if(compound != null){
- fluids[i] = FluidStack.loadFluidStackFromNBT(compound);
- }
- }
-
- ((IFluidSaver)tile).setFluids(fluids);
- }
+ if(tile instanceof TileEntityBase){
+ TileEntityBase base = (TileEntityBase)tile;
+ NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
+ base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
}
}
}
@@ -220,16 +204,18 @@ public abstract class BlockContainerBase extends BlockContainer{
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player){
if(!player.capabilities.isCreativeMode){
this.dropBlockAsItem(world, pos, state, 0);
+ //dirty workaround because of Forge calling Item.onBlockStartBreak() twice
+ world.setBlockToAir(pos);
}
}
@Override
- public boolean hasComparatorInputOverride(){
+ public boolean hasComparatorInputOverride(IBlockState state){
return true;
}
@Override
- public int getComparatorInputOverride(World world, BlockPos pos){
+ public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IInventory){
return Container.calcRedstoneFromInventory((IInventory)tile);
@@ -237,46 +223,43 @@ public abstract class BlockContainerBase extends BlockContainer{
return 0;
}
+
@Override
- protected BlockState createBlockState(){
- return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty());
+ protected BlockStateContainer createBlockState(){
+ return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
}
+
@Override
public ArrayList getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
ArrayList drops = new ArrayList();
TileEntity tile = world.getTileEntity(pos);
- if(tile != null){
- ItemStack stack = new ItemStack(this.getItemDropped(state, Util.RANDOM, fortune), 1, this.damageDropped(state));
+ if(tile instanceof TileEntityBase){
+ TileEntityBase base = (TileEntityBase)tile;
+ NBTTagCompound data = new NBTTagCompound();
+ base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
- if(tile instanceof IEnergySaver){
- int energy = ((IEnergySaver)tile).getEnergy();
- if(energy > 0){
- if(stack.getTagCompound() == null){
- stack.setTagCompound(new NBTTagCompound());
+ //Remove unnecessarily saved default values to avoid unstackability
+ List keysToRemove = new ArrayList();
+ for(String key : data.getKeySet()){
+ NBTBase tag = data.getTag(key);
+ //Remove only ints because they are the most common ones
+ //Add else if below here to remove more types
+ if(tag instanceof NBTTagInt){
+ if(((NBTTagInt)tag).getInt() == 0){
+ keysToRemove.add(key);
}
- stack.getTagCompound().setInteger("Energy", energy);
}
}
+ for(String key : keysToRemove){
+ data.removeTag(key);
+ }
- if(tile instanceof IFluidSaver){
- FluidStack[] fluids = ((IFluidSaver)tile).getFluids();
-
- if(fluids != null && fluids.length > 0){
- if(stack.getTagCompound() == null){
- stack.setTagCompound(new NBTTagCompound());
- }
-
- stack.getTagCompound().setInteger("FluidAmount", fluids.length);
- for(int i = 0; i < fluids.length; i++){
- if(fluids[i] != null && fluids[i].amount > 0){
- NBTTagCompound compound = new NBTTagCompound();
- fluids[i].writeToNBT(compound);
- stack.getTagCompound().setTag("Fluid"+i, compound);
- }
- }
- }
+ ItemStack stack = new ItemStack(this.getItemDropped(state, Util.RANDOM, fortune), 1, this.damageDropped(state));
+ if(!data.hasNoTags()){
+ stack.setTagCompound(new NBTTagCompound());
+ stack.getTagCompound().setTag("Data", data);
}
drops.add(stack);
@@ -289,8 +272,9 @@ public abstract class BlockContainerBase extends BlockContainer{
return null;
}
+
@Override
- public int getRenderType(){
- return 3;
+ public EnumBlockRenderType getRenderType(IBlockState state){
+ return EnumBlockRenderType.MODEL;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java
index d4705287f..066d960ec 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java
@@ -1,32 +1,29 @@
/*
- * This file ("BlockFluidFlowing.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockFluidFlowing.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
-import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fml.common.registry.GameRegistry;
-public class BlockFluidFlowing extends BlockFluidClassic{
+public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity{
- private String name;
+ private final String name;
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){
super(fluid, material);
@@ -37,22 +34,15 @@ public class BlockFluidFlowing extends BlockFluidClassic{
}
private void register(){
- this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
- GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
- if(this.shouldAddCreative()){
- this.setCreativeTab(CreativeTab.instance);
- }
- else{
- this.setCreativeTab(null);
- }
+ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
}
protected String getBaseName(){
return this.name;
}
- protected Class extends ItemBlockBase> getItemBlock(){
- return ItemBlockBase.class;
+ protected ItemBlockBase getItemBlock(){
+ return new ItemBlockBase(this);
}
public boolean shouldAddCreative(){
@@ -61,14 +51,15 @@ public class BlockFluidFlowing extends BlockFluidClassic{
@Override
public boolean canDisplace(IBlockAccess world, BlockPos pos){
- return !PosUtil.getMaterial(pos, world).isLiquid() && super.canDisplace(world, pos);
+ return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
}
@Override
public boolean displaceIfPossible(World world, BlockPos pos){
- return !PosUtil.getMaterial(pos, world).isLiquid() && super.displaceIfPossible(world, pos);
+ return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
}
+ @Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java
index 665a8baa6..e3597c096 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java
@@ -1,18 +1,17 @@
/*
- * This file ("BlockPlant.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockPlant.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
-import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
@@ -20,25 +19,24 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
-import net.minecraftforge.fml.common.registry.GameRegistry;
import java.util.List;
import java.util.Random;
-public class BlockPlant extends BlockCrops{
+public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity{
+ private final String name;
+ private final int minDropAmount;
+ private final int addDropAmount;
public Item seedItem;
- public Item returnItem;
- public int returnMeta;
- private String name;
- private int minDropAmount;
- private int addDropAmount;
+ private Item returnItem;
+ private int returnMeta;
public BlockPlant(String name, int minDropAmount, int addDropAmount){
this.name = name;
@@ -47,15 +45,14 @@ public class BlockPlant extends BlockCrops{
this.register();
}
+ public void doStuff(Item seedItem, Item returnItem, int returnMeta){
+ this.seedItem = seedItem;
+ this.returnItem = returnItem;
+ this.returnMeta = returnMeta;
+ }
+
private void register(){
- this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
- GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
- if(this.shouldAddCreative()){
- this.setCreativeTab(CreativeTab.instance);
- }
- else{
- this.setCreativeTab(null);
- }
+ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
this.registerRendering();
}
@@ -64,8 +61,8 @@ public class BlockPlant extends BlockCrops{
return this.name;
}
- protected Class extends ItemBlockBase> getItemBlock(){
- return ItemBlockBase.class;
+ protected ItemBlockBase getItemBlock(){
+ return new ItemBlockBase(this);
}
public boolean shouldAddCreative(){
@@ -73,9 +70,10 @@ public class BlockPlant extends BlockCrops{
}
protected void registerRendering(){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
}
+ @Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
}
@@ -91,38 +89,33 @@ public class BlockPlant extends BlockCrops{
}
@Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){
- if(getMetaFromState(state) >= 7){
+ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing facing, float hitX, float hitY, float hitZ){
+ if(this.getMetaFromState(state) >= 7){
if(!world.isRemote){
- List drops = getDrops(world, pos, state, 0);
+ List drops = this.getDrops(world, pos, state, 0);
boolean deductedSeedSize = false;
- for(ItemStack stack : drops){
- if(stack != null){
- if(stack.getItem() == this.seedItem && !deductedSeedSize){
- stack.stackSize--;
+ for(ItemStack drop : drops){
+ if(drop != null){
+ if(drop.getItem() == this.seedItem && !deductedSeedSize){
+ drop.stackSize--;
deductedSeedSize = true;
}
- if(stack.stackSize > 0){
- EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack);
+ if(drop.stackSize > 0){
+ EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, drop);
world.spawnEntityInWorld(entity);
}
}
}
- world.setBlockState(pos, getStateFromMeta(0));
+ world.setBlockState(pos, this.getStateFromMeta(0));
}
return true;
}
return false;
}
- @Override
- public int getDamageValue(World world, BlockPos pos){
- return 0;
- }
-
@Override
public Item getSeed(){
return this.seedItem;
@@ -130,7 +123,7 @@ public class BlockPlant extends BlockCrops{
@Override
public int quantityDropped(IBlockState state, int fortune, Random random){
- return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
+ return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount)+this.minDropAmount : super.quantityDropped(state, fortune, random);
}
@Override
@@ -138,7 +131,6 @@ public class BlockPlant extends BlockCrops{
return this.returnItem;
}
-
@Override
public Item getItemDropped(IBlockState state, Random rand, int par3){
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java
index 6b1d3f824..c8189a04d 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java
@@ -1,29 +1,26 @@
/*
- * This file ("BlockStair.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockStair.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
-import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.fml.common.registry.GameRegistry;
-public class BlockStair extends BlockStairs{
+public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRarity{
- private String name;
+ private final String name;
public BlockStair(Block block, String name){
this(block, name, 0);
@@ -38,14 +35,7 @@ public class BlockStair extends BlockStairs{
}
private void register(){
- this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
- GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
- if(this.shouldAddCreative()){
- this.setCreativeTab(CreativeTab.instance);
- }
- else{
- this.setCreativeTab(null);
- }
+ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
this.registerRendering();
}
@@ -54,8 +44,8 @@ public class BlockStair extends BlockStairs{
return this.name;
}
- protected Class extends ItemBlockBase> getItemBlock(){
- return ItemBlockBase.class;
+ protected ItemBlockBase getItemBlock(){
+ return new ItemBlockBase(this);
}
public boolean shouldAddCreative(){
@@ -63,9 +53,10 @@ public class BlockStair extends BlockStairs{
}
protected void registerRendering(){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
}
+ @Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.COMMON;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java
deleted file mode 100644
index 3b9ef2ed9..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * This file ("BlockWallAA.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.blocks.base;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockFenceGate;
-import net.minecraft.block.BlockWall;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.state.BlockState;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-
-import java.util.List;
-
-public class BlockWallAA extends BlockBase{
-
- private int meta;
-
- public BlockWallAA(String name, Block base){
- this(name, base, 0);
- }
-
- public BlockWallAA(String name, Block base, int meta){
- super(base.getMaterial(), name);
- this.meta = meta;
-
- this.setHardness(1.5F);
- this.setResistance(10F);
- this.setStepSound(base.stepSound);
-
- this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
- }
-
- @Override
- public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
- return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west()));
- }
-
- @Override
- public boolean isFullCube(){
- return false;
- }
-
- @Override
- public boolean isPassable(IBlockAccess worldIn, BlockPos pos){
- return false;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){
- return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side);
- }
-
- @Override
- public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){
- this.setBlockBoundsBasedOnState(worldIn, pos);
- this.maxY = 1.5D;
- return super.getCollisionBoundingBox(worldIn, pos, state);
- }
-
- @Override
- public boolean isOpaqueCube(){
- return false;
- }
-
- @Override
- public int damageDropped(IBlockState state){
- return meta;
- }
-
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){
- boolean flag = this.canConnectTo(worldIn, pos.north());
- boolean flag1 = this.canConnectTo(worldIn, pos.south());
- boolean flag2 = this.canConnectTo(worldIn, pos.west());
- boolean flag3 = this.canConnectTo(worldIn, pos.east());
- float f = 0.25F;
- float f1 = 0.75F;
- float f2 = 0.25F;
- float f3 = 0.75F;
- float f4 = 1.0F;
-
- if(flag){
- f2 = 0.0F;
- }
- if(flag1){
- f3 = 1.0F;
- }
- if(flag2){
- f = 0.0F;
- }
- if(flag3){
- f1 = 1.0F;
- }
-
- if(flag && flag1 && !flag2 && !flag3){
- f4 = 0.8125F;
- f = 0.3125F;
- f1 = 0.6875F;
- }
- else if(!flag && !flag1 && flag2 && flag3){
- f4 = 0.8125F;
- f2 = 0.3125F;
- f3 = 0.6875F;
- }
-
- this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item item, CreativeTabs tab, List list){
- list.add(new ItemStack(item, 1, 0));
- }
-
- public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
- Block block = worldIn.getBlockState(pos).getBlock();
- return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd));
- }
-
- @Override
- public IBlockState getStateFromMeta(int meta){
- return this.getDefaultState();
- }
-
- @Override
- public int getMetaFromState(IBlockState state){
- return 0;
- }
-
- @Override
- protected BlockState createBlockState(){
- return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java
index 37578bd51..c4e3eea7f 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemBlockBase.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemBlockBase.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.base;
@@ -24,6 +24,7 @@ public class ItemBlockBase extends ItemBlock{
this.setMaxDamage(0);
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
@@ -34,31 +35,20 @@ public class ItemBlockBase extends ItemBlock{
return damage;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
- if(this.block instanceof BlockBase){
- return ((BlockBase)this.block).getRarity(stack);
- }
- else if(this.block instanceof BlockContainerBase){
- return ((BlockContainerBase)this.block).getRarity(stack);
- }
- else if(this.block instanceof BlockFluidFlowing){
- return ((BlockFluidFlowing)this.block).getRarity(stack);
- }
- else if(this.block instanceof BlockPlant){
- return ((BlockPlant)this.block).getRarity(stack);
- }
- else if(this.block instanceof BlockStair){
- return ((BlockStair)this.block).getRarity(stack);
- }
- else if(this.block instanceof BlockWallAA){
- return ((BlockWallAA)this.block).getRarity(stack);
- }
- else if(this.block instanceof BlockBushBase){
- return ((BlockBushBase)this.block).getRarity(stack);
+ if(this.block instanceof ICustomRarity){
+ return ((ICustomRarity)this.block).getRarity(stack);
}
else{
return Util.FALLBACK_RARITY;
}
}
-}
+
+ public interface ICustomRarity{
+
+ EnumRarity getRarity(ItemStack stack);
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java
index 384246947..cf8e39efa 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java
@@ -1,17 +1,15 @@
/*
- * This file ("TheColoredLampColors.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("TheColoredLampColors.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
-import de.ellpeck.actuallyadditions.mod.util.StringUtil;
-
public enum TheColoredLampColors{
WHITE("White"),
@@ -31,7 +29,7 @@ public enum TheColoredLampColors{
RED("Red"),
BLACK("Black");
- public String name;
+ public final String name;
TheColoredLampColors(String name){
this.name = name;
@@ -41,8 +39,11 @@ public enum TheColoredLampColors{
if(color.substring(0, 3).equals("dye")){
String actualName = color.substring(3);
for(int i = 0; i < values().length; i++){
- if(StringUtil.equalsToLowerCase(values()[i].name, actualName)){
- return values()[i];
+ String aName = values()[i].name;
+ if(aName != null){
+ if(aName.equalsIgnoreCase(actualName)){
+ return values()[i];
+ }
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java
index 865a60d3e..ecfad5592 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java
@@ -1,11 +1,11 @@
/*
- * This file ("TheMiscBlocks.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("TheMiscBlocks.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java
index 3257d776d..28eaf04a7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java
@@ -1,11 +1,11 @@
/*
- * This file ("TheWildPlants.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("TheWildPlants.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java
new file mode 100644
index 000000000..a28362341
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java
@@ -0,0 +1,63 @@
+/*
+ * This file ("RenderCompost.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks.render;
+
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
+import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public class RenderCompost extends TileEntitySpecialRenderer{
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage){
+ if(te instanceof TileEntityCompost){
+ TileEntityCompost compost = (TileEntityCompost)te;
+ ItemStack slot = compost.getStackInSlot(0);
+
+ if(slot != null){
+ Block display = null;
+ int maxAmount = 0;
+ for(CompostRecipe aRecipe : ActuallyAdditionsAPI.COMPOST_RECIPES){
+ if(slot.isItemEqual(aRecipe.input)){
+ display = aRecipe.inputDisplay;
+ maxAmount = aRecipe.input.stackSize;
+ break;
+ }
+ else if(slot.isItemEqual(aRecipe.output)){
+ display = aRecipe.outputDisplay;
+ maxAmount = aRecipe.output.stackSize;
+ break;
+ }
+ }
+ if(display != null){
+ float i = (float)slot.stackSize/(float)maxAmount;
+ GlStateManager.pushMatrix();
+ GlStateManager.translate((float)x+0.5F, (float)y+(i/3F)+0.01F, (float)z+0.5F);
+ //Hehe
+ if("ShadowfactsDev".equals(Minecraft.getMinecraft().thePlayer.getName())){
+ GlStateManager.translate(0F, 1F, 0F);
+ }
+ GlStateManager.scale(1.5F, i, 1.5F);
+ AssetUtil.renderBlockInWorld(display, 0);
+ GlStateManager.popMatrix();
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java
new file mode 100644
index 000000000..2cf52d223
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java
@@ -0,0 +1,52 @@
+/*
+ * This file ("RenderDisplayStand.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.blocks.render;
+
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public class RenderDisplayStand extends TileEntitySpecialRenderer{
+
+ @Override
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
+ if(!(tile instanceof TileEntityDisplayStand)){
+ return;
+ }
+
+ ItemStack stack = ((TileEntityDisplayStand)tile).getStackInSlot(0);
+ if(stack != null){
+ GlStateManager.pushMatrix();
+ GlStateManager.translate((float)x+0.5F, (float)y+1F, (float)z+0.5F);
+
+ double boop = Minecraft.getSystemTime()/800D;
+ GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.065, 0D);
+ GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0);
+
+ float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
+ GlStateManager.scale(scale, scale, scale);
+ try{
+ AssetUtil.renderItemInWorld(stack);
+ }
+ catch(Exception e){
+ ModUtil.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is "+stack.getItem().getRegistryName()+"!", e);
+ }
+
+ GlStateManager.popMatrix();
+ }
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java
index 627119a37..1d80651d3 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java
@@ -1,25 +1,30 @@
/*
- * This file ("RenderReconstructorLens.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("RenderReconstructorLens.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.render;
+import de.ellpeck.actuallyadditions.api.lens.ILensItem;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-//TODO Fix Reconstructor Lens rendering
public class RenderReconstructorLens extends TileEntitySpecialRenderer{
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
- /*if(!(tile instanceof TileEntityAtomicReconstructor)){
+ if(!(tile instanceof TileEntityAtomicReconstructor)){
return;
}
ItemStack stack = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
@@ -29,7 +34,8 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
- int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
+ IBlockState state = tile.getWorld().getBlockState(tile.getPos());
+ int meta = state.getBlock().getMetaFromState(state);
if(meta == 0){
GlStateManager.translate(0F, -0.5F, 0F);
GlStateManager.rotate(90F, 1F, 0F, 0F);
@@ -61,6 +67,6 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
AssetUtil.renderItemInWorld(stack);
GlStateManager.popMatrix();
- }*/
+ }
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java
index 36ded7504..63c42480d 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java
@@ -1,139 +1,74 @@
/*
- * This file ("RenderSmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("RenderSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.render;
+import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
+import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
+import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
-//TODO Fix Smiley Cloud
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
- //private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png");
-
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){
- /*if(!(tile instanceof TileEntitySmileyCloud)){
- return;
- }
- TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
-
- GlStateManager.pushMatrix();
- {
- if(theCloud.flyHeight == 0){
- theCloud.flyHeight = tile.getWorld().rand.nextInt(30)+30;
- }
- int bobHeight = theCloud.flyHeight;
- double theTime = Minecraft.getSystemTime();
- double time = theTime/50;
-
- if(time-bobHeight >= theCloud.lastFlyHeight){
- theCloud.lastFlyHeight = time;
- }
-
- if(time-(bobHeight/2) >= theCloud.lastFlyHeight){
- GlStateManager.translate(0, (time-theCloud.lastFlyHeight)/300, 0);
- }
- else{
- GlStateManager.translate(0, -(time-theCloud.lastFlyHeight)/300+(double)bobHeight/300, 0);
- }
+ if(tile instanceof TileEntitySmileyCloud){
+ TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
+ GlStateManager.pushMatrix();
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, -2F, 0.0F);
- GlStateManager.pushMatrix();
- {
- if(theModel.doesRotate()){
- int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
- if(meta == 0){
- GlStateManager.rotate(180F, 0F, 1F, 0F);
- }
- if(meta == 1){
- GlStateManager.rotate(90F, 0F, 1F, 0F);
- }
- if(meta == 3){
- GlStateManager.rotate(270F, 0F, 1F, 0F);
- }
- }
+ theCloud.setStatus(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud")));
- if(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"))){
- this.bindTexture(resLocValentine);
- }
- else{
- this.bindTexture(resLoc);
- }
-
- theModel.render(0.0625F);
-
- if(theCloud.name != null && !theCloud.name.isEmpty()){
- for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
- boolean canBreak = false;
- for(String triggerName : cloud.getTriggerNames()){
- if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){
+ if(theCloud.name != null && !theCloud.name.isEmpty()){
+ easterEggs:
+ for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF){
+ for(String triggerName : cloud.getTriggerNames()){
+ if(triggerName != null && theCloud.name != null){
+ if(triggerName.equalsIgnoreCase(theCloud.name)){
+ GlStateManager.pushMatrix();
+ IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
+ switch(state.getBlock().getMetaFromState(state)){
+ case 1:
+ GlStateManager.rotate(180, 0, 1, 0);
+ break;
+ case 2:
+ GlStateManager.rotate(270, 0, 1, 0);
+ break;
+ case 3:
+ GlStateManager.rotate(90, 0, 1, 0);
+ break;
+ }
cloud.renderExtra(0.0625F);
- canBreak = true;
- break;
+ GlStateManager.popMatrix();
+ break easterEggs;
}
}
- if(canBreak){
- break;
- }
}
}
}
GlStateManager.popMatrix();
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
- GlStateManager.pushMatrix();
- {
- GlStateManager.translate(0F, 0.1F, 0F);
- GlStateManager.rotate(180F, 1F, 0F, 0F);
- GlStateManager.rotate(180F, 0F, 1F, 0F);
-
- GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
- float f = 1.6F;
- float f1 = 0.016666668F*f;
- GlStateManager.scale(-f1, -f1, f1);
- GlStateManager.disableLighting();
- GlStateManager.translate(0.0F, 0F/f1, 0.0F);
- GlStateManager.depthMask(false);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- //TODO Fix nameplate with Smiley Cloud
- Tessellator tessellator = Tessellator.getInstance();
- GlStateManager.glDisable(GlStateManager.GL_TEXTURE_2D);
- tessellator.startDrawingQuads();
- int i = Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2;
- tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
- tessellator.addVertex(-i-1, -1.0D, 0.0D);
- tessellator.addVertex(-i-1, 8.0D, 0.0D);
- tessellator.addVertex(i+1, 8.0D, 0.0D);
- tessellator.addVertex(i+1, -1.0D, 0.0D);
- tessellator.draw();
- GlStateManager.glEnable(GlStateManager.GL_TEXTURE_2D);
- GlStateManager.depthMask(true);
-
- Minecraft.getMinecraft().fontRendererObj.drawString(theCloud.name, -Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
-
- GlStateManager.enableLighting();
- GlStateManager.disableBlend();
- GlStateManager.color(1F, 1F, 1F, 1F);
- GlStateManager.scale(1F/-f1, 1F/-f1, 1F/f1);
- }
- GlStateManager.popMatrix();
+ AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.66);
}
+
}
- GlStateManager.popMatrix();
- */
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/model/ModelCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/model/ModelCompost.java
deleted file mode 100644
index 685bbff99..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/model/ModelCompost.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file ("ModelCompost.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.blocks.render.model;
-
-import net.minecraft.client.model.ModelBase;
-
-//TODO Fix compost rendering
-public class ModelCompost extends ModelBase{
-
- /*public ModelRenderer floor;
- public ModelRenderer wallOne;
- public ModelRenderer wallTwo;
- public ModelRenderer wallThree;
- public ModelRenderer wallFour;
- public ModelRenderer[] innerRawList = new ModelRenderer[13];
- public ModelRenderer innerDone;
-
- public ModelCompost(){
- this.textureWidth = 64;
- this.textureHeight = 128;
- this.wallThree = new ModelRenderer(this, 0, 0);
- this.wallThree.setRotationPoint(-6.0F, 8.0F, 6.0F);
- this.wallThree.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F);
- this.wallFour = new ModelRenderer(this, 0, 0);
- this.wallFour.setRotationPoint(-6.0F, 8.0F, -7.0F);
- this.wallFour.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F);
- this.wallOne = new ModelRenderer(this, 0, 0);
- this.wallOne.setRotationPoint(-7.0F, 8.0F, -7.0F);
- this.wallOne.addBox(0.0F, 0.0F, 0.0F, 1, 15, 14, 0.0F);
- this.wallTwo = new ModelRenderer(this, 0, 0);
- this.wallTwo.setRotationPoint(6.0F, 8.0F, -7.0F);
- this.wallTwo.addBox(0.0F, 0.0F, 0.0F, 1, 15, 14, 0.0F);
- this.floor = new ModelRenderer(this, 0, 0);
- this.floor.setRotationPoint(-7.0F, 23.0F, -7.0F);
- this.floor.addBox(0.0F, 0.0F, 0.0F, 14, 1, 14, 0.0F);
-
- for(int i = 0; i < this.innerRawList.length; i++){
- this.innerRawList[i] = new ModelRenderer(this, 0, 29);
- this.innerRawList[i].setRotationPoint(-6.0F, 10.0F, -6.0F);
- this.innerRawList[i].addBox(0.0F, 12-i, 0.0F, 12, i+1, 12, 0.0F);
- }
-
- this.innerDone = new ModelRenderer(this, 0, 54);
- this.innerDone.setRotationPoint(-6.0F, 10.0F, -6.0F);
- this.innerDone.addBox(0.0F, 0.0F, 0.0F, 12, 13, 12, 0.0F);
- }
-
- @Override
- public void render(float f){
- this.wallThree.render(f);
- this.wallFour.render(f);
- this.wallOne.render(f);
- this.wallTwo.render(f);
- this.floor.render(f);
- }
-
- @Override
- public void renderExtra(float f, TileEntity tile){
- //Hehe
- if("ShadowfactsDev".equals(Minecraft.getMinecraft().thePlayer.getName())){
- GlStateManager.translate(0F, 1F, 0F);
- }
-
- if(tile instanceof TileEntityCompost){
- ItemStack stack = ((TileEntityCompost)tile).getStackInSlot(0);
- if(stack != null){
- if(stack.getItem() == InitItems.itemFertilizer){
- this.innerDone.render(f);
- }
- else{
- int heightToDisplay = stack.stackSize*13/TileEntityCompost.AMOUNT;
- if(heightToDisplay > 13){
- heightToDisplay = 13;
- }
-
- this.innerRawList[heightToDisplay-1].render(f);
- }
- }
- }
- }*/
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java
index 94558417a..12d081624 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletUtils.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletUtils.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet;
@@ -19,13 +19,20 @@ import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch;
+import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
-import de.ellpeck.actuallyadditions.mod.util.*;
+import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import net.minecraft.stats.Achievement;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import java.awt.*;
import java.net.URI;
@@ -33,7 +40,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
-public class BookletUtils{
+public final class BookletUtils{
/**
* Tries to open a URL in the Browser
@@ -51,7 +58,7 @@ public class BookletUtils{
public static void openBrowser(String url, String shiftUrl){
try{
if(Desktop.isDesktopSupported()){
- if(shiftUrl.equals(url) || KeyUtil.isShiftPressed()){
+ if(shiftUrl.equals(url) || GuiScreen.isShiftKeyDown()){
Desktop.getDesktop().browse(new URI(shiftUrl));
}
else{
@@ -68,17 +75,17 @@ public class BookletUtils{
* Draws the Title of the current chapter, current index entry or just "Actually Additions" if neither is present
*/
public static void drawTitle(GuiBooklet booklet){
- booklet.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
+ booklet.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC);
//Upper title
booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize/2-142/2, booklet.guiTop-12, 0, 240, 142, 12);
//Lower title
booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize/2-142/2, booklet.guiTop+booklet.ySize, 0, 243, 142, 13);
//Draw No Entry title
- if(booklet.currentEntrySet.entry == null){
- String strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.1");
+ if(booklet.currentEntrySet.getCurrentEntry() == null){
+ String strg = TextFormatting.DARK_GREEN+StringUtil.localize(booklet.bookletName);
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0);
- strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.2");
+ strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.manualName.2");
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12+booklet.getFontRenderer().FONT_HEIGHT, 0);
String version;
@@ -92,17 +99,20 @@ public class BookletUtils{
else if(playerName.equals("KittyVanCat")){
version = "Cat's Edition";
}
+ else if(playerName.equals("canitzp")){
+ version = "P's Edition";
+ }
else if(playerName.equals("Ellpeck") || Util.isDevVersion()){
version = "Dev's Edition";
}
else{
- version = StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1);
+ version = StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1);
}
- strg = EnumChatFormatting.GOLD+EnumChatFormatting.ITALIC.toString()+"-"+version+"-";
+ strg = TextFormatting.GOLD+TextFormatting.ITALIC.toString()+"-"+version+"-";
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0);
}
- String strg = booklet.currentEntrySet.chapter == null ? (booklet.currentEntrySet.entry == null ? StringUtil.localize("itemGroup."+ModUtil.MOD_ID_LOWER) : booklet.currentEntrySet.entry.getLocalizedName()) : booklet.currentEntrySet.chapter.getLocalizedName();
+ String strg = booklet.currentEntrySet.getCurrentChapter() == null ? (booklet.currentEntrySet.getCurrentEntry() == null ? StringUtil.localize("itemGroup."+ModUtil.MOD_ID) : booklet.currentEntrySet.getCurrentEntry().getLocalizedName()) : booklet.currentEntrySet.getCurrentChapter().getLocalizedName();
booklet.drawCenteredString(booklet.getFontRenderer(), strg, booklet.guiLeft+booklet.xSize/2, booklet.guiTop-9, StringUtil.DECIMAL_COLOR_WHITE);
}
@@ -112,19 +122,19 @@ public class BookletUtils{
* @param pre If the hover info texts or the icon should be drawn
*/
public static void drawAchievementInfo(GuiBooklet booklet, boolean pre, int mouseX, int mouseY){
- if(booklet.currentEntrySet.chapter == null){
+ if(booklet.currentEntrySet.getCurrentChapter() == null){
return;
}
ArrayList infoList = null;
- for(BookletPage page : booklet.currentEntrySet.chapter.getPages()){
+ for(BookletPage page : booklet.currentEntrySet.getCurrentChapter().getPages()){
if(page != null && page.getItemStacksForPage() != null){
for(ItemStack stack : page.getItemStacksForPage()){
if(stack != null){
- for(Achievement achievement : InitAchievements.achievementList){
+ for(Achievement achievement : InitAchievements.ACHIEVEMENT_LIST){
if(achievement.theItemStack != null && ItemUtil.areItemsEqual(stack, achievement.theItemStack, true)){
if(pre){
- booklet.mc.getTextureManager().bindTexture(GuiBooklet.resLoc);
+ booklet.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC);
booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize+1, booklet.guiTop-18, 166, 154, 22, 21);
return;
}
@@ -132,10 +142,10 @@ public class BookletUtils{
if(mouseX >= booklet.guiLeft+booklet.xSize+1 && mouseX < booklet.guiLeft+booklet.xSize+1+22 && mouseY >= booklet.guiTop-18 && mouseY < booklet.guiTop-18+21){
if(infoList == null){
infoList = new ArrayList();
- infoList.add(EnumChatFormatting.GOLD+"Achievements related to this chapter:");
+ infoList.add(TextFormatting.GOLD+"Achievements related to this chapter:");
}
infoList.add("-"+StringUtil.localize(achievement.statId));
- infoList.add(EnumChatFormatting.GRAY+"("+achievement.getDescription()+")");
+ infoList.add(TextFormatting.GRAY+"("+achievement.getDescription()+")");
}
}
}
@@ -157,31 +167,30 @@ public class BookletUtils{
* -the amount of words and chars in the index (Just for teh lulz)
*/
public static void renderPre(GuiBooklet booklet, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
- if(booklet.currentEntrySet.entry != null){
+ if(booklet.currentEntrySet.getCurrentEntry() != null){
//Renders Booklet Page Number and Content
- if(booklet.currentEntrySet.chapter != null && booklet.currentEntrySet.page != null){
- booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.page.getID()+"/"+booklet.currentEntrySet.chapter.getPages().length, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
- booklet.currentEntrySet.page.renderPre(booklet, mouseX, mouseY, ticksElapsed, mousePressed);
+ if(booklet.currentEntrySet.getCurrentChapter() != null && booklet.currentEntrySet.getCurrentPage() != null){
+ booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.getCurrentPage().getID()+"/"+booklet.currentEntrySet.getCurrentChapter().getPages().length, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+171, StringUtil.DECIMAL_COLOR_WHITE);
+ booklet.currentEntrySet.getCurrentPage().renderPre(booklet, mouseX, mouseY, ticksElapsed, mousePressed);
}
//Renders Chapter Page Number
else{
- booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.pageInIndex+"/"+booklet.indexPageAmount, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
+ booklet.drawCenteredString(booklet.getFontRenderer(), booklet.currentEntrySet.getPageInIndex()+"/"+booklet.indexPageAmount, booklet.guiLeft+booklet.xSize/2, booklet.guiTop+171, StringUtil.DECIMAL_COLOR_WHITE);
}
}
//Renders the amount of words and chars the book has
else{
- String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", ClientProxy.bookletWordCount);
- booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0);
+ String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID+".amountOfWords", ClientProxy.bookletWordCount);
+ booklet.getFontRenderer().drawString(TextFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0);
- String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfChars", ClientProxy.bookletCharCount);
- booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0);
+ String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID+".amountOfChars", ClientProxy.bookletCharCount);
+ booklet.getFontRenderer().drawString(TextFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0);
}
}
/**
* Draws all of the hovering texts for the buttons that need explanation in the booklet
*/
- @SuppressWarnings("unchecked")
public static void doHoverTexts(GuiBooklet booklet, int mouseX, int mouseY){
//Update all of the buttons' hovering texts
for(Object button : booklet.getButtonList()){
@@ -192,9 +201,6 @@ public class BookletUtils{
else if(button instanceof TexturedButton){
booklet.drawHoveringText(((TexturedButton)button).textList, mouseX, mouseY);
}
- else if(button instanceof IndexButton){
- ((IndexButton)button).drawHover(mouseX, mouseY);
- }
}
}
}
@@ -202,10 +208,9 @@ public class BookletUtils{
/**
* Updates the search bar, should be called when it is getting typed into
*/
- @SuppressWarnings("unchecked")
public static void updateSearchBar(GuiBooklet booklet){
- if(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch){
- BookletEntryAllSearch currentEntry = (BookletEntryAllSearch)booklet.currentEntrySet.entry;
+ if(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch){
+ BookletEntryAllSearch currentEntry = (BookletEntryAllSearch)booklet.currentEntrySet.getCurrentEntry();
if(booklet.searchField.getText() != null && !booklet.searchField.getText().isEmpty()){
currentEntry.chapters.clear();
@@ -219,7 +224,7 @@ public class BookletUtils{
else{
currentEntry.setChapters((ArrayList)currentEntry.allChapters.clone());
}
- openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex, false);
+ openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex(), false);
}
}
@@ -228,7 +233,7 @@ public class BookletUtils{
ItemStack[] pageStacks = page.getItemStacksForPage();
if(pageStacks != null){
for(ItemStack stack : pageStacks){
- if(stack.getDisplayName().toLowerCase(Locale.ROOT).contains(text)){
+ if(stack != null && stack.getDisplayName().toLowerCase(Locale.ROOT).contains(text)){
return true;
}
}
@@ -237,7 +242,6 @@ public class BookletUtils{
return false;
}
- @SuppressWarnings("unchecked")
public static void openIndexEntry(GuiBooklet booklet, IBookletEntry entry, int page, boolean resetTextField){
booklet.searchField.setVisible(entry instanceof BookletEntryAllSearch);
booklet.searchField.setFocused(entry instanceof BookletEntryAllSearch);
@@ -248,25 +252,30 @@ public class BookletUtils{
}
}
- booklet.currentEntrySet.page = null;
- booklet.currentEntrySet.chapter = null;
+ if(booklet.currentEntrySet.getCurrentPage() != null){
+ booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
+ }
+ booklet.currentEntrySet.setPage(null);
+ booklet.currentEntrySet.setChapter(null);
- booklet.currentEntrySet.entry = entry;
+ booklet.currentEntrySet.setEntry(entry);
booklet.indexPageAmount = entry == null ? 1 : entry.getChapters().size()/booklet.chapterButtons.length+1;
- booklet.currentEntrySet.pageInIndex = entry == null ? 1 : (booklet.indexPageAmount <= page || page <= 0 ? booklet.indexPageAmount : page);
+ booklet.currentEntrySet.setPageInIndex(entry == null ? 1 : (booklet.indexPageAmount <= page || page <= 0 ? booklet.indexPageAmount : page));
booklet.buttonPreviousScreen.visible = entry != null;
- booklet.buttonForward.visible = booklet.currentEntrySet.pageInIndex < booklet.indexPageAmount;
- booklet.buttonBackward.visible = booklet.currentEntrySet.pageInIndex > 1;
+ booklet.buttonForward.visible = booklet.currentEntrySet.getPageInIndex() < booklet.indexPageAmount;
+ booklet.buttonBackward.visible = booklet.currentEntrySet.getPageInIndex() > 1;
+
+ booklet.buttonViewOnline.visible = false;
for(int i = 0; i < booklet.chapterButtons.length; i++){
IndexButton button = (IndexButton)booklet.chapterButtons[i];
if(entry == null){
if(i >= GuiBooklet.INDEX_BUTTONS_OFFSET){
- boolean entryExists = ActuallyAdditionsAPI.bookletEntries.size() > i-GuiBooklet.INDEX_BUTTONS_OFFSET;
+ boolean entryExists = ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > i-GuiBooklet.INDEX_BUTTONS_OFFSET;
button.visible = entryExists;
if(entryExists){
- button.displayString = ActuallyAdditionsAPI.bookletEntries.get(i-GuiBooklet.INDEX_BUTTONS_OFFSET).getLocalizedNameWithFormatting();
+ button.displayString = "- "+ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(i-GuiBooklet.INDEX_BUTTONS_OFFSET).getLocalizedNameWithFormatting();
button.chap = null;
}
}
@@ -275,15 +284,17 @@ public class BookletUtils{
}
}
else{
- boolean entryExists = entry.getChapters().size() > i+(booklet.chapterButtons.length*booklet.currentEntrySet.pageInIndex-booklet.chapterButtons.length);
+ boolean entryExists = entry.getChapters().size() > i+(booklet.chapterButtons.length*booklet.currentEntrySet.getPageInIndex()-booklet.chapterButtons.length);
button.visible = entryExists;
if(entryExists){
- IBookletChapter chap = entry.getChapters().get(i+(booklet.chapterButtons.length*booklet.currentEntrySet.pageInIndex-booklet.chapterButtons.length));
+ IBookletChapter chap = entry.getChapters().get(i+(booklet.chapterButtons.length*booklet.currentEntrySet.getPageInIndex()-booklet.chapterButtons.length));
button.displayString = chap.getLocalizedNameWithFormatting();
button.chap = chap;
}
}
}
+
+ booklet.shouldSaveDataNextClose = true;
}
/**
@@ -292,17 +303,17 @@ public class BookletUtils{
public static void handleChapterButtonClick(GuiBooklet booklet, GuiButton button){
int place = Util.arrayContains(booklet.chapterButtons, button);
if(place >= 0){
- if(booklet.currentEntrySet.entry != null){
- if(booklet.currentEntrySet.chapter == null){
- if(place < booklet.currentEntrySet.entry.getChapters().size()){
- IBookletChapter chap = booklet.currentEntrySet.entry.getChapters().get(place+(booklet.chapterButtons.length*booklet.currentEntrySet.pageInIndex-booklet.chapterButtons.length));
+ if(booklet.currentEntrySet.getCurrentEntry() != null){
+ if(booklet.currentEntrySet.getCurrentChapter() == null){
+ if(place < booklet.currentEntrySet.getCurrentEntry().getChapters().size()){
+ IBookletChapter chap = booklet.currentEntrySet.getCurrentEntry().getChapters().get(place+(booklet.chapterButtons.length*booklet.currentEntrySet.getPageInIndex()-booklet.chapterButtons.length));
openChapter(booklet, chap, chap.getPages()[0]);
}
}
}
else{
- if(place-GuiBooklet.INDEX_BUTTONS_OFFSET < ActuallyAdditionsAPI.bookletEntries.size()){
- openIndexEntry(booklet, ActuallyAdditionsAPI.bookletEntries.get(place-GuiBooklet.INDEX_BUTTONS_OFFSET), 1, true);
+ if(place-GuiBooklet.INDEX_BUTTONS_OFFSET < ActuallyAdditionsAPI.BOOKLET_ENTRIES.size()){
+ openIndexEntry(booklet, ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(place-GuiBooklet.INDEX_BUTTONS_OFFSET), 1, true);
}
}
}
@@ -313,7 +324,7 @@ public class BookletUtils{
* Can only be done when the chapter is not null and an index entry is opened in the booklet
*/
public static void openChapter(GuiBooklet booklet, IBookletChapter chapter, BookletPage page){
- if(chapter == null || booklet.currentEntrySet.entry == null){
+ if(chapter == null || booklet.currentEntrySet.getCurrentEntry() == null){
return;
}
@@ -321,16 +332,26 @@ public class BookletUtils{
booklet.searchField.setFocused(false);
booklet.searchField.setText("");
- booklet.currentEntrySet.chapter = chapter;
- booklet.currentEntrySet.page = page != null && doesChapterHavePage(chapter, page) ? page : chapter.getPages()[0];
+ booklet.currentEntrySet.setChapter(chapter);
- booklet.buttonForward.visible = getNextPage(chapter, booklet.currentEntrySet.page) != null;
- booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentEntrySet.page) != null;
+ if(booklet.currentEntrySet.getCurrentPage() != null){
+ booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
+ }
+ BookletPage pageToSet = page != null && doesChapterHavePage(chapter, page) ? page : chapter.getPages()[0];
+ booklet.currentEntrySet.setPage(pageToSet);
+ pageToSet.onOpened(booklet);
+
+ booklet.buttonForward.visible = getNextPage(chapter, booklet.currentEntrySet.getCurrentPage()) != null;
+ booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentEntrySet.getCurrentPage()) != null;
booklet.buttonPreviousScreen.visible = true;
+ booklet.buttonViewOnline.visible = true;
+
for(GuiButton chapterButton : booklet.chapterButtons){
chapterButton.visible = false;
}
+
+ booklet.shouldSaveDataNextClose = true;
}
/**
@@ -377,44 +398,52 @@ public class BookletUtils{
* Called when the "next page"-button is pressed
*/
public static void handleNextPage(GuiBooklet booklet){
- if(booklet.currentEntrySet.entry != null){
- if(booklet.currentEntrySet.page != null){
- BookletPage page = getNextPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page);
+ if(booklet.currentEntrySet.getCurrentEntry() != null){
+ if(booklet.currentEntrySet.getCurrentPage() != null){
+ BookletPage page = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage());
if(page != null){
- booklet.currentEntrySet.page = page;
+ booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
+ booklet.currentEntrySet.setPage(page);
+ page.onOpened(booklet);
}
- booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
- booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
+ booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
+ booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
}
else{
- if(booklet.currentEntrySet.pageInIndex+1 <= booklet.indexPageAmount){
- openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex+1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
+ if(booklet.currentEntrySet.getPageInIndex()+1 <= booklet.indexPageAmount){
+ openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex()+1, !(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch));
}
}
}
+
+ booklet.shouldSaveDataNextClose = true;
}
/**
* Called when the "previous page"-button is pressed
*/
public static void handlePreviousPage(GuiBooklet booklet){
- if(booklet.currentEntrySet.entry != null){
- if(booklet.currentEntrySet.page != null){
- BookletPage page = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page);
+ if(booklet.currentEntrySet.getCurrentEntry() != null){
+ if(booklet.currentEntrySet.getCurrentPage() != null){
+ BookletPage page = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage());
if(page != null){
- booklet.currentEntrySet.page = page;
+ booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
+ booklet.currentEntrySet.setPage(page);
+ page.onOpened(booklet);
}
- booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
- booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
+ booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
+ booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
}
else{
- if(booklet.currentEntrySet.pageInIndex-1 > 0){
- openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex-1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
+ if(booklet.currentEntrySet.getPageInIndex()-1 > 0){
+ openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex()-1, !(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch));
}
}
}
+
+ booklet.shouldSaveDataNextClose = true;
}
public static BookletPage getFirstPageForStack(ItemStack stack){
@@ -424,11 +453,57 @@ public class BookletUtils{
public static ArrayList getPagesForStack(ItemStack stack){
ArrayList possiblePages = new ArrayList();
- for(BookletPage page : ActuallyAdditionsAPI.bookletPagesWithItemStackData){
+ for(BookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_DATA){
if(ItemUtil.contains(page.getItemStacksForPage(), stack, page.arePageStacksWildcard)){
possiblePages.add(page);
}
}
return possiblePages;
}
+
+ public static void saveBookPage(GuiBooklet gui, NBTTagCompound compound){
+ //Save Entry etc.
+ compound.setTag("SavedEntry", gui.currentEntrySet.writeToNBT());
+ compound.setString("SearchWord", gui.searchField.getText());
+
+ //Save Bookmarks
+ NBTTagList list = new NBTTagList();
+ for(int i = 0; i < gui.bookmarkButtons.length; i++){
+ BookmarkButton button = (BookmarkButton)gui.bookmarkButtons[i];
+
+ list.appendTag(button.assignedEntry.writeToNBT());
+ }
+ compound.setTag("Bookmarks", list);
+ }
+
+ public static void openLastBookPage(GuiBooklet gui, NBTTagCompound compound){
+ //Open Entry etc.
+ EntrySet set = EntrySet.readFromNBT(compound.getCompoundTag("SavedEntry"));
+ if(set != null){
+
+ BookletUtils.openIndexEntry(gui, set.entry, set.pageInIndex, true);
+ if(set.chapter != null){
+ BookletUtils.openChapter(gui, set.chapter, set.page);
+ }
+
+ String searchText = compound.getString("SearchWord");
+ if(!searchText.isEmpty()){
+ gui.searchField.setText(searchText);
+ BookletUtils.updateSearchBar(gui);
+ }
+ }
+ else{
+ //If everything fails, initialize the front page
+ BookletUtils.openIndexEntry(gui, null, 1, true);
+ }
+
+ //Load Bookmarks
+ NBTTagList list = compound.getTagList("Bookmarks", 10);
+ if(list != null){
+ for(int i = 0; i < list.tagCount(); i++){
+ BookmarkButton button = (BookmarkButton)gui.bookmarkButtons[i];
+ button.assignedEntry = EntrySet.readFromNBT(list.getCompoundTagAt(i));
+ }
+ }
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiAAAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiAAAchievements.java
index ccbae9e75..b46478423 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiAAAchievements.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiAAAchievements.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiAAAchievements.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiAAAchievements.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet;
@@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.achievement.GuiAchievements;
-import net.minecraft.stats.StatFileWriter;
+import net.minecraft.stats.StatisticsManager;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
/**
@@ -22,8 +22,8 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
*/
public class GuiAAAchievements extends GuiAchievements{
- public GuiAAAchievements(GuiScreen screen, StatFileWriter writer){
- super(screen, writer);
+ public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){
+ super(screen, statistics);
try{
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, InitAchievements.pageNumber, 20);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java
index e1e4de69d..9a04aae48 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java
@@ -1,31 +1,37 @@
/*
- * This file ("GuiBooklet.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiBooklet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
-import de.ellpeck.actuallyadditions.api.internal.EntrySet;
+import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
+import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch;
+import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration;
+import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.items.ItemBooklet;
+import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
+import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
-import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData;
+import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
@@ -33,10 +39,13 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.IChatComponent;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.math.MathHelper;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
@@ -50,19 +59,24 @@ import java.util.List;
@SideOnly(Side.CLIENT)
public class GuiBooklet extends GuiScreen implements IBookletGui{
- public static final ResourceLocation resLoc = AssetUtil.getBookletGuiLocation("guiBooklet");
- public static final ResourceLocation resLocHalloween = AssetUtil.getBookletGuiLocation("guiBookletHalloween");
- public static final ResourceLocation resLocChristmas = AssetUtil.getBookletGuiLocation("guiBookletChristmas");
- public static final ResourceLocation resLocValentine = AssetUtil.getBookletGuiLocation("guiBookletValentinesDay");
+ public static final ResourceLocation RES_LOC = AssetUtil.getBookletGuiLocation("guiBooklet");
+ public static final ResourceLocation RES_LOC_HALLOWEEN = AssetUtil.getBookletGuiLocation("guiBookletHalloween");
+ public static final ResourceLocation RES_LOC_CHRISTMAS = AssetUtil.getBookletGuiLocation("guiBookletChristmas");
+ public static final ResourceLocation RES_LOC_VALENTINE = AssetUtil.getBookletGuiLocation("guiBookletValentinesDay");
public static final int CHAPTER_BUTTONS_AMOUNT = 13;
public static final int INDEX_BUTTONS_OFFSET = 3;
private static final int[] AND_HIS_NAME_IS = new int[]{Keyboard.KEY_C, Keyboard.KEY_E, Keyboard.KEY_N, Keyboard.KEY_A};
- public int xSize;
- public int ySize;
+ public final int xSize;
+ public final int ySize;
+ public final IEntrySet currentEntrySet = new EntrySet(null);
+ public final GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
+ public final GuiButton[] bookmarkButtons = new GuiButton[8];
+ public final GuiScreen parentScreen;
+ private final boolean tryOpenMainPage;
+ private final boolean saveOnClose;
public int guiLeft;
public int guiTop;
- public EntrySet currentEntrySet = new EntrySet(null);
public int indexPageAmount;
public GuiButton buttonForward;
public GuiButton buttonBackward;
@@ -73,15 +87,14 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public GuiButton buttonAchievements;
public GuiButton buttonConfig;
public GuiButton buttonWebsite;
- public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
- public GuiButton[] bookmarkButtons = new GuiButton[8];
+ public GuiButton buttonPatreon;
+ public GuiButton buttonViewOnline;
public GuiTextField searchField;
- public GuiScreen parentScreen;
+ public boolean shouldSaveDataNextClose;
private int ticksElapsed;
private boolean mousePressed;
- private boolean tryOpenMainPage;
- private boolean saveOnClose;
private int hisNameIsAt;
+ public String bookletName;
public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){
this.xSize = 146;
@@ -95,6 +108,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
return this.fontRendererObj;
}
+ @Override
public List getButtonList(){
return this.buttonList;
}
@@ -117,12 +131,12 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
//Draws the Background
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(ClientProxy.jingleAllTheWay ? resLocChristmas : (ClientProxy.pumpkinBlurPumpkinBlur ? resLocHalloween : (ClientProxy.bulletForMyValentine ? resLocValentine : resLoc)));
+ this.mc.getTextureManager().bindTexture(ClientProxy.jingleAllTheWay ? RES_LOC_CHRISTMAS : (ClientProxy.pumpkinBlurPumpkinBlur ? RES_LOC_HALLOWEEN : (ClientProxy.bulletForMyValentine ? RES_LOC_VALENTINE : RES_LOC)));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
//Draws the search bar
- if(this.currentEntrySet.entry instanceof BookletEntryAllSearch && this.currentEntrySet.chapter == null){
- this.mc.getTextureManager().bindTexture(resLoc);
+ if(this.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch && this.currentEntrySet.getCurrentChapter() == null){
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
}
@@ -137,59 +151,63 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
//Pre-Renders the current page's content etc.
BookletUtils.renderPre(this, x, y, this.ticksElapsed, this.mousePressed);
- //Does vanilla drawing stuff
- super.drawScreen(x, y, f);
+ //Buttons and search field
+ if(this.currentEntrySet.getCurrentPage() != null){
+ this.fontRendererObj.setUnicodeFlag(false);
+ }
+ for(GuiButton button : this.buttonList){
+ button.drawButton(this.mc, x, y);
+ }
+ this.fontRendererObj.setUnicodeFlag(true);
+
this.searchField.drawTextBox();
//Renders the current page's content
- if(this.currentEntrySet.entry != null && this.currentEntrySet.chapter != null && this.currentEntrySet.page != null){
- this.currentEntrySet.page.render(this, x, y, this.ticksElapsed, this.mousePressed);
+ if(this.currentEntrySet.getCurrentEntry() != null && this.currentEntrySet.getCurrentChapter() != null && this.currentEntrySet.getCurrentPage() != null){
+ this.currentEntrySet.getCurrentPage().render(this, x, y, this.ticksElapsed, this.mousePressed);
}
//Draws hovering texts for buttons
this.fontRendererObj.setUnicodeFlag(false);
BookletUtils.doHoverTexts(this, x, y);
BookletUtils.drawAchievementInfo(this, false, x, y);
- this.fontRendererObj.setUnicodeFlag(true);
this.fontRendererObj.setUnicodeFlag(unicodeBefore);
//Resets mouse
- if(this.mousePressed){
- this.mousePressed = false;
- }
+ this.mousePressed = false;
}
@Override
public void keyTyped(char theChar, int key){
- if(key == Keyboard.KEY_ESCAPE){
- if(this.parentScreen != null){
- this.mc.displayGuiScreen(this.parentScreen);
- }
- else{
- this.mc.displayGuiScreen(null);
- this.mc.setIngameFocus();
- }
- }
- else if(this.searchField.isFocused()){
- this.searchField.textboxKeyTyped(theChar, key);
- BookletUtils.updateSearchBar(this);
- }
- else{
- if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){
- if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){
- Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh")));
- ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH");
- this.hisNameIsAt = 0;
- }
- else{
- this.hisNameIsAt++;
- }
- }
- else{
+ if(!this.searchField.isFocused() && AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){
+ if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){
+ Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundHandler.duhDuhDuhDuuuh, 0.5F));
+ ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH");
this.hisNameIsAt = 0;
}
+ else{
+ this.hisNameIsAt++;
+ }
}
+ else{
+ this.hisNameIsAt = 0;
+
+ if(key == Keyboard.KEY_ESCAPE || (key == this.mc.gameSettings.keyBindInventory.getKeyCode() && !this.searchField.isFocused())){
+ if(this.parentScreen != null){
+ this.mc.displayGuiScreen(this.parentScreen);
+ }
+ else{
+ this.mc.displayGuiScreen(null);
+ this.mc.setIngameFocus();
+ }
+ }
+ else if(this.searchField.isFocused()){
+ this.searchField.textboxKeyTyped(theChar, key);
+ BookletUtils.updateSearchBar(this);
+ }
+ }
+
}
@Override
@@ -201,13 +219,13 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
protected void mouseClicked(int par1, int par2, int par3) throws IOException{
this.searchField.mouseClicked(par1, par2, par3);
//Left mouse button
- if(par3 == 0 && this.currentEntrySet.chapter != null){
+ if(par3 == 0 && this.currentEntrySet.getCurrentChapter() != null){
this.mousePressed = true;
}
//Right mouse button
else if(par3 == 1){
- if(this.currentEntrySet.chapter != null){
- BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
+ if(this.currentEntrySet.getCurrentChapter() != null){
+ BookletUtils.openIndexEntry(this, this.currentEntrySet.getCurrentEntry(), this.currentEntrySet.getPageInIndex(), true);
}
else{
BookletUtils.openIndexEntry(this, null, 1, true);
@@ -218,16 +236,33 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
@Override
public void actionPerformed(GuiButton button){
+ if(this.currentEntrySet.getCurrentPage() != null){
+ if(this.currentEntrySet.getCurrentPage().onActionPerformed(this, button)){
+ return;
+ }
+ }
+
//Handles update
if(button == this.buttonUpdate){
if(UpdateChecker.needsUpdateNotify){
BookletUtils.openBrowser(UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK);
}
}
+ //Handles View Online
+ else if(button == this.buttonViewOnline){
+ IBookletChapter chapter = this.currentEntrySet.getCurrentChapter();
+ if(chapter != null){
+ BookletUtils.openBrowser("http://ellpeck.de/actaddmanual/#"+chapter.getUnlocalizedName());
+ }
+ }
//Handles Website
else if(button == this.buttonWebsite){
BookletUtils.openBrowser("http://ellpeck.de");
}
+ //Handles Patreon
+ else if(button == this.buttonPatreon){
+ BookletUtils.openBrowser("http://www.patreon.com/Ellpeck");
+ }
//Handles Twitter
else if(button == this.buttonTwitter){
BookletUtils.openBrowser("http://twitter.com/ActAddMod");
@@ -238,11 +273,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
}
//Handles config
else if(button == this.buttonConfig){
- mc.displayGuiScreen(new GuiConfiguration(this));
+ this.mc.displayGuiScreen(new GuiConfiguration(this));
}
//Handles achievements
else if(button == this.buttonAchievements){
- mc.displayGuiScreen(new GuiAAAchievements(this, mc.thePlayer.getStatFileWriter()));
+ this.mc.displayGuiScreen(new GuiAAAchievements(this, this.mc.thePlayer.getStatFileWriter()));
}
else if(button == this.buttonForward){
BookletUtils.handleNextPage(this);
@@ -252,8 +287,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
}
//Handles gonig from page to chapter or from chapter to index
else if(button == this.buttonPreviousScreen){
- if(this.currentEntrySet.chapter != null){
- BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
+ if(this.currentEntrySet.getCurrentChapter() != null){
+ BookletUtils.openIndexEntry(this, this.currentEntrySet.getCurrentEntry(), this.currentEntrySet.getPageInIndex(), true);
}
else{
BookletUtils.openIndexEntry(this, null, 1, true);
@@ -268,68 +303,82 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
}
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
+ int flavor = 1;
+ if(Util.RANDOM.nextFloat() <= 0.1){
+ flavor = MathHelper.getRandomIntegerInRange(Util.RANDOM, 2, 5);
+ }
+ this.bookletName = "info."+ModUtil.MOD_ID+".booklet.manualName.1."+flavor;
+
this.guiLeft = (this.width-this.xSize)/2;
this.guiTop = (this.height-this.ySize)/2;
- this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize-26, this.guiTop+this.ySize+1, 164, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Next Page"));
+ this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize-26, this.guiTop+this.ySize+1, 164, 0, 18, 10, Collections.singletonList(TextFormatting.GOLD+"Next Page"));
this.buttonList.add(this.buttonForward);
- this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Previous Page"));
+ this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(TextFormatting.GOLD+"Previous Page"));
this.buttonList.add(this.buttonBackward);
- this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Back"));
+ this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(TextFormatting.GOLD+"Back"));
this.buttonList.add(this.buttonPreviousScreen);
ArrayList updateHover = new ArrayList();
if(UpdateChecker.checkFailed){
- updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText());
+ updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID+".update.failed")).getFormattedText());
}
else if(UpdateChecker.needsUpdateNotify){
- updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText());
- updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString)).getFormattedText());
- updateHover.add(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.buttonOptions"));
+ updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID+".update.generic")).getFormattedText());
+ updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString)).getFormattedText());
+ updateHover.add(StringUtil.localize("info."+ModUtil.MOD_ID+".update.buttonOptions"));
}
this.buttonUpdate = new TexturedButton(4, this.guiLeft-11, this.guiTop-11, 245, 0, 11, 11, updateHover);
- this.buttonUpdate.visible = UpdateChecker.needsUpdateNotify;
+ this.buttonUpdate.visible = UpdateChecker.needsUpdateNotify || UpdateChecker.checkFailed;
this.buttonList.add(this.buttonUpdate);
- this.buttonTwitter = new TexturedButton(5, this.guiLeft, this.guiTop, 213, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Open @ActAddMod on Twitter in Browser"));
+ this.buttonTwitter = new TexturedButton(5, this.guiLeft, this.guiTop+10, 213, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Open @ActAddMod on Twitter in Browser"));
this.buttonList.add(this.buttonTwitter);
- this.buttonForum = new TexturedButton(6, this.guiLeft, this.guiTop+10, 221, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Open Minecraft Forum Post in Browser"));
+ this.buttonForum = new TexturedButton(6, this.guiLeft, this.guiTop+20, 221, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Open Minecraft Forum Post in Browser"));
this.buttonList.add(this.buttonForum);
- this.buttonAchievements = new TexturedButton(7, this.guiLeft+138, this.guiTop, 205, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Show Achievements"));
+ this.buttonAchievements = new TexturedButton(7, this.guiLeft+138, this.guiTop, 205, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Show Achievements"));
this.buttonList.add(this.buttonAchievements);
ArrayList websiteHover = new ArrayList();
- websiteHover.add(EnumChatFormatting.GOLD+"Open Author's Website");
+ websiteHover.add(TextFormatting.GOLD+"Open Author's Website");
websiteHover.add("(There's some cool stuff there!)");
- websiteHover.add(EnumChatFormatting.GRAY+""+EnumChatFormatting.ITALIC+"Would you call this Product Placement?");
- this.buttonWebsite = new TexturedButton(-99, this.guiLeft, this.guiTop+20, 228, 0, 8, 8, websiteHover);
+ websiteHover.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+"Would you call this Product Placement?");
+ this.buttonWebsite = new TexturedButton(-99, this.guiLeft, this.guiTop+30, 229, 0, 8, 8, websiteHover);
this.buttonList.add(this.buttonWebsite);
+ List patreonHover = new ArrayList();
+ patreonHover.add("Like the mod?");
+ patreonHover.add("Why don't support me on "+TextFormatting.GOLD+"Patreon"+TextFormatting.RESET+"?");
+ this.buttonPatreon = new TexturedButton(-100, this.guiLeft, this.guiTop, 237, 0, 8, 8, patreonHover);
+ this.buttonList.add(this.buttonPatreon);
+
+ this.buttonViewOnline = new TexturedButton(-101, this.guiLeft+146, this.guiTop+180, 245, 44, 11, 11, Collections.singletonList(TextFormatting.GOLD+"View Online"));
+ this.buttonList.add(this.buttonViewOnline);
+
ArrayList configHover = new ArrayList();
- configHover.add(EnumChatFormatting.GOLD+"Show Configuration GUI");
+ configHover.add(TextFormatting.GOLD+"Show Configuration GUI");
configHover.addAll(this.fontRendererObj.listFormattedStringToWidth("It is highly recommended that you restart your game after changing anything as that prevents possible bugs occuring!", 200));
this.buttonConfig = new TexturedButton(8, this.guiLeft+138, this.guiTop+10, 197, 0, 8, 8, configHover);
this.buttonList.add(this.buttonConfig);
for(int i = 0; i < this.chapterButtons.length; i++){
- this.chapterButtons[i] = new IndexButton(9+i, guiLeft+15, guiTop+10+(i*12), 115, 10, "", this);
+ this.chapterButtons[i] = new IndexButton(9+i, this.guiLeft+15, this.guiTop+10+(i*12), 115, 10, "", this);
this.buttonList.add(this.chapterButtons[i]);
}
for(int i = 0; i < this.bookmarkButtons.length; i++){
- int x = this.guiLeft+xSize/2-(this.bookmarkButtons.length/2*16)+(i*16);
+ int x = this.guiLeft+this.xSize/2-(this.bookmarkButtons.length/2*16)+(i*16);
this.bookmarkButtons[i] = new BookmarkButton(this.chapterButtons[this.chapterButtons.length-1].id+1+i, x, this.guiTop+this.ySize+13, this);
this.buttonList.add(this.bookmarkButtons[i]);
}
- this.searchField = new GuiTextField(4500, this.fontRendererObj, guiLeft+148, guiTop+162, 66, 10);
+ this.searchField = new GuiTextField(4500, this.fontRendererObj, this.guiLeft+148, this.guiTop+162, 66, 10);
this.searchField.setMaxStringLength(30);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField.setCanLoseFocus(false);
@@ -338,14 +387,23 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
if(ItemBooklet.forcedEntry == null){
//Open last entry or introductory entry
- if(this.tryOpenMainPage && !PersistentClientData.getBoolean("BookAlreadyOpened")){
- BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
- BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
+ PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(Minecraft.getMinecraft().thePlayer);
+ if(data != null){
+ if(this.tryOpenMainPage && !data.theCompound.getBoolean("BookAlreadyOpened")){
+ BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
+ BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
- PersistentClientData.setBoolean("BookAlreadyOpened", true);
- }
- else{
- PersistentClientData.openLastBookPage(this);
+ NBTTagCompound extraData = new NBTTagCompound();
+ extraData.setBoolean("BookAlreadyOpened", true);
+ NBTTagCompound dataToSend = new NBTTagCompound();
+ dataToSend.setTag("Data", extraData);
+ dataToSend.setInteger("WorldID", Minecraft.getMinecraft().theWorld.provider.getDimension());
+ dataToSend.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(dataToSend, PacketHandler.CHANGE_PLAYER_DATA_HANDLER));
+ }
+ else{
+ BookletUtils.openLastBookPage(this, data.theCompound.getCompoundTag("BookletData"));
+ }
}
}
else{
@@ -354,6 +412,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
BookletUtils.openChapter(this, ItemBooklet.forcedEntry.chapter, ItemBooklet.forcedEntry.page);
ItemBooklet.forcedEntry = null;
}
+
+ this.shouldSaveDataNextClose = false;
}
@Override
@@ -376,11 +436,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
super.updateScreen();
this.searchField.updateCursorCounter();
- if(this.currentEntrySet.entry != null && this.currentEntrySet.chapter != null && this.currentEntrySet.page != null){
- this.currentEntrySet.page.updateScreen(this.ticksElapsed);
+ if(this.currentEntrySet.getCurrentEntry() != null && this.currentEntrySet.getCurrentChapter() != null && this.currentEntrySet.getCurrentPage() != null){
+ this.currentEntrySet.getCurrentPage().updateScreen(this.ticksElapsed);
}
- boolean buttonThere = UpdateChecker.needsUpdateNotify;
+ boolean buttonThere = UpdateChecker.needsUpdateNotify || UpdateChecker.checkFailed;
this.buttonUpdate.visible = buttonThere;
if(buttonThere){
if(this.ticksElapsed%8 == 0){
@@ -394,8 +454,18 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
@Override
public void onGuiClosed(){
- if(this.saveOnClose){
- PersistentClientData.saveBookPage(this);
+ if(this.saveOnClose && this.shouldSaveDataNextClose){
+ NBTTagCompound bookletData = new NBTTagCompound();
+ BookletUtils.saveBookPage(this, bookletData);
+
+ NBTTagCompound extraData = new NBTTagCompound();
+ extraData.setTag("BookletData", bookletData);
+
+ NBTTagCompound dataToSend = new NBTTagCompound();
+ dataToSend.setTag("Data", extraData);
+ dataToSend.setInteger("WorldID", Minecraft.getMinecraft().theWorld.provider.getDimension());
+ dataToSend.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(dataToSend, PacketHandler.CHANGE_PLAYER_DATA_HANDLER));
}
}
@@ -416,7 +486,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
list.set(k, stack.getRarity().rarityColor+(String)list.get(k));
}
else{
- list.set(k, EnumChatFormatting.GRAY+(String)list.get(k));
+ list.set(k, TextFormatting.GRAY+(String)list.get(k));
}
}
@@ -426,9 +496,9 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
list.add(from.getClickToSeeRecipeString());
if(mousePressed){
- BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
+ BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.BOOKLET_ENTRIES.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
BookletUtils.openChapter(this, page.getChapter(), page);
- Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
+ Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
}
}
@@ -464,7 +534,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
}
@Override
- public EntrySet getCurrentEntrySet(){
+ public IEntrySet getCurrentEntrySet(){
return this.currentEntrySet;
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBookletStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBookletStand.java
new file mode 100644
index 000000000..c5513f546
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBookletStand.java
@@ -0,0 +1,80 @@
+/*
+ * This file ("GuiBookletStand.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.booklet;
+
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
+import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+@SideOnly(Side.CLIENT)
+public class GuiBookletStand extends GuiBooklet{
+
+ private GuiButton buttonSetPage;
+
+ private final TileEntityBookletStand theStand;
+
+ public GuiBookletStand(TileEntityBase theStand){
+ super(null, false, false);
+ this.theStand = (TileEntityBookletStand)theStand;
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button){
+ if(button == this.buttonSetPage){
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.theStand.getPos().getX());
+ compound.setInteger("Y", this.theStand.getPos().getY());
+ compound.setInteger("Z", this.theStand.getPos().getZ());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("WorldID", this.theStand.getWorld().provider.getDimension());
+ compound.setTag("EntrySet", this.currentEntrySet.writeToNBT());
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.BOOKLET_STAND_BUTTON_HANDLER));
+ }
+ super.actionPerformed(button);
+ }
+
+ @Override
+ public void initGui(){
+ super.initGui();
+
+ //Remove Bookmark Buttons
+ for(GuiButton bookmarkButton : this.bookmarkButtons){
+ bookmarkButton.visible = false;
+ }
+
+ this.buttonSetPage = new GuiButton(-100, this.guiLeft+this.xSize+10, this.guiTop+10, 100, 20, "Set Page"){
+ @Override
+ public void drawButton(Minecraft mc, int x, int y){
+ boolean unicodeBefore = mc.fontRendererObj.getUnicodeFlag();
+ mc.fontRendererObj.setUnicodeFlag(false);
+ super.drawButton(mc, x, y);
+ mc.fontRendererObj.setUnicodeFlag(unicodeBefore);
+ }
+ };
+ this.buttonList.add(this.buttonSetPage);
+
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+ if(player != null && player.getName() != null){
+ this.buttonSetPage.visible = player.getName().equalsIgnoreCase(this.theStand.assignedPlayer);
+ }
+
+ //Open the pages the book was assigned
+ BookletUtils.openIndexEntry(this, this.theStand.assignedEntry.entry, this.theStand.assignedEntry.pageInIndex, true);
+ BookletUtils.openChapter(this, this.theStand.assignedEntry.chapter, this.theStand.assignedEntry.page);
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java
index e41d6ebed..c4f02ba6e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java
@@ -1,11 +1,11 @@
/*
- * This file ("InitBooklet.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitBooklet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet;
@@ -25,18 +25,19 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.crafting.*;
import de.ellpeck.actuallyadditions.mod.gen.OreGen;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
-import de.ellpeck.actuallyadditions.mod.items.lens.LensNoneRecipeHandler;
+import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import java.util.ArrayList;
-public class InitBooklet{
+public final class InitBooklet{
public static BookletChapter chapterIntro;
@@ -58,84 +59,97 @@ public class InitBooklet{
private static void initChapters(){
//Getting Started
chapterIntro = new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
+ new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM")).setImportant();
new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
- new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, LensNoneRecipeHandler.mainPageRecipes).setNoText()).setSpecial().setIncomplete();
+ new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.RECIPES_CRYSTALS).setNoText(), new PageCrafting(8, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText(), new PageReconstructor(9, LensRecipeHandler.MAIN_PAGE_RECIPES).setNoText()).setSpecial();
new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard());
new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(7, ItemCrafting.recipeRing).setNoText(), new PageCrafting(8, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(11, ItemCrafting.recipeDough).setNoText(), new PageCrafting(12, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(13, BlockCrafting.recipeIronCase).setNoText()).setImportant();
- new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.redstone), new PageTextOnly(1));
+ new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1));
//Miscellaneous
- new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeColorLens), new PageReconstructor(4, LensNoneRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensNoneRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensNoneRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensNoneRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(8, LensNoneRecipeHandler.recipeNetherWart).setNoText()).setImportant();
- new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensNoneRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeGreenWall).setNoText());
- new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("", OreGen.QUARTZ_MIN).addTextReplacement("", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
- new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial().setIncomplete();
+ new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeColorLens), new PageReconstructor(4, LensRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(8, LensRecipeHandler.recipeNetherWart).setNoText()).setImportant();
+ new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BANNER, 1, 15), new PageTextOnly(1));
+ new BookletChapter("bookStand", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBookletStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeBookStand).setNoText().setPageStacksWildcard());
+ new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText());
+ new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStacks(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("", OreGen.QUARTZ_MIN).addTextReplacement("", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
+ new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial();
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
ArrayList lampPages = new ArrayList();
lampPages.add(new PageTextOnly(lampPages.size()+1));
lampPages.add(new PageCrafting(lampPages.size()+1, BlockCrafting.recipePowerer).setNoText());
- for(IRecipe recipe : BlockCrafting.recipesLamps){
+ for(IRecipe recipe : BlockCrafting.RECIPES_LAMPS){
lampPages.add(new PageCrafting(lampPages.size()+1, recipe).setNoText());
}
new BookletChapter("lamps", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockColoredLampOn, 1, TheColoredLampColors.GREEN.ordinal()), lampPages.toArray(new BookletPage[lampPages.size()]));
+ new BookletChapter("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal()), new PageCrafting(1, ItemCrafting.recipeEnderStar));
+ new BookletChapter("spawnerShard", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal())));
- new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest), new PagePicture(1, "pageTreasureChest", 150).setStack(new ItemStack(InitBlocks.blockTreasureChest)), new PageTextOnly(2)).setSpecial();
- new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemHairyBall), new PagePicture(1, "pageFurBalls", 110).setStack(new ItemStack(InitItems.itemHairyBall)), new PageTextOnly(2)).setSpecial();
- new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockBlackLotus)), new PageCrafting(2, ItemCrafting.recipeBlackDye));
+ new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest), new PagePicture(1, "pageTreasureChest", 150).setStacks(new ItemStack(InitBlocks.blockTreasureChest)), new PageTextOnly(2)).setSpecial();
+ new BookletChapter("lushCaves", ActuallyAdditionsAPI.entryMisc, new ItemStack(Blocks.STONE), new PageTextOnly(1), new PagePicture(2, "pageLushCaves", 0).setNoText());
+ new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemHairyBall), new PagePicture(1, "pageFurBalls", 110).setStacks(new ItemStack(InitItems.itemHairyBall)), new PageTextOnly(2)).setSpecial();
+ new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus), new PageTextOnly(1).setStacks(new ItemStack(InitBlocks.blockBlackLotus)), new PageCrafting(2, ItemCrafting.recipeBlackDye));
+ new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemWaterBowl), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemWaterBowl)));
//No RF Using Blocks
+ new BookletChapter("itemStorage", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockLaserRelayItemWhitelist), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeLaserRelayItem).setNoText().setPageStacksWildcard(), new PageCrafting(4, BlockCrafting.recipeLaserRelayItemWhitelist).setNoText().setPageStacksWildcard(), new PageCrafting(5, BlockCrafting.recipeItemInterface).setNoText()).setImportant();
new BookletChapter("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockBreaker), new PageCrafting(1, BlockCrafting.recipeBreaker).setPageStacksWildcard(), new PageCrafting(2, BlockCrafting.recipePlacer).setPageStacksWildcard(), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer).setPageStacksWildcard(), new PageCrafting(4, BlockCrafting.recipeLiquidCollector).setPageStacksWildcard());
new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockDropper), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText());
new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomLiquiface), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomface.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant();
+ new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomRedstoneface), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText());
new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText());
- new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial().setIncomplete();
- new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setSpecial().setIncomplete();
+ new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
+ new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setSpecial();
new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText());
new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFeeder), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText());
- new BookletChapter("compost", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemFertilizer)).addTextReplacement("", TileEntityCompost.AMOUNT), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.recipesMashedFood)).setIncomplete();
- new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, ItemCrafting.recipeCrateKeeper), new PageCrafting(3, ItemCrafting.recipeChestToCrateUpgrade));
+ new BookletChapter("compost", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemFertilizer)), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.RECIPES_MASHED_FOOD));
+ new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, BlockCrafting.recipeCrateMedium).setNoText(), new PageCrafting(3, BlockCrafting.recipeCrateLarge).setNoText(), new PageCrafting(4, ItemCrafting.recipeCrateKeeper), new PageCrafting(5, ItemCrafting.recipeChestToCrateUpgrade));
new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockRangedCollector), new PageTextOnly(1).addTextReplacement("", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText());
//RF Using Blocks
new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFireworkBox), new PageTextOnly(1).addTextReplacement("", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial();
- new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLaserRelay), new PageTextOnly(1).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("", ConfigIntValues.LASER_RELAY_LOSS.getValue()), new PagePicture(2, "pageLaserRelay", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLaserRelay).setNoText().setPageStacksWildcard(), new PageCrafting(4, ItemCrafting.recipeLaserWrench).setNoText()).setImportant();
+ new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLaserRelay), new PageTextOnly(1).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("", ConfigIntValues.LASER_RELAY_LOSS.getValue()), new PagePicture(2, "pageLaserRelay", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLaserRelay).setNoText().setPageStacksWildcard(), new PageCrafting(4, ItemCrafting.recipeLaserWrench)).setImportant();
new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("", TileEntityMiner.ENERGY_USE_PER_BLOCK).addTextReplacement("", TileEntityMiner.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial();
- new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "pageCoffeeMachine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setNoText().setPageStacksWildcard(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
- new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("", TileEntityGrinder.getEnergyUse(false)).addTextReplacement("", TileEntityGrinder.getEnergyUse(true)), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText().setPageStacksWildcard(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText().setPageStacksWildcard(), new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
+ new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).setStacks(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "pageCoffeeMachine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setNoText().setPageStacksWildcard(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
+ new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("", TileEntityGrinder.ENERGY_USE), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText().setPageStacksWildcard(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText().setPageStacksWildcard(), new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).addTextReplacement("", TileEntityFurnaceDouble.ENERGY_USE).setPageStacksWildcard());
new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("", TileEntityLavaFactoryController.ENERGY_USE), new PagePicture(2, "pageLavaFactory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText());
new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator));
new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("", TileEntityItemRepairer.ENERGY_USE));
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setPageStacksWildcard());
+ new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockPlayerInterface), new PageTextOnly(1).addTextReplacement("", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
+ new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDisplayStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
//RF Generating Blocks
new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText());
- new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addTextReplacement("", TileEntityCanolaPress.ENERGY_USE).addTextReplacement("", TileEntityCanolaPress.PRODUCE).addTextReplacement("", TileEntityOilGenerator.ENERGY_PRODUCED), new PageCrafting(2, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(3, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(4, BlockCrafting.recipeOilGen).setNoText().setPageStacksWildcard());
+ new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addTextReplacement("", TileEntityCanolaPress.ENERGY_USE).addTextReplacement("", TileEntityCanolaPress.PRODUCE).addTextReplacement("", TileEntityOilGenerator.ENERGY_PRODUCED), new PageTextOnly(2).setStacks(new ItemStack(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOCOAL.ordinal())), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(4, BlockCrafting.recipeOilGen).setNoText().setPageStacksWildcard());
new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant();
//No RF Using Items
- new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial();
+ new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial();
new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText());
new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant();
ArrayList aiotPages = new ArrayList();
aiotPages.add(new PageTextOnly(aiotPages.size()+1));
- for(IRecipe recipe : ToolCrafting.recipesPaxels){
+ for(IRecipe recipe : ToolCrafting.RECIPES_PAXELS){
aiotPages.add(new PageCrafting(aiotPages.size()+1, recipe).setNoText().setPageStacksWildcard());
}
new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant();
- new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "pageJamHouse", 150), new PageTextOnly(3)).setIncomplete();
+ new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "pageJamHouse", 150), new PageTextOnly(3));
ArrayList potionRingPages = new ArrayList();
potionRingPages.add(new PageTextOnly(potionRingPages.size()+1));
- for(IRecipe recipe : ItemCrafting.recipesPotionRings){
+ for(IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS){
potionRingPages.add(new PageCrafting(potionRingPages.size()+1, recipe).setNoText());
}
new BookletChapter("potionRings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemPotionRing), potionRingPages.toArray(new BookletPage[potionRingPages.size()]));
+ new BookletChapter("spawnerChanger", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemSpawnerChanger), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeSpawnerChanger).setNoText());
+ new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitItems.itemFilter), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant();
//RF Using Items
- new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(3, ItemCrafting.recipesDrillColoring), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial();
+ new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(3, ItemCrafting.RECIPES_DRILL_COLORING), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial();
new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant();
new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing));
new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing));
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java
index 8107e6119..9bee05685 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java
@@ -1,35 +1,37 @@
/*
- * This file ("BookmarkButton.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookmarkButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
-import de.ellpeck.actuallyadditions.api.internal.EntrySet;
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
+import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
-import de.ellpeck.actuallyadditions.mod.util.KeyUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
+@SideOnly(Side.CLIENT)
public class BookmarkButton extends GuiButton{
+ private final GuiBooklet booklet;
public EntrySet assignedEntry = new EntrySet(null);
- private GuiBooklet booklet;
-
public BookmarkButton(int id, int x, int y, GuiBooklet booklet){
super(id, x, y, 16, 16, "");
this.booklet = booklet;
@@ -37,8 +39,9 @@ public class BookmarkButton extends GuiButton{
public void onPressed(){
if(this.assignedEntry.entry != null){
- if(KeyUtil.isShiftPressed()){
+ if(GuiScreen.isShiftKeyDown()){
this.assignedEntry.removeEntry();
+ this.booklet.shouldSaveDataNextClose = true;
}
else{
BookletUtils.openIndexEntry(this.booklet, this.assignedEntry.entry, this.assignedEntry.pageInIndex, true);
@@ -46,8 +49,9 @@ public class BookmarkButton extends GuiButton{
}
}
else{
- if(this.booklet.currentEntrySet.entry != null){
- this.assignedEntry.setEntry(this.booklet.currentEntrySet.page, this.booklet.currentEntrySet.chapter, this.booklet.currentEntrySet.entry, this.booklet.currentEntrySet.pageInIndex);
+ if(this.booklet.currentEntrySet.getCurrentEntry() != null){
+ this.assignedEntry.setEntry(this.booklet.currentEntrySet.getCurrentPage(), this.booklet.currentEntrySet.getCurrentChapter(), this.booklet.currentEntrySet.getCurrentEntry(), this.booklet.currentEntrySet.getPageInIndex());
+ this.booklet.shouldSaveDataNextClose = true;
}
}
}
@@ -55,7 +59,7 @@ public class BookmarkButton extends GuiButton{
@Override
public void drawButton(Minecraft minecraft, int x, int y){
if(this.visible){
- minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
+ minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
int k = this.getHoverState(this.hovered);
@@ -78,21 +82,20 @@ public class BookmarkButton extends GuiButton{
}
}
- @SuppressWarnings("unchecked")
public void drawHover(int mouseX, int mouseY){
ArrayList list = new ArrayList();
if(this.assignedEntry.entry != null){
if(this.assignedEntry.chapter != null){
- list.add(EnumChatFormatting.GOLD+this.assignedEntry.chapter.getLocalizedName()+", Page "+this.assignedEntry.page.getID());
+ list.add(TextFormatting.GOLD+this.assignedEntry.chapter.getLocalizedName()+", Page "+this.assignedEntry.page.getID());
}
else{
- list.add(EnumChatFormatting.GOLD+this.assignedEntry.entry.getLocalizedName()+", Page "+this.assignedEntry.pageInIndex);
+ list.add(TextFormatting.GOLD+this.assignedEntry.entry.getLocalizedName()+", Page "+this.assignedEntry.pageInIndex);
}
list.add("Click to open");
- list.add(EnumChatFormatting.ITALIC+"Shift-Click to remove");
+ list.add(TextFormatting.ITALIC+"Shift-Click to remove");
}
else{
- list.add(EnumChatFormatting.GOLD+"None");
+ list.add(TextFormatting.GOLD+"None");
list.add("Click to save current page");
}
this.booklet.drawHoveringText(list, mouseX, mouseY);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java
index 8107169ab..17776e210 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java
@@ -1,30 +1,29 @@
/*
- * This file ("IndexButton.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("IndexButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
-import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+@SideOnly(Side.CLIENT)
public class IndexButton extends GuiButton{
+ private final GuiBooklet gui;
public IBookletChapter chap;
- private GuiBooklet gui;
public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){
super(id, x, y, width, height, text);
@@ -60,10 +59,4 @@ public class IndexButton extends GuiButton{
this.gui.getFontRenderer().drawString(this.displayString, this.xPosition+textOffsetX, this.yPosition+(this.height-8)/2, 0);
}
}
-
- public void drawHover(int mouseX, int mouseY){
- if(this.chap instanceof BookletChapter && ((BookletChapter)this.chap).isIncomplete){
- this.gui.drawHoveringText(this.gui.getFontRenderer().listFormattedStringToWidth(EnumChatFormatting.RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".unavailable"), 250), mouseX, mouseY);
- }
- }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TexturedButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TexturedButton.java
index b185df808..d106deb9e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TexturedButton.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TexturedButton.java
@@ -1,11 +1,11 @@
/*
- * This file ("TexturedButton.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("TexturedButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
@@ -14,22 +14,23 @@ import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
+@SideOnly(Side.CLIENT)
public class TexturedButton extends GuiButton{
+ public final List textList = new ArrayList();
public int texturePosX;
public int texturePosY;
- public List textList = new ArrayList();
-
public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height){
this(id, x, y, texturePosX, texturePosY, width, height, new ArrayList());
}
- @SuppressWarnings("unchecked")
public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height, List hoverTextList){
super(id, x, y, width, height, "");
this.texturePosX = texturePosX;
@@ -45,7 +46,7 @@ public class TexturedButton extends GuiButton{
@Override
public void drawButton(Minecraft minecraft, int x, int y){
if(this.visible){
- minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
+ minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
int k = this.getHoverState(this.hovered);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java
index 3eb2144af..306b8d6ab 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletChapter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletChapter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
@@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
public class BookletChapter implements IBookletChapter{
@@ -25,9 +25,7 @@ public class BookletChapter implements IBookletChapter{
public final IBookletEntry entry;
public final ItemStack displayStack;
private final String unlocalizedName;
- public EnumChatFormatting color;
-
- public boolean isIncomplete;
+ public TextFormatting color;
public BookletChapter(String unlocalizedName, IBookletEntry entry, ItemStack displayStack, BookletPage... pages){
this.pages = pages.clone();
@@ -42,7 +40,7 @@ public class BookletChapter implements IBookletChapter{
page.setChapter(this);
}
- this.color = EnumChatFormatting.RESET;
+ this.color = TextFormatting.RESET;
}
@Override
@@ -57,7 +55,7 @@ public class BookletChapter implements IBookletChapter{
@Override
public String getLocalizedName(){
- return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.unlocalizedName+".name");
+ return StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.unlocalizedName+".name");
}
@Override
@@ -75,18 +73,11 @@ public class BookletChapter implements IBookletChapter{
return this.displayStack;
}
- public BookletChapter setIncomplete(){
- this.isIncomplete = true;
- return this;
+ public void setImportant(){
+ this.color = TextFormatting.DARK_GREEN;
}
- public BookletChapter setImportant(){
- this.color = EnumChatFormatting.DARK_GREEN;
- return this;
- }
-
- public BookletChapter setSpecial(){
- this.color = EnumChatFormatting.DARK_PURPLE;
- return this;
+ public void setSpecial(){
+ this.color = TextFormatting.DARK_PURPLE;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java
index 9a04df28a..a48b5464e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCoffee.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletChapterCoffee.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
@@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
-import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
+import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPageAA;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeRecipe;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
@@ -28,12 +28,11 @@ public class BookletChapterCoffee extends BookletChapter{
super(unlocalizedName, entry, displayStack, getPages(pages));
}
- @SuppressWarnings("unchecked")
private static BookletPage[] getPages(BookletPage... pages){
ArrayList allPages = new ArrayList();
allPages.addAll(Arrays.asList(pages));
- for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.coffeeMachineIngredients){
+ for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
BookletPageAA page = new PageCoffeeRecipe(allPages.size()+1, ingredient);
if(!(ingredient instanceof ItemCoffee.MilkIngredient)){
page.setNoText();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java
index 8631d823f..8307d6262 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterCrusher.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletChapterCrusher.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletChapterCrusher.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
@@ -26,12 +26,11 @@ public class BookletChapterCrusher extends BookletChapter{
super(unlocalizedName, entry, displayStack, getPages(pages));
}
- @SuppressWarnings("unchecked")
private static BookletPage[] getPages(BookletPage... pages){
ArrayList allPages = new ArrayList();
allPages.addAll(Arrays.asList(pages));
- for(CrusherRecipe recipe : CrusherCrafting.miscRecipes){
+ for(CrusherRecipe recipe : CrusherCrafting.MISC_RECIPES){
allPages.add(new PageCrusherRecipe(allPages.size()+1, recipe).setNoText());
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java
index 74011bbc3..a1d7902bd 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletEntry.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletEntry.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.entry;
@@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import java.util.List;
@@ -24,13 +24,13 @@ public class BookletEntry implements IBookletEntry{
private final String unlocalizedName;
public List chapters = new ArrayList();
- private EnumChatFormatting color;
+ private TextFormatting color;
public BookletEntry(String unlocalizedName){
this.unlocalizedName = unlocalizedName;
ActuallyAdditionsAPI.addBookletEntry(this);
- this.color = EnumChatFormatting.RESET;
+ this.color = TextFormatting.RESET;
}
@Override
@@ -50,7 +50,7 @@ public class BookletEntry implements IBookletEntry{
@Override
public String getLocalizedName(){
- return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".indexEntry."+this.unlocalizedName+".name");
+ return StringUtil.localize("booklet."+ModUtil.MOD_ID+".indexEntry."+this.unlocalizedName+".name");
}
@Override
@@ -64,12 +64,12 @@ public class BookletEntry implements IBookletEntry{
}
public BookletEntry setImportant(){
- this.color = EnumChatFormatting.DARK_GREEN;
+ this.color = TextFormatting.DARK_GREEN;
return this;
}
public BookletEntry setSpecial(){
- this.color = EnumChatFormatting.DARK_PURPLE;
+ this.color = TextFormatting.DARK_PURPLE;
return this;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java
index 52599f884..cfcd4a0e1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletEntryAllSearch.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletEntryAllSearch.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.entry;
@@ -29,7 +29,6 @@ public class BookletEntryAllSearch extends BookletEntry{
this.chapters = (ArrayList)this.allChapters.clone();
}
- @SuppressWarnings("unchecked")
@Override
public void addChapter(IBookletChapter chapter){
this.allChapters.add(chapter);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/EntrySet.java
similarity index 61%
rename from src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java
rename to src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/EntrySet.java
index fb67d6e6f..1c47892fa 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/EntrySet.java
@@ -1,22 +1,23 @@
/*
- * This file ("EntrySet.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("EntrySet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
-package de.ellpeck.actuallyadditions.api.internal;
+package de.ellpeck.actuallyadditions.mod.booklet.entry;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
+import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
import net.minecraft.nbt.NBTTagCompound;
-public class EntrySet{
+public class EntrySet implements IEntrySet{
public BookletPage page;
public IBookletChapter chapter;
@@ -38,7 +39,7 @@ public class EntrySet{
int chapter = compound.getInteger("Chapter");
int page = compound.getInteger("Page");
- IBookletEntry currentEntry = entry == -1 ? null : ActuallyAdditionsAPI.bookletEntries.get(entry);
+ IBookletEntry currentEntry = entry == -1 ? null : ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(entry);
IBookletChapter currentChapter = chapter == -1 || entry == -1 || currentEntry.getChapters().size() <= chapter ? null : currentEntry.getChapters().get(chapter);
BookletPage currentPage = chapter == -1 || currentChapter == null || currentChapter.getPages().length <= page-1 ? null : currentChapter.getPages()[page-1];
int pageInIndex = compound.getInteger("PageInIndex");
@@ -49,6 +50,7 @@ public class EntrySet{
return new EntrySet(null);
}
+ @Override
public void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex){
this.page = page;
this.chapter = chapter;
@@ -56,16 +58,58 @@ public class EntrySet{
this.pageInIndex = pageInIndex;
}
+ @Override
public void removeEntry(){
this.setEntry(null, null, null, 1);
}
+ @Override
public NBTTagCompound writeToNBT(){
NBTTagCompound compound = new NBTTagCompound();
- compound.setInteger("Entry", entry == null ? -1 : ActuallyAdditionsAPI.bookletEntries.indexOf(entry));
- compound.setInteger("Chapter", entry == null || chapter == null ? -1 : entry.getChapters().indexOf(chapter));
- compound.setInteger("Page", page == null ? -1 : page.getID());
- compound.setInteger("PageInIndex", pageInIndex);
+ compound.setInteger("Entry", this.entry == null ? -1 : ActuallyAdditionsAPI.BOOKLET_ENTRIES.indexOf(this.entry));
+ compound.setInteger("Chapter", this.entry == null || this.chapter == null ? -1 : this.entry.getChapters().indexOf(this.chapter));
+ compound.setInteger("Page", this.page == null ? -1 : this.page.getID());
+ compound.setInteger("PageInIndex", this.pageInIndex);
return compound;
}
+
+ @Override
+ public BookletPage getCurrentPage(){
+ return this.page;
+ }
+
+ @Override
+ public IBookletEntry getCurrentEntry(){
+ return this.entry;
+ }
+
+ @Override
+ public IBookletChapter getCurrentChapter(){
+ return this.chapter;
+ }
+
+ @Override
+ public int getPageInIndex(){
+ return this.pageInIndex;
+ }
+
+ @Override
+ public void setPage(BookletPage page){
+ this.page = page;
+ }
+
+ @Override
+ public void setEntry(IBookletEntry entry){
+ this.entry = entry;
+ }
+
+ @Override
+ public void setChapter(IBookletChapter chapter){
+ this.chapter = chapter;
+ }
+
+ @Override
+ public void setPageInIndex(int page){
+ this.pageInIndex = page;
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java
index 4eef6f123..6d32993e1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java
@@ -1,11 +1,11 @@
/*
- * This file ("BookletPage.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BookletPageAA.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
@@ -17,15 +17,15 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import java.util.HashMap;
import java.util.Map;
public class BookletPageAA extends BookletPage{
- protected int localizationKey;
- private HashMap textReplacements = new HashMap();
+ protected final int localizationKey;
+ private final HashMap textReplacements = new HashMap();
private boolean hasNoText;
public BookletPageAA(int localizationKey){
@@ -43,13 +43,13 @@ public class BookletPageAA extends BookletPage{
return null;
}
- String base = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.localizationKey);
- base = base.replaceAll("", EnumChatFormatting.DARK_GREEN+"");
- base = base.replaceAll("- ", EnumChatFormatting.BLUE+"");
- base = base.replaceAll("", EnumChatFormatting.BLACK+"");
+ String base = StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.localizationKey);
+ base = base.replaceAll("", TextFormatting.DARK_GREEN+"");
+ base = base.replaceAll("
- ", TextFormatting.BLUE+"");
+ base = base.replaceAll("", TextFormatting.BLACK+"");
base = base.replaceAll("", "\n");
- base = base.replaceAll("", EnumChatFormatting.ITALIC+"");
- base = base.replaceAll("", EnumChatFormatting.DARK_RED+""+EnumChatFormatting.UNDERLINE); //This is fucking important so go read it now
+ base = base.replaceAll("", TextFormatting.ITALIC+"");
+ base = base.replaceAll("", TextFormatting.DARK_RED+""+TextFormatting.UNDERLINE); //This is fucking important so go read it now
for(Object o : this.textReplacements.entrySet()){
Map.Entry e = (Map.Entry)o;
@@ -80,7 +80,7 @@ public class BookletPageAA extends BookletPage{
@Override
public String getClickToSeeRecipeString(){
- return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe");
+ return TextFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID+".clickToSeeRecipe");
}
public BookletPage setNoText(){
@@ -98,7 +98,7 @@ public class BookletPageAA extends BookletPage{
}
public void addToPagesWithItemStackData(){
- if(!ActuallyAdditionsAPI.bookletPagesWithItemStackData.contains(this)){
+ if(!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_DATA.contains(this)){
ItemStack[] stacks = this.getItemStacksForPage();
if(stacks != null && stacks.length > 0){
//Ensure that there is at least one ItemStack
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageButton.java
new file mode 100644
index 000000000..a30b06d7f
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageButton.java
@@ -0,0 +1,46 @@
+/*
+ * This file ("PageButton.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.booklet.page;
+
+import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+
+public abstract class PageButton extends PageTextOnly{
+
+ private GuiButton button;
+
+ public PageButton(int id){
+ super(id);
+ }
+
+ @Override
+ public void onOpened(IBookletGui gui){
+ String text = StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.chapter.getUnlocalizedName()+".page."+this.localizationKey+".button");
+ int width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(text);
+ this.button = new GuiButton(-1239, gui.getGuiLeft()+gui.getXSize()/2-width/2-8, gui.getGuiTop()+gui.getYSize()-40, width+15, 20, text);
+ gui.getButtonList().add(this.button);
+ }
+
+ @Override
+ public void onClosed(IBookletGui gui){
+ gui.getButtonList().remove(this.button);
+ }
+
+ @Override
+ public boolean onActionPerformed(IBookletGui gui, GuiButton button){
+ return button == this.button && this.onAction();
+ }
+
+ public abstract boolean onAction();
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeRecipe.java
index a1c4fed7f..02aaaff39 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeRecipe.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeRecipe.java
@@ -1,18 +1,18 @@
/*
- * This file ("PageCoffeeRecipe.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PageCoffeeRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
-import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing;
-import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
+import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
@@ -27,7 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class PageCoffeeRecipe extends BookletPageAA{
- public CoffeeIngredient ingredient;
+ public final CoffeeIngredient ingredient;
public PageCoffeeRecipe(int id, CoffeeIngredient ingredient){
super(id);
@@ -37,18 +37,17 @@ public class PageCoffeeRecipe extends BookletPageAA{
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
- Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.RES_LOC_VALENTINE : GuiBooklet.RES_LOC);
gui.drawRect(gui.getGuiLeft()+19, gui.getGuiTop()+20, 146, 94, 99, 60);
}
- @SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
String strg = "Coffee Machine Recipe";
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
}
@@ -76,7 +75,7 @@ public class PageCoffeeRecipe extends BookletPageAA{
break;
case 2:
stack = new ItemStack(InitItems.itemCoffee);
- CoffeeBrewing.addEffectToStack(stack, this.ingredient);
+ ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this.ingredient);
coordsOffsetX = 39;
coordsOffsetY = 39;
break;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java
index 3f512c03f..59227005f 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("PageCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PageCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
@@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -52,26 +52,25 @@ public class PageCrafting extends BookletPageAA{
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
- Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.RES_LOC_VALENTINE : GuiBooklet.RES_LOC);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
}
- @SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
IRecipe recipe = this.recipes[this.recipePos];
if(recipe == null){
- StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
+ StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
}
else{
- String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe"))));
+ String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe"))));
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
}
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+90, 115, 0, false);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java
index 288d874f9..b2e9df9fd 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java
@@ -1,11 +1,11 @@
/*
- * This file ("PageCrusherRecipe.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PageCrusherRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
@@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -29,7 +29,7 @@ import java.util.List;
public class PageCrusherRecipe extends BookletPageAA{
- public CrusherRecipe recipe;
+ public final CrusherRecipe recipe;
private int recipePos;
@@ -42,35 +42,34 @@ public class PageCrusherRecipe extends BookletPageAA{
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
- if(recipe != null){
- Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
+ if(this.recipe != null){
+ Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.RES_LOC_VALENTINE : GuiBooklet.RES_LOC);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 60, 180, 60, 60);
}
}
- @SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
- if(recipe == null){
- StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
+ if(this.recipe == null){
+ StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
}
else{
String strg = "Crusher Recipe";
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
}
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
}
- if(recipe != null){
- if(recipe.outputTwoChance > 0){
- Minecraft.getMinecraft().fontRendererObj.drawString(recipe.outputTwoChance+"%", gui.getGuiLeft()+37+62, gui.getGuiTop()+20+33, 0);
+ if(this.recipe != null){
+ if(this.recipe.outputTwoChance > 0){
+ Minecraft.getMinecraft().fontRendererObj.drawString(this.recipe.outputTwoChance+"%", gui.getGuiLeft()+37+62, gui.getGuiTop()+20+33, 0);
}
- if(recipe.getRecipeOutputOnes() != null){
+ if(this.recipe.getRecipeOutputOnes() != null){
for(int i = 0; i < 2; i++){
for(int j = 0; j < 3; j++){
ItemStack stack;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java
index f8cde97b0..e2c1779ac 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java
@@ -1,11 +1,11 @@
/*
- * This file ("PageFurnace.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PageFurnace.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
@@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -46,25 +46,24 @@ public class PageFurnace extends BookletPageAA{
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
- Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.RES_LOC_VALENTINE : GuiBooklet.RES_LOC);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
}
- @SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
if(input == null){
- StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
+ StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
}
else{
String strg = "Furnace Recipe";
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
}
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java
new file mode 100644
index 000000000..158d6ce7f
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java
@@ -0,0 +1,29 @@
+/*
+ * This file ("PageYoutubeButton.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.booklet.page;
+
+import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
+
+public class PageLinkButton extends PageButton{
+
+ private final String link;
+
+ public PageLinkButton(int id, String link){
+ super(id);
+ this.link = link;
+ }
+
+ @Override
+ public boolean onAction(){
+ BookletUtils.openBrowser(this.link);
+ return true;
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java
index 5d8aa51a2..05cbe904b 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java
@@ -1,11 +1,11 @@
/*
- * This file ("PagePicture.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
@@ -20,8 +20,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class PagePicture extends PageTextOnly{
- private ResourceLocation resLoc;
- private int textStartY;
+ private final ResourceLocation resLoc;
+ private final int textStartY;
public PagePicture(int id, String resLocName, int textStartY){
super(id);
@@ -35,9 +35,9 @@ public class PagePicture extends PageTextOnly{
Minecraft.getMinecraft().getTextureManager().bindTexture(this.resLoc);
gui.drawRect(gui.getGuiLeft(), gui.getGuiTop(), 0, 0, gui.getXSize(), gui.getYSize());
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
- StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+textStartY, 115, 0, false);
+ StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+this.textStartY, 115, 0, false);
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java
index d74c04856..5dafb1c49 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java
@@ -1,17 +1,17 @@
/*
- * This file ("PageReconstructor.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PageReconstructor.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
-import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
+import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
@@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -30,14 +30,14 @@ import java.util.List;
public class PageReconstructor extends BookletPageAA{
- private LensNoneRecipe[] recipes;
+ private final LensConversionRecipe[] recipes;
private int recipePos;
- public PageReconstructor(int id, ArrayList recipes){
- this(id, recipes.toArray(new LensNoneRecipe[recipes.size()]));
+ public PageReconstructor(int id, ArrayList recipes){
+ this(id, recipes.toArray(new LensConversionRecipe[recipes.size()]));
}
- public PageReconstructor(int id, LensNoneRecipe... recipes){
+ public PageReconstructor(int id, LensConversionRecipe... recipes){
super(id);
this.recipes = recipes;
this.addToPagesWithItemStackData();
@@ -47,25 +47,24 @@ public class PageReconstructor extends BookletPageAA{
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
- Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.RES_LOC_VALENTINE : GuiBooklet.RES_LOC);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 188, 154, 60, 60);
}
}
- @SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
- LensNoneRecipe recipe = this.recipes[this.recipePos];
+ LensConversionRecipe recipe = this.recipes[this.recipePos];
if(recipe == null){
- StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
+ StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
}
else{
String strg = "Atomic Reconstructor";
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
}
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
}
@@ -116,7 +115,7 @@ public class PageReconstructor extends BookletPageAA{
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ArrayList stacks = new ArrayList();
- for(LensNoneRecipe recipe : this.recipes){
+ for(LensConversionRecipe recipe : this.recipes){
if(recipe != null){
stacks.addAll(recipe.getOutputs());
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java
index 8ebdfa28c..05133f9f6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java
@@ -1,11 +1,11 @@
/*
- * This file ("PageTextOnly.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
@@ -19,14 +19,14 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class PageTextOnly extends BookletPageAA{
- private ItemStack stack;
+ private ItemStack[] stacks;
public PageTextOnly(int id){
super(id);
}
- public PageTextOnly setStack(ItemStack stack){
- this.stack = stack;
+ public PageTextOnly setStacks(ItemStack... stacks){
+ this.stacks = stacks;
this.addToPagesWithItemStackData();
return this;
}
@@ -34,7 +34,7 @@ public class PageTextOnly extends BookletPageAA{
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
- String text = gui.getCurrentEntrySet().page.getText();
+ String text = gui.getCurrentEntrySet().getCurrentPage().getText();
if(text != null && !text.isEmpty()){
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
}
@@ -42,6 +42,6 @@ public class PageTextOnly extends BookletPageAA{
@Override
public ItemStack[] getItemStacksForPage(){
- return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
+ return this.stacks == null ? new ItemStack[0] : this.stacks;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java
index 54c76569e..c55ac2dce 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java
@@ -1,18 +1,20 @@
/*
- * This file ("ConfigCategories.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ConfigCategories.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config;
+import java.util.Locale;
+
public enum ConfigCategories{
- PERFORMANCE("PERFORMANCE", "Performance Settings"),
+ PERFORMANCE("Performance", "Performance Settings"),
FOOD_CRAFTING("Food Crafting", "Crafting Recipes for Food Items"),
BLOCKS_CRAFTING("Block Crafting", "Crafting Recipes for Blocks"),
ITEMS_CRAFTING("Item Crafting", "Crafting Recipes for Items"),
@@ -21,14 +23,13 @@ public enum ConfigCategories{
MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"),
WORLD_GEN("World Gen", "Everything regarding World Generation"),
POTION_RING_CRAFTING("Ring Crafting", "Crafting Recipes for Rings"),
- FLUIDS("Fluids", "Everything regarding fluids"),
OTHER("Other", "Everything else");
public final String name;
public final String comment;
ConfigCategories(String name, String comment){
- this.name = name;
+ this.name = name.toLowerCase(Locale.ROOT);
this.comment = comment;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java
index 36608a319..070f7552b 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java
@@ -1,65 +1,41 @@
/*
- * This file ("ConfigValues.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ConfigValues.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
+import de.ellpeck.actuallyadditions.mod.config.values.*;
import net.minecraftforge.common.config.Configuration;
-public class ConfigValues{
-
- public static ConfigCrafting[] craftingConfig = ConfigCrafting.values();
- public static ConfigIntValues[] intConfig = ConfigIntValues.values();
- public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values();
-
- public static String[] crusherRecipeExceptions;
- public static String[] mashedFoodCraftingExceptions;
-
- public static String[] paxelExtraMiningWhitelist;
- public static String[] drillExtraminingWhitelist;
-
- public static int[] oreGenDimensionBlacklist;
- public static int[] plantDimensionBlacklist;
-
- public static String[] minerExtraWhitelist;
- public static String[] minerBlacklist;
-
- public static boolean lessSound;
- public static boolean lessParticles;
- public static boolean lessBlockBreakingEffects;
+public final class ConfigValues{
public static void defineConfigValues(Configuration config){
- for(ConfigCrafting currConf : craftingConfig){
+ for(ConfigCrafting currConf : ConfigCrafting.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, "If the Recipe for the "+currConf.name+" is Enabled").getBoolean();
}
- for(ConfigIntValues currConf : intConfig){
+
+ for(ConfigIntValues currConf : ConfigIntValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
}
- for(ConfigBoolValues currConf : boolConfig){
+
+ for(ConfigBoolValues currConf : ConfigBoolValues.values()){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean();
}
- crusherRecipeExceptions = config.get(ConfigCategories.OTHER.name, "Crusher Recipe Exceptions", new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only.").getStringList();
- mashedFoodCraftingExceptions = config.get(ConfigCategories.ITEMS_CRAFTING.name, "Mashed Food Crafting Exceptions", new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.").getStringList();
- paxelExtraMiningWhitelist = config.get(ConfigCategories.TOOL_VALUES.name, "AIOT Extra Whitelist", new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.").getStringList();
- drillExtraminingWhitelist = config.get(ConfigCategories.TOOL_VALUES.name, "Drill Extra Whitelist", new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.").getStringList();
- oreGenDimensionBlacklist = config.get(ConfigCategories.WORLD_GEN.name, "OreGen Dimension Blacklist", new int[0], "The IDs of the dimensions that Actually Additions OreGen (Black Quartz for example) is banned in").getIntList();
- plantDimensionBlacklist = config.get(ConfigCategories.WORLD_GEN.name, "Plant Blacklist", new int[0], "The IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in").getIntList();
- minerExtraWhitelist = config.get(ConfigCategories.MACHINE_VALUES.name, "Vertical Digger Extra Whitelist", new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option only applies if the miner is in Ores Only Mode.").getStringList();
- minerBlacklist = config.get(ConfigCategories.MACHINE_VALUES.name, "Vertical Digger Blacklist", new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can mine, but shouldn't be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option will apply in both modes.").getStringList();
+ for(ConfigIntListValues currConf : ConfigIntListValues.values()){
+ currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getIntList();
+ }
+
+ for(ConfigStringListValues currConf : ConfigStringListValues.values()){
+ currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getStringList();
+ }
- lessSound = config.get(ConfigCategories.PERFORMANCE.name, "Less Sound", false, "If blocks in Actually Additions should have less sounds").getBoolean();
- lessParticles = config.get(ConfigCategories.PERFORMANCE.name, "Less Particles", false, "If blocks in Actually Additions should have less particles").getBoolean();
- lessBlockBreakingEffects = config.get(ConfigCategories.PERFORMANCE.name, "Less Block Breaking Effects", false, "If there should not be a sound effect and particles when a block is being destroyed by a breaker or similar").getBoolean();
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigurationHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigurationHandler.java
index d05064a5f..2a7ee7047 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigurationHandler.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigurationHandler.java
@@ -1,17 +1,18 @@
/*
- * This file ("ConfigurationHandler.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ConfigurationHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -20,22 +21,20 @@ import java.io.File;
public class ConfigurationHandler{
- public static final String ISSUES_WARNING = " [THIS COULD CAUSE ISSUES, CHANGE AT YOUR OWN RISK!]";
-
public static Configuration config;
public ConfigurationHandler(File configFile){
ModUtil.LOGGER.info("Grabbing Configurations...");
- Util.registerEvent(this);
+ MinecraftForge.EVENT_BUS.register(this);
- if(config == null){
- config = new Configuration(configFile, true);
- loadConfig();
- }
+ config = new Configuration(configFile);
+ config.load();
+
+ redefineConfigs();
}
- private static void loadConfig(){
+ private static void redefineConfigs(){
ConfigValues.defineConfigValues(config);
if(config.hasChanged()){
@@ -45,8 +44,8 @@ public class ConfigurationHandler{
@SubscribeEvent
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event){
- if(event.modID.equalsIgnoreCase(ModUtil.MOD_ID)){
- loadConfig();
+ if(event.getModID().equalsIgnoreCase(ModUtil.MOD_ID)){
+ redefineConfigs();
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java
index 4e90478b4..bc523e7b6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiConfiguration.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiConfiguration.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiConfiguration.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiFactory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiFactory.java
index ec8280c6a..d9730cb23 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiFactory.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/GuiFactory.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiFactory.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiFactory.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config;
@@ -16,7 +16,6 @@ import net.minecraftforge.fml.client.IModGuiFactory;
import java.util.Set;
-@SuppressWarnings("unused")
public class GuiFactory implements IModGuiFactory{
@Override
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java
index 2c1f343e2..f0f2f6798 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java
@@ -1,17 +1,16 @@
/*
- * This file ("ConfigBoolValues.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ConfigBoolValues.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config.values;
import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
-import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
public enum ConfigBoolValues{
@@ -21,7 +20,7 @@ public enum ConfigBoolValues{
GENERATE_QUARTZ("Black Quartz", ConfigCategories.WORLD_GEN, true, "If the Black Quartz generates in the world"),
DO_UPDATE_CHECK("Do Update Check", ConfigCategories.OTHER, true, "If Actually Additions should check for an Update on joining a World"),
- UPDATE_CHECK_VERSION_SPECIFIC("Version Specific Update Checker", ConfigCategories.OTHER, false, "If Actually Additions' Update Check should only search for updates for the Minecraft Version you currently have"),
+ UPDATE_CHECK_VERSION_SPECIFIC("Version Specific Update Checker", ConfigCategories.OTHER, true, "If Actually Additions' Update Check should only search for updates for the Minecraft Version you currently have"),
DO_CAT_DROPS("Do Cat Drops", ConfigCategories.OTHER, true, "If Cats drop Hairy Balls on Occasion"),
@@ -39,11 +38,6 @@ public enum ConfigBoolValues{
DO_SPIDER_DROPS("Spider Cobweb Drop", ConfigCategories.MOB_DROPS, true, "If Cobwebs should sometimes drop from Spiders"),
DO_BAT_DROPS("Bat Wing Drop", ConfigCategories.MOB_DROPS, true, "If Wings should sometimes drop from Bats"),
- PREVENT_OIL_OVERRIDE("Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Oil Fluids from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
- PREVENT_CANOLA_OVERRIDE("Canola Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Fluids from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
- PREVENT_OIL_BLOCK_OVERRIDE("Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Oil Blocks from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
- PREVENT_CANOLA_BLOCK_OVERRIDE("Canola Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Blocks from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
-
CTRL_EXTRA_INFO("Advanced Info", ConfigCategories.OTHER, true, "Show Advanced Item Info when holding Control on every Item"),
CTRL_INFO_FOR_EXTRA_INFO("Advanced Info Tooltips", ConfigCategories.OTHER, true, "Show the 'Press Control for more Info'-Text on Item Tooltips"),
@@ -52,7 +46,16 @@ public enum ConfigBoolValues{
ENABLE_SEASONAL("Seasonal Mode", ConfigCategories.OTHER, true, "If Seasonal Mode is enabled"),
- DUNGEON_LOOT("Dungeon Loot", ConfigCategories.OTHER, true, "Should Actually Additions Loot spawn in Dungeons");
+ DUNGEON_LOOT("Dungeon Loot", ConfigCategories.OTHER, true, "Should Actually Additions Loot spawn in Dungeons"),
+ GEN_LUSH_CAVES("Generate Lush Caves", ConfigCategories.WORLD_GEN, true, "Should caves with trees and grass randomly generate underground"),
+
+ BOOKLET_TEXT_TO_FILE("Booklet Text to File", ConfigCategories.OTHER, false, "Should the entire text of the booklet be put into a new file in the Minecraft Folder on startup or resource reload. This is for debug purposes only and shouldn't really ever be needed."),
+
+ WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "If right-clicking a bowl on water should create a water bowl"),
+
+ LESS_SOUND("Less Sound", ConfigCategories.PERFORMANCE, false, "If blocks in Actually Additions should have less sounds"),
+ LESS_PARTICLES("Less Particles", ConfigCategories.PERFORMANCE, false, "If blocks in Actually Additions should have less particles"),
+ LESS_BLOCK_BREAKING_EFFECTS("Less Block Breaking Effects", ConfigCategories.PERFORMANCE, false, "If there should not be a sound effect and particles when a block is being destroyed by a breaker or similar");
public final String name;
public final String category;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java
index 8c6e3cf21..e10f087b1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("ConfigCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ConfigCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config.values;
@@ -61,6 +61,7 @@ public enum ConfigCrafting{
KNIFE("Knife", ConfigCategories.ITEMS_CRAFTING),
STICK_CRAFTER("Crafting Table On A Stick", ConfigCategories.ITEMS_CRAFTING),
MASHED_FOOD("Mashed Food", ConfigCategories.ITEMS_CRAFTING),
+ RARMOR_RECONSTRUCTOR_MODULE("Rarmor Reconstructor Module", ConfigCategories.ITEMS_CRAFTING),
RING_SPEED("Speed Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_HASTE("Haste Ring", ConfigCategories.POTION_RING_CRAFTING),
@@ -96,8 +97,10 @@ public enum ConfigCrafting{
OIL_GENERATOR("Oil Generator", ConfigCategories.BLOCKS_CRAFTING),
PHANTOMFACE("Phantomface", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_CONNECTOR("Phantom Connector", ConfigCategories.ITEMS_CRAFTING),
+ PLAYER_INTERFACE("Player Interface", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_ENERGYFACE("Phantom Energyface", ConfigCategories.BLOCKS_CRAFTING),
+ PHANTOM_REDSTONEFACE("Phantom Redstoneface", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_LIQUIFACE("Phantom Liquiface", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_PLACER("Phantom Placer", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_BREAKER("Phantom Breaker", ConfigCategories.BLOCKS_CRAFTING),
@@ -146,6 +149,8 @@ public enum ConfigCrafting{
DIRECTIONAL_BREAKER("Long-Range Breaker", ConfigCategories.BLOCKS_CRAFTING),
RANGED_COLLECTOR("Ranged Collector", ConfigCategories.BLOCKS_CRAFTING),
LASER_RELAY("Laser Relay", ConfigCategories.BLOCKS_CRAFTING),
+ LASER_RELAY_ITEM("Item Laser Relay", ConfigCategories.BLOCKS_CRAFTING),
+ LASER_RELAY_ITEM_WHITELIST("Advanced Item Laser Relay", ConfigCategories.BLOCKS_CRAFTING),
LASER_WRENCH("Laser Wrench", ConfigCategories.ITEMS_CRAFTING),
CHEST_TO_CRATE_UPGRADE("Chest To Crate Upgrade", ConfigCategories.ITEMS_CRAFTING),
@@ -153,7 +158,12 @@ public enum ConfigCrafting{
DRILL_CORE("Drill Core", ConfigCategories.ITEMS_CRAFTING),
ATOMIC_RECONSTRUCTOR("Atomic Reconstructor", ConfigCategories.BLOCKS_CRAFTING),
MINER("Miner", ConfigCategories.BLOCKS_CRAFTING),
- FIREWORK_BOX("Firework Box", ConfigCategories.BLOCKS_CRAFTING);
+ FIREWORK_BOX("Firework Box", ConfigCategories.BLOCKS_CRAFTING),
+ ENDER_STAR("Ender Star", ConfigCategories.ITEMS_CRAFTING),
+ SPAWNER_CHANGER("Spawner Changer", ConfigCategories.ITEMS_CRAFTING),
+ ITEM_INTERFACE("Item Interface", ConfigCategories.BLOCKS_CRAFTING),
+ DISPLAY_STAND("Display Stand", ConfigCategories.BLOCKS_CRAFTING),
+ FILTER("Item Filter", ConfigCategories.ITEMS_CRAFTING);
public final String name;
public final String category;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntListValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntListValues.java
new file mode 100644
index 000000000..e1f7b8a66
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntListValues.java
@@ -0,0 +1,38 @@
+/*
+ * This file ("ConfigIntListValues.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.config.values;
+
+import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
+
+public enum ConfigIntListValues{
+
+ ORE_GEN_DIMENSION_BLACKLIST("OreGen Dimension Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The IDs of the dimensions that Actually Additions OreGen (Black Quartz for example) is banned in. This also applies for other world gen like lush caves."),
+ PLANT_DIMENSION_BLACKLIST("Plant Blacklist", ConfigCategories.WORLD_GEN, new int[0], "The IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in");
+
+ public final String name;
+ public final String category;
+ public final int[] defaultValue;
+ public final String desc;
+
+ public int[] currentValue;
+
+ ConfigIntListValues(String name, ConfigCategories category, int[] defaultValue, String desc){
+ this.name = name;
+ this.category = category.name;
+ this.defaultValue = defaultValue;
+ this.desc = desc;
+ }
+
+ public int[] getValue(){
+ return this.currentValue;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java
index 59344495d..bcf79233a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java
@@ -1,11 +1,11 @@
/*
- * This file ("ConfigIntValues.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ConfigIntValues.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config.values;
@@ -21,6 +21,7 @@ public enum ConfigIntValues{
FLAX_AMOUNT("Flax: Amount", ConfigCategories.WORLD_GEN, 8, 1, 50, "The Amount of Flax generating"),
COFFEE_AMOUNT("Coffee: Amount", ConfigCategories.WORLD_GEN, 6, 1, 50, "The Amount of Coffee generating"),
BLACK_LOTUS_AMOUNT("Black Lotus: Amount", ConfigCategories.WORLD_GEN, 14, 1, 50, "The Amount of Black Lotus generating"),
+ LUSH_CAVE_CHANCE("Lush Caves: Chance", ConfigCategories.WORLD_GEN, 20, 1, 100, "The chance for lush caves to generate. The lower the number, the likelier."),
LASER_RELAY_LOSS("Laser Relay: Loss", ConfigCategories.MACHINE_VALUES, 5, 0, 80, "The Energy Loss of the Laser Relay per Transfer in Percent"),
LASER_RELAY_MAX_TRANSFER("Laser Relay: Max Transfer", ConfigCategories.MACHINE_VALUES, 10000, 100, 1000000, "The max amount of RF a Laser Relay can receive and try to transfer (if it's given 100 RF and can only transfer 50, it will only accept 50, it won't waste any power!)"),
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigStringListValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigStringListValues.java
new file mode 100644
index 000000000..74fc57ea8
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigStringListValues.java
@@ -0,0 +1,44 @@
+/*
+ * This file ("ConfigStringListValues.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.config.values;
+
+import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
+
+public enum ConfigStringListValues{
+
+ CRUSHER_RECIPE_EXCEPTIONS("Crusher Recipe Exceptions", ConfigCategories.OTHER, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."),
+ MASHED_FOOD_CRAFTING_EXCEPTIONS("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
+ PAXEL_EXTRA_MINING_WHITELIST("AIOT Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
+ DRILL_EXTRA_MINING_WHITELIST("Drill Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
+ MINER_EXTRA_WHITELIST("Vertical Digger Extra Whitelist", ConfigCategories.MACHINE_VALUES, new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option only applies if the miner is in Ores Only Mode."),
+ MINER_BLACKLIST("Vertical Digger Blacklist", ConfigCategories.MACHINE_VALUES, new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can mine, but shouldn't be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option will apply in both modes."),
+ REPAIRER_EXTRA_WHITELIST("Item Repairer Extra Whitelist", ConfigCategories.MACHINE_VALUES, new String[]{"tconstruct:pickaxe", "tconstruct:shovel", "tconstruct:hatchet", "tconstruct:mattock", "tconstruct:broadsword", "tconstruct:longsword", "tconstruct:frypan", "tconstruct:battlesign", "tconstruct:hammer", "tconstruct:excavator", "tconstruct:lumberaxe", "tconstruct:cleaver"}, "By default, the Item Repairer only repairs items which are repairable in an anvil. Add an item's REGISTRY NAME here if you want it to be repairable."),
+ SPAWNER_CHANGER_BLACKLIST("Spawner Changer Blacklist", ConfigCategories.OTHER, new String[]{"VillagerGolem"}, "By default, the Spawner Changer allows every living entity to be put into a spawner. If there is one that shouldn't be able to, put its MAPPING NAME here.");
+
+ public final String name;
+ public final String category;
+ public final String[] defaultValue;
+ public final String desc;
+
+ public String[] currentValue;
+
+ ConfigStringListValues(String name, ConfigCategories category, String[] defaultValue, String desc){
+ this.name = name;
+ this.category = category.name;
+ this.defaultValue = defaultValue;
+ this.desc = desc;
+ }
+
+ public String[] getValue(){
+ return this.currentValue;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java
index 1f5fcde97..8b918ca82 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("BlockCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("BlockCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
@@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -26,8 +27,9 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
-public class BlockCrafting{
+public final class BlockCrafting{
+ public static final IRecipe[] RECIPES_LAMPS = new IRecipe[BlockColoredLamp.ALL_LAMP_TYPES.length];
public static IRecipe recipeSmileyCloud;
public static IRecipe recipePhantomface;
public static IRecipe recipeLiquiface;
@@ -68,9 +70,10 @@ public class BlockCrafting{
public static IRecipe recipeFeeder;
public static IRecipe recipeCompost;
public static IRecipe recipeCrate;
+ public static IRecipe recipeCrateMedium;
+ public static IRecipe recipeCrateLarge;
public static IRecipe recipeFermentingBarrel;
public static IRecipe recipeCanolaPress;
- public static IRecipe[] recipesLamps = new IRecipe[BlockColoredLamp.allLampTypes.length];
public static IRecipe recipePowerer;
public static IRecipe recipeLeafGen;
public static IRecipe recipeDirectionalBreaker;
@@ -80,17 +83,38 @@ public class BlockCrafting{
public static IRecipe recipeAtomicReconstructor;
public static IRecipe recipeMiner;
public static IRecipe recipeFireworkBox;
+ public static IRecipe recipePhantomRedstoneface;
+ public static IRecipe recipeLaserRelayItem;
+ public static IRecipe recipeLaserRelayItemWhitelist;
+ public static IRecipe recipeItemInterface;
+ public static IRecipe recipeBookStand;
+ public static IRecipe recipePlayerInterface;
+ public static IRecipe recipeDisplayStand;
public static void init(){
+ //Book Stand
+ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBookletStand), new ItemStack(InitItems.itemBooklet), "plankWood"));
+ recipeBookStand = RecipeUtil.lastIRecipe();
+
//Firework Box
if(ConfigCrafting.FIREWORK_BOX.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFireworkBox),
"GGG", "SSS", "CCC",
- 'G', new ItemStack(Items.gunpowder),
- 'S', new ItemStack(Items.stick),
+ 'G', new ItemStack(Items.GUNPOWDER),
+ 'S', new ItemStack(Items.STICK),
'C', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeFireworkBox = Util.GetRecipes.lastIRecipe();
+ recipeFireworkBox = RecipeUtil.lastIRecipe();
+ }
+
+ //Display Stand
+ if(ConfigCrafting.DISPLAY_STAND.isEnabled()){
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockDisplayStand),
+ " R ", "EEE", "GGG",
+ 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
+ 'E', new ItemStack(InitBlocks.blockTestifiBucksGreenWall),
+ 'G', new ItemStack(InitBlocks.blockTestifiBucksWhiteWall)));
+ recipeDisplayStand = RecipeUtil.lastIRecipe();
}
//Miner
@@ -101,7 +125,7 @@ public class BlockCrafting{
'I', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'C', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()),
'D', new ItemStack(InitItems.itemDrill, 1, Util.WILDCARD)));
- recipeMiner = Util.GetRecipes.lastIRecipe();
+ recipeMiner = RecipeUtil.lastIRecipe();
}
//Quartz
@@ -166,29 +190,58 @@ public class BlockCrafting{
'R', "dustRedstone",
'I', "ingotIron",
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal())));
- recipeAtomicReconstructor = Util.GetRecipes.lastIRecipe();
+ recipeAtomicReconstructor = RecipeUtil.lastIRecipe();
}
//Laser Relay
if(ConfigCrafting.LASER_RELAY.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockLaserRelay, 2),
"OBO", "RCR", "OBO",
- 'B', new ItemStack(Blocks.redstone_block),
- 'O', new ItemStack(Blocks.obsidian),
+ 'B', new ItemStack(Blocks.REDSTONE_BLOCK),
+ 'O', new ItemStack(Blocks.OBSIDIAN),
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeLaserRelay = Util.GetRecipes.lastIRecipe();
+ recipeLaserRelay = RecipeUtil.lastIRecipe();
+ }
+
+ //Item Laser Relay
+ if(ConfigCrafting.LASER_RELAY_ITEM.isEnabled()){
+ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockLaserRelayItem),
+ new ItemStack(InitBlocks.blockLaserRelay),
+ new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
+ recipeLaserRelayItem = RecipeUtil.lastIRecipe();
+ }
+
+ //Whitelist Item Laser Relay
+ if(ConfigCrafting.LASER_RELAY_ITEM_WHITELIST.isEnabled()){
+ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockLaserRelayItemWhitelist),
+ new ItemStack(InitBlocks.blockLaserRelayItem),
+ new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
+ new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()),
+ new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal())));
+ recipeLaserRelayItemWhitelist = RecipeUtil.lastIRecipe();
+ }
+
+ //Item Interface
+ if(ConfigCrafting.ITEM_INTERFACE.isEnabled()){
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockItemViewer),
+ "OBO", "RCR", "OBO",
+ 'B', new ItemStack(Items.REDSTONE),
+ 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
+ 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
+ 'C', new ItemStack(Blocks.CHEST)));
+ recipeItemInterface = RecipeUtil.lastIRecipe();
}
//Ranged Collector
if(ConfigCrafting.RANGED_COLLECTOR.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockRangedCollector),
" A ", "EHE", " C ",
- 'E', new ItemStack(Items.ender_pearl),
- 'H', new ItemStack(Blocks.hopper),
+ 'E', new ItemStack(Items.ENDER_PEARL),
+ 'H', new ItemStack(Blocks.HOPPER),
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'A', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal())));
- recipeRangedCollector = Util.GetRecipes.lastIRecipe();
+ recipeRangedCollector = RecipeUtil.lastIRecipe();
}
//Directional Breaker
@@ -197,16 +250,16 @@ public class BlockCrafting{
"BBB", " C ",
'C', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()),
'B', new ItemStack(InitBlocks.blockBreaker)));
- recipeDirectionalBreaker = Util.GetRecipes.lastIRecipe();
+ recipeDirectionalBreaker = RecipeUtil.lastIRecipe();
}
//Smiley Cloud
if(ConfigCrafting.CLOUD.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockSmileyCloud),
" W ", "WXW", " W ",
- 'W', new ItemStack(Blocks.wool, 1, Util.WILDCARD),
+ 'W', new ItemStack(Blocks.WOOL, 1, Util.WILDCARD),
'X', new ItemStack(InitItems.itemSolidifiedExperience)));
- recipeSmileyCloud = Util.GetRecipes.lastIRecipe();
+ recipeSmileyCloud = RecipeUtil.lastIRecipe();
}
//Compost
@@ -215,7 +268,7 @@ public class BlockCrafting{
"W W", "W W", "WCW",
'W', "plankWood",
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal())));
- recipeCompost = Util.GetRecipes.lastIRecipe();
+ recipeCompost = RecipeUtil.lastIRecipe();
}
//XP Solidifier
@@ -225,15 +278,15 @@ public class BlockCrafting{
'X', new ItemStack(InitItems.itemSolidifiedExperience),
'D', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeSolidifier = Util.GetRecipes.lastIRecipe();
+ recipeSolidifier = RecipeUtil.lastIRecipe();
}
//Charcoal Block
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.CHARCOAL_BLOCK.ordinal()),
"CCC", "CCC", "CCC",
- 'C', new ItemStack(Items.coal, 1, 1));
- recipeBlockChar = Util.GetRecipes.lastIRecipe();
- GameRegistry.addShapelessRecipe(new ItemStack(Items.coal, 9, 1),
+ 'C', new ItemStack(Items.COAL, 1, 1));
+ recipeBlockChar = RecipeUtil.lastIRecipe();
+ GameRegistry.addShapelessRecipe(new ItemStack(Items.COAL, 9, 1),
new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.CHARCOAL_BLOCK.ordinal()));
//Wood Casing
@@ -243,7 +296,7 @@ public class BlockCrafting{
'W', "plankWood",
'R', "logWood",
'S', "stickWood"));
- recipeCase = Util.GetRecipes.lastIRecipe();
+ recipeCase = RecipeUtil.lastIRecipe();
}
//Iron Casing
@@ -253,17 +306,17 @@ public class BlockCrafting{
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()),
'W', "ingotIron",
'S', "stickWood"));
- recipeIronCase = Util.GetRecipes.lastIRecipe();
+ recipeIronCase = RecipeUtil.lastIRecipe();
}
//Ender Casing
if(ConfigCrafting.ENDER_CASING.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()),
"WSW", "SRS", "WSW",
- 'W', new ItemStack(Items.ender_pearl),
+ 'W', new ItemStack(Items.ENDER_PEARL),
'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()),
'S', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal())));
- recipeEnderCase = Util.GetRecipes.lastIRecipe();
+ recipeEnderCase = RecipeUtil.lastIRecipe();
}
//Phantom Booster
@@ -273,7 +326,7 @@ public class BlockCrafting{
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal())));
- recipePhantomBooster = Util.GetRecipes.lastIRecipe();
+ recipePhantomBooster = RecipeUtil.lastIRecipe();
}
//Coffee Machine
@@ -284,7 +337,7 @@ public class BlockCrafting{
'C', InitItems.itemCoffeeBean,
'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal())));
- recipeCoffeeMachine = Util.GetRecipes.lastIRecipe();
+ recipeCoffeeMachine = RecipeUtil.lastIRecipe();
}
//Energizer
@@ -294,7 +347,7 @@ public class BlockCrafting{
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'A', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal())));
- recipeEnergizer = Util.GetRecipes.lastIRecipe();
+ recipeEnergizer = RecipeUtil.lastIRecipe();
}
//Enervator
@@ -304,7 +357,7 @@ public class BlockCrafting{
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'A', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal())));
- recipeEnervator = Util.GetRecipes.lastIRecipe();
+ recipeEnervator = RecipeUtil.lastIRecipe();
}
//Lava Factory
@@ -314,8 +367,8 @@ public class BlockCrafting{
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'S', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'I', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()),
- 'L', Items.lava_bucket));
- recipeLavaFactory = Util.GetRecipes.lastIRecipe();
+ 'L', Items.LAVA_BUCKET));
+ recipeLavaFactory = RecipeUtil.lastIRecipe();
}
//Casing
@@ -324,7 +377,7 @@ public class BlockCrafting{
"ICI",
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'I', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeCasing = Util.GetRecipes.lastIRecipe();
+ recipeCasing = RecipeUtil.lastIRecipe();
}
//Canola Press
@@ -335,7 +388,7 @@ public class BlockCrafting{
'H', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())));
- recipeCanolaPress = Util.GetRecipes.lastIRecipe();
+ recipeCanolaPress = RecipeUtil.lastIRecipe();
}
//Fermenting Barrel
@@ -346,7 +399,7 @@ public class BlockCrafting{
'H', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()),
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())));
- recipeFermentingBarrel = Util.GetRecipes.lastIRecipe();
+ recipeFermentingBarrel = RecipeUtil.lastIRecipe();
}
//Phantomface
@@ -354,10 +407,21 @@ public class BlockCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomface),
" C ", "EBE", " S ",
'E', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
- 'C', Blocks.chest,
+ 'C', Blocks.CHEST,
'S', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'B', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal())));
- recipePhantomface = Util.GetRecipes.lastIRecipe();
+ recipePhantomface = RecipeUtil.lastIRecipe();
+ }
+
+ //Player Interface
+ if(ConfigCrafting.PLAYER_INTERFACE.isEnabled()){
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPlayerInterface),
+ "BCB", "EBE", "BSB",
+ 'E', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
+ 'C', new ItemStack(Items.SKULL, 1, 1),
+ 'S', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
+ 'B', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal())));
+ recipePlayerInterface = RecipeUtil.lastIRecipe();
}
//Phantom Placer
@@ -365,7 +429,7 @@ public class BlockCrafting{
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockPhantomPlacer),
InitBlocks.blockPlacer,
InitBlocks.blockPhantomface));
- recipePhantomPlacer = Util.GetRecipes.lastIRecipe();
+ recipePhantomPlacer = RecipeUtil.lastIRecipe();
}
//Phantom Breaker
@@ -373,7 +437,7 @@ public class BlockCrafting{
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockPhantomBreaker),
InitBlocks.blockBreaker,
InitBlocks.blockPhantomface));
- recipePhantomBreaker = Util.GetRecipes.lastIRecipe();
+ recipePhantomBreaker = RecipeUtil.lastIRecipe();
}
//Phantom Energyface
@@ -382,34 +446,44 @@ public class BlockCrafting{
" R ", "RFR", " R ",
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'F', InitBlocks.blockPhantomface));
- recipeEnergyface = Util.GetRecipes.lastIRecipe();
+ recipeEnergyface = RecipeUtil.lastIRecipe();
+ }
+
+ //Phantom Redstoneface
+ if(ConfigCrafting.PHANTOM_REDSTONEFACE.isEnabled()){
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomRedstoneface),
+ "SRS", "RFR", "SRS",
+ 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
+ 'S', new ItemStack(Items.REDSTONE),
+ 'F', InitBlocks.blockPhantomface));
+ recipePhantomRedstoneface = RecipeUtil.lastIRecipe();
}
//Phantom Liquiface
if(ConfigCrafting.PHANTOM_LIQUIFACE.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomLiquiface),
"RFR",
- 'R', Items.bucket,
+ 'R', Items.BUCKET,
'F', InitBlocks.blockPhantomface));
- recipeLiquiface = Util.GetRecipes.lastIRecipe();
+ recipeLiquiface = RecipeUtil.lastIRecipe();
}
//Liquid Placer
if(ConfigCrafting.LIQUID_PLACER.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFluidPlacer),
"RFR",
- 'R', Items.bucket,
+ 'R', Items.BUCKET,
'F', InitBlocks.blockPlacer));
- recipeLiquidPlacer = Util.GetRecipes.lastIRecipe();
+ recipeLiquidPlacer = RecipeUtil.lastIRecipe();
}
//Liquid Breaker
if(ConfigCrafting.LIQUID_BREAKER.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFluidCollector),
"RFR",
- 'R', Items.bucket,
+ 'R', Items.BUCKET,
'F', InitBlocks.blockBreaker));
- recipeLiquidCollector = Util.GetRecipes.lastIRecipe();
+ recipeLiquidCollector = RecipeUtil.lastIRecipe();
}
//Oil Generator
@@ -419,7 +493,7 @@ public class BlockCrafting{
'C', "cobblestone",
'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'B', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())));
- recipeOilGen = Util.GetRecipes.lastIRecipe();
+ recipeOilGen = RecipeUtil.lastIRecipe();
}
//Coal Generator
@@ -428,8 +502,8 @@ public class BlockCrafting{
"CRC", "CBC", "CRC",
'C', "cobblestone",
'B', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
- 'R', new ItemStack(Items.coal, 1, Util.WILDCARD)));
- recipeCoalGen = Util.GetRecipes.lastIRecipe();
+ 'R', new ItemStack(Items.COAL, 1, Util.WILDCARD)));
+ recipeCoalGen = RecipeUtil.lastIRecipe();
}
//Leaf Generator
@@ -441,30 +515,30 @@ public class BlockCrafting{
'E', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'L', "treeLeaves",
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeLeafGen = Util.GetRecipes.lastIRecipe();
+ recipeLeafGen = RecipeUtil.lastIRecipe();
}
//Enderpearl Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()),
"EE", "EE",
- 'E', Items.ender_pearl));
- recipeEnderPearlBlock = Util.GetRecipes.lastIRecipe();
- GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.ender_pearl, 4),
+ 'E', Items.ENDER_PEARL));
+ recipeEnderPearlBlock = RecipeUtil.lastIRecipe();
+ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.ENDER_PEARL, 4),
new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal())));
//Quartz Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()),
"QQ", "QQ",
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
- recipeQuartzBlock = Util.GetRecipes.lastIRecipe();
+ recipeQuartzBlock = RecipeUtil.lastIRecipe();
//Fishing Net
if(ConfigCrafting.FISHING_NET.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFishingNet),
"SSS", "SDS", "SSS",
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
- 'S', Items.string));
- recipeFisher = Util.GetRecipes.lastIRecipe();
+ 'S', Items.STRING));
+ recipeFisher = RecipeUtil.lastIRecipe();
}
//Repairer
@@ -475,7 +549,7 @@ public class BlockCrafting{
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal())));
- recipeRepairer = Util.GetRecipes.lastIRecipe();
+ recipeRepairer = RecipeUtil.lastIRecipe();
}
//Solar Panel
@@ -486,8 +560,8 @@ public class BlockCrafting{
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
- 'B', new ItemStack(Blocks.iron_bars)));
- recipeSolar = Util.GetRecipes.lastIRecipe();
+ 'B', new ItemStack(Blocks.IRON_BARS)));
+ recipeSolar = RecipeUtil.lastIRecipe();
}
//Heat Collector
@@ -495,25 +569,25 @@ public class BlockCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockHeatCollector),
"BRB", "CDC", "BQB",
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
- 'R', new ItemStack(Items.repeater),
+ 'R', new ItemStack(Items.REPEATER),
'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
- 'L', new ItemStack(Items.lava_bucket),
+ 'L', new ItemStack(Items.LAVA_BUCKET),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
- 'B', new ItemStack(Blocks.iron_bars)));
- recipeHeatCollector = Util.GetRecipes.lastIRecipe();
+ 'B', new ItemStack(Blocks.IRON_BARS)));
+ recipeHeatCollector = RecipeUtil.lastIRecipe();
}
//Quartz Pillar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()),
"Q", "Q",
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
- recipeQuartzPillar = Util.GetRecipes.lastIRecipe();
+ recipeQuartzPillar = RecipeUtil.lastIRecipe();
//Chiseled Quartz
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 2, TheMiscBlocks.QUARTZ_CHISELED.ordinal()),
"Q", "Q",
'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal())));
- recipeQuartzChiseled = Util.GetRecipes.lastIRecipe();
+ recipeQuartzChiseled = RecipeUtil.lastIRecipe();
//Inputter
if(ConfigCrafting.INPUTTER.isEnabled()){
@@ -522,14 +596,14 @@ public class BlockCrafting{
'W', "plankWood",
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()),
'H', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeESD = Util.GetRecipes.lastIRecipe();
+ recipeESD = RecipeUtil.lastIRecipe();
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockInputterAdvanced),
InitBlocks.blockInputter,
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()),
new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal())));
- recipeAdvancedESD = Util.GetRecipes.lastIRecipe();
+ recipeAdvancedESD = RecipeUtil.lastIRecipe();
}
//Crusher
@@ -540,9 +614,9 @@ public class BlockCrafting{
'C', "cobblestone",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
- 'P', new ItemStack(Blocks.piston),
- 'F', new ItemStack(Items.flint)));
- recipeCrusher = Util.GetRecipes.lastIRecipe();
+ 'P', new ItemStack(Blocks.PISTON),
+ 'F', new ItemStack(Items.FLINT)));
+ recipeCrusher = RecipeUtil.lastIRecipe();
}
//Double Crusher
@@ -553,8 +627,8 @@ public class BlockCrafting{
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'R', InitBlocks.blockGrinder,
'F', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
- 'P', new ItemStack(Blocks.piston)));
- recipeDoubleCrusher = Util.GetRecipes.lastIRecipe();
+ 'P', new ItemStack(Blocks.PISTON)));
+ recipeDoubleCrusher = RecipeUtil.lastIRecipe();
}
//Double Furnace
@@ -563,10 +637,10 @@ public class BlockCrafting{
"PDC", "RFR", "CDP",
'C', "cobblestone",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
- 'R', new ItemStack(Blocks.furnace),
+ 'R', new ItemStack(Blocks.FURNACE),
'F', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
'P', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeFurnace = Util.GetRecipes.lastIRecipe();
+ recipeFurnace = RecipeUtil.lastIRecipe();
}
//Feeder
@@ -575,19 +649,33 @@ public class BlockCrafting{
"WCW", "DHD", "WCW",
'W', "plankWood",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
- 'C', new ItemStack(Items.golden_carrot),
+ 'C', new ItemStack(Items.GOLDEN_CARROT),
'H', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal())));
- recipeFeeder = Util.GetRecipes.lastIRecipe();
+ recipeFeeder = RecipeUtil.lastIRecipe();
}
//Giant Chest
if(ConfigCrafting.GIANT_CHEST.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChest),
"CWC", "WDW", "CWC",
- 'C', new ItemStack(Blocks.chest),
+ 'C', new ItemStack(Blocks.CHEST),
'D', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()),
'W', "plankWood"));
- recipeCrate = Util.GetRecipes.lastIRecipe();
+ recipeCrate = RecipeUtil.lastIRecipe();
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChestMedium),
+ "CWC", "WDW", "CWC",
+ 'C', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()),
+ 'D', new ItemStack(InitBlocks.blockGiantChest),
+ 'W', "plankWood"));
+ recipeCrateMedium = RecipeUtil.lastIRecipe();
+
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChestLarge),
+ "CWC", "WDW", "CWC",
+ 'C', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()),
+ 'D', new ItemStack(InitBlocks.blockGiantChestMedium),
+ 'W', "plankWood"));
+ recipeCrateLarge = RecipeUtil.lastIRecipe();
}
//Greenhouse Glass
@@ -597,7 +685,7 @@ public class BlockCrafting{
'G', "blockGlass",
'D', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()),
'S', "treeSapling"));
- recipeGlass = Util.GetRecipes.lastIRecipe();
+ recipeGlass = RecipeUtil.lastIRecipe();
}
//Placer
@@ -607,7 +695,7 @@ public class BlockCrafting{
'C', "cobblestone",
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'P', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal())));
- recipePlacer = Util.GetRecipes.lastIRecipe();
+ recipePlacer = RecipeUtil.lastIRecipe();
}
//Breaker
@@ -617,7 +705,7 @@ public class BlockCrafting{
'C', "cobblestone",
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'P', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal())));
- recipeBreaker = Util.GetRecipes.lastIRecipe();
+ recipeBreaker = RecipeUtil.lastIRecipe();
}
//Dropper
@@ -626,27 +714,27 @@ public class BlockCrafting{
"CBC", "CDR", "CBC",
'B', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()),
'C', "cobblestone",
- 'D', Blocks.dropper,
+ 'D', Blocks.DROPPER,
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeDropper = Util.GetRecipes.lastIRecipe();
+ recipeDropper = RecipeUtil.lastIRecipe();
}
if(ConfigCrafting.LAMPS.isEnabled()){
- for(int i = 0; i < BlockColoredLamp.allLampTypes.length; i++){
+ for(int i = 0; i < BlockColoredLamp.ALL_LAMP_TYPES.length; i++){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockColoredLamp, 6, i),
"GCG", "DQD", "GCG",
'C', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()),
'G', "glowstone",
- 'D', "dye"+BlockColoredLamp.allLampTypes[i].name,
+ 'D', "dye"+BlockColoredLamp.ALL_LAMP_TYPES[i].name,
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
- recipesLamps[i] = Util.GetRecipes.lastIRecipe();
+ RECIPES_LAMPS[i] = RecipeUtil.lastIRecipe();
}
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockLampPowerer, 4),
"XXX", "XLX", "XXX",
'X', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'L', new ItemStack(InitBlocks.blockColoredLamp, 1, Util.WILDCARD)));
- recipePowerer = Util.GetRecipes.lastIRecipe();
+ recipePowerer = RecipeUtil.lastIRecipe();
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java
index 91c307a7e..2ed31929c 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("CrusherCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("CrusherCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
@@ -17,56 +17,56 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.Util;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
-public class CrusherCrafting{
+public final class CrusherCrafting{
+ public static final ArrayList MISC_RECIPES = new ArrayList();
public static CrusherRecipe recipeIronHorseArmor;
public static CrusherRecipe recipeGoldHorseArmor;
public static CrusherRecipe recipeDiamondHorseArmor;
- public static ArrayList miscRecipes = new ArrayList();
public static void init(){
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.bone), new ItemStack(Items.dye, 6, 15));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.reeds), new ItemStack(Items.sugar, 3));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.yellow_flower), new ItemStack(Items.dye, 3, 11));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 0), new ItemStack(Items.dye, 3, 1));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 1), new ItemStack(Items.dye, 3, 12));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 2), new ItemStack(Items.dye, 3, 13));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 3), new ItemStack(Items.dye, 3, 7));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 4), new ItemStack(Items.dye, 3, 1));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 5), new ItemStack(Items.dye, 3, 14));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 6), new ItemStack(Items.dye, 3, 7));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 7), new ItemStack(Items.dye, 3, 9));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.red_flower, 1, 8), new ItemStack(Items.dye, 3, 7));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.double_plant, 1, 0), new ItemStack(Items.dye, 4, 11));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.double_plant, 1, 1), new ItemStack(Items.dye, 4, 13));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.double_plant, 1, 4), new ItemStack(Items.dye, 4, 1));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.double_plant, 1, 5), new ItemStack(Items.dye, 4, 9));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe("oreRedstone", "dustRedstone", 10);
ActuallyAdditionsAPI.addCrusherRecipe("oreLapis", "gemLapis", 12);
@@ -75,35 +75,35 @@ public class CrusherCrafting{
ActuallyAdditionsAPI.addCrusherRecipe("blockCoal", "coal", 9);
ActuallyAdditionsAPI.addCrusherRecipe("oreQuartz", "gemQuartz", 3);
ActuallyAdditionsAPI.addCrusherRecipe("cobblestone", "sand", 1);
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint), new ItemStack(Items.flint), 50);
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50);
ActuallyAdditionsAPI.addCrusherRecipe("stone", "cobblestone", 1);
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.glowstone), new ItemStack(Items.glowstone_dust, 4));
- miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4));
+ MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe("oreNickel", "dustNickel", 2, "dustPlatinum", 1, 15);
ActuallyAdditionsAPI.addCrusherRecipe("oreIron", "dustIron", 2, "dustGold", 1, 20);
if(ConfigCrafting.HORSE_ARMORS.isEnabled()){
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.iron_horse_armor), "dustIron", 8);
- recipeIronHorseArmor = Util.GetRecipes.lastCrusherRecipe();
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.IRON_HORSE_ARMOR), "dustIron", 8);
+ recipeIronHorseArmor = RecipeUtil.lastCrusherRecipe();
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.golden_horse_armor), "dustGold", 8);
- recipeGoldHorseArmor = Util.GetRecipes.lastCrusherRecipe();
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.GOLDEN_HORSE_ARMOR), "dustGold", 8);
+ recipeGoldHorseArmor = RecipeUtil.lastCrusherRecipe();
- ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.diamond_horse_armor), "dustDiamond", 8);
- recipeDiamondHorseArmor = Util.GetRecipes.lastCrusherRecipe();
+ ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.DIAMOND_HORSE_ARMOR), "dustDiamond", 8);
+ recipeDiamondHorseArmor = RecipeUtil.lastCrusherRecipe();
}
- CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
- CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget"));
- CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("denseore", 8));
- CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("gem", 1));
- CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("ingot", 1));
- CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("ore", 2));
+ CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
+ CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget"));
+ CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("denseore", 8));
+ CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("gem", 1));
+ CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ingot", 1));
+ CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2));
CrusherRecipeRegistry.registerFinally();
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java
index d2cb5a0b0..cbb4d4f10 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/FoodCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("FoodCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("FoodCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
@@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -23,7 +24,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
-public class FoodCrafting{
+public final class FoodCrafting{
public static IRecipe recipePizza;
public static IRecipe recipeHamburger;
@@ -56,8 +57,8 @@ public class FoodCrafting{
//Bacon
if(ConfigCrafting.BACON.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 3, TheFoods.BACON.ordinal()),
- knifeStack.copy(), new ItemStack(Items.cooked_porkchop)));
- recipeBacon = Util.GetRecipes.lastIRecipe();
+ knifeStack.copy(), new ItemStack(Items.COOKED_PORKCHOP)));
+ recipeBacon = RecipeUtil.lastIRecipe();
}
//Baguette
@@ -71,12 +72,12 @@ public class FoodCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()),
"HKH", "MCF", " D ",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
- 'M', new ItemStack(Blocks.brown_mushroom),
+ 'M', new ItemStack(Blocks.BROWN_MUSHROOM),
'C', "cropCarrot",
- 'F', new ItemStack(Items.cooked_fish, 1, Util.WILDCARD),
+ 'F', new ItemStack(Items.COOKED_FISH, 1, Util.WILDCARD),
'K', knifeStack.copy(),
'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal())));
- recipePizza = Util.GetRecipes.lastIRecipe();
+ recipePizza = RecipeUtil.lastIRecipe();
}
//Hamburger
@@ -86,8 +87,8 @@ public class FoodCrafting{
'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'K', knifeStack.copy(),
- 'B', new ItemStack(Items.cooked_beef)));
- recipeHamburger = Util.GetRecipes.lastIRecipe();
+ 'B', new ItemStack(Items.COOKED_BEEF)));
+ recipeHamburger = RecipeUtil.lastIRecipe();
}
//Big Cookie
@@ -95,28 +96,28 @@ public class FoodCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()),
"DCD", "CDC", "DCD",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
- 'C', new ItemStack(Items.dye, 1, 3)));
- recipeBigCookie = Util.GetRecipes.lastIRecipe();
+ 'C', new ItemStack(Items.DYE, 1, 3)));
+ recipeBigCookie = RecipeUtil.lastIRecipe();
}
//Sub Sandwich
if(ConfigCrafting.SUB.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()),
"KCP", "FB ", "PCP",
- 'P', new ItemStack(Items.paper),
+ 'P', new ItemStack(Items.PAPER),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
- 'F', new ItemStack(Items.cooked_fish, 1, Util.WILDCARD),
+ 'F', new ItemStack(Items.COOKED_BEEF, 1, Util.WILDCARD),
'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()),
'K', knifeStack.copy()));
- recipeSubSandwich = Util.GetRecipes.lastIRecipe();
+ recipeSubSandwich = RecipeUtil.lastIRecipe();
}
//French Fry
if(ConfigCrafting.FRENCH_FRY.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()),
- new ItemStack(Items.baked_potato),
+ new ItemStack(Items.BAKED_POTATO),
knifeStack.copy()));
- recipeFrenchFry = Util.GetRecipes.lastIRecipe();
+ recipeFrenchFry = RecipeUtil.lastIRecipe();
}
//French Fries
@@ -125,40 +126,40 @@ public class FoodCrafting{
"FFF", " P ",
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())));
- recipeFrenchFries = Util.GetRecipes.lastIRecipe();
+ recipeFrenchFries = RecipeUtil.lastIRecipe();
}
//Fish N Chips
if(ConfigCrafting.FISH_N_CHIPS.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()),
"FIF", " P ",
- 'I', new ItemStack(Items.cooked_fish, 1, Util.WILDCARD),
+ 'I', new ItemStack(Items.COOKED_FISH, 1, Util.WILDCARD),
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())));
- recipeFishNChips = Util.GetRecipes.lastIRecipe();
+ recipeFishNChips = RecipeUtil.lastIRecipe();
}
//Cheese
if(ConfigCrafting.CHEESE.isEnabled()){
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
- new ItemStack(Items.milk_bucket));
- recipeCheese = Util.GetRecipes.lastIRecipe();
+ new ItemStack(Items.MILK_BUCKET));
+ recipeCheese = RecipeUtil.lastIRecipe();
}
//Pumpkin Stew
if(ConfigCrafting.PUMPKIN_STEW.isEnabled()){
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PUMPKIN_STEW.ordinal()),
"P", "B",
- 'P', new ItemStack(Blocks.pumpkin),
- 'B', new ItemStack(Items.bowl));
- recipePumpkinStew = Util.GetRecipes.lastIRecipe();
+ 'P', new ItemStack(Blocks.PUMPKIN),
+ 'B', new ItemStack(Items.BOWL));
+ recipePumpkinStew = RecipeUtil.lastIRecipe();
}
//Carrot Juice
if(ConfigCrafting.CARROT_JUICE.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()),
- new ItemStack(Items.glass_bottle), "cropCarrot", knifeStack.copy()));
- recipeCarrotJuice = Util.GetRecipes.lastIRecipe();
+ new ItemStack(Items.GLASS_BOTTLE), "cropCarrot", knifeStack.copy()));
+ recipeCarrotJuice = RecipeUtil.lastIRecipe();
}
//Spaghetti
@@ -166,49 +167,49 @@ public class FoodCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()),
"NNN", " B ",
'N', new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
- 'B', new ItemStack(Items.bowl)));
- recipeSpaghetti = Util.GetRecipes.lastIRecipe();
+ 'B', new ItemStack(Items.BOWL)));
+ recipeSpaghetti = RecipeUtil.lastIRecipe();
}
//Noodle
if(ConfigCrafting.NOODLE.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
"cropWheat", knifeStack.copy()));
- recipeNoodle = Util.GetRecipes.lastIRecipe();
+ recipeNoodle = RecipeUtil.lastIRecipe();
}
//Chocolate
if(ConfigCrafting.CHOCOLATE.isEnabled()){
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 3, TheFoods.CHOCOLATE.ordinal()),
"C C", "CMC", "C C",
- 'C', new ItemStack(Items.dye, 1, 3),
- 'M', new ItemStack(Items.milk_bucket));
- recipeChocolate = Util.GetRecipes.lastIRecipe();
+ 'C', new ItemStack(Items.DYE, 1, 3),
+ 'M', new ItemStack(Items.MILK_BUCKET));
+ recipeChocolate = RecipeUtil.lastIRecipe();
}
//Chocolate Cake
if(ConfigCrafting.CHOCOLATE_CAKE.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_CAKE.ordinal()),
"MMM", "CCC", "EDS",
- 'M', new ItemStack(Items.milk_bucket),
- 'E', new ItemStack(Items.egg),
+ 'M', new ItemStack(Items.MILK_BUCKET),
+ 'E', new ItemStack(Items.EGG),
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
- 'S', new ItemStack(Items.sugar),
- 'C', new ItemStack(Items.dye, 1, 3)));
- recipeChocolateCake = Util.GetRecipes.lastIRecipe();
+ 'S', new ItemStack(Items.SUGAR),
+ 'C', new ItemStack(Items.DYE, 1, 3)));
+ recipeChocolateCake = RecipeUtil.lastIRecipe();
}
//Toast
if(ConfigCrafting.TOAST.isEnabled()){
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.TOAST.ordinal()),
- new ItemStack(Items.bread));
- recipeToast = Util.GetRecipes.lastIRecipe();
+ new ItemStack(Items.BREAD));
+ recipeToast = RecipeUtil.lastIRecipe();
}
//Chocolate Toast
if(ConfigCrafting.CHOCOLATE_TOAST.isEnabled()){
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_TOAST.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE.ordinal()));
- recipeChocolateToast = Util.GetRecipes.lastIRecipe();
+ recipeChocolateToast = RecipeUtil.lastIRecipe();
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java
index 3a7c57cf9..557820a78 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java
@@ -1,18 +1,23 @@
/*
- * This file ("InitCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
+import de.ellpeck.actuallyadditions.mod.items.InitItems;
+import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
-public class InitCrafting{
+public final class InitCrafting{
public static void init(){
ModUtil.LOGGER.info("Initializing Crafting Recipes...");
@@ -22,6 +27,9 @@ public class InitCrafting{
MiscCrafting.init();
FoodCrafting.init();
ToolCrafting.init();
+
+ ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemMisc, 10, TheMiscItems.MASHED_FOOD.ordinal()), Blocks.LEAVES, new ItemStack(InitItems.itemFertilizer, 10), Blocks.DIRT);
+ ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemCanolaSeed, 20), Blocks.DIRT, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), Blocks.SOUL_SAND);
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java
index 29b70ebd4..2ad63e56a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
@@ -13,10 +13,11 @@ package de.ellpeck.actuallyadditions.mod.crafting;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
-import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.*;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.IGrowable;
import net.minecraft.init.Blocks;
@@ -33,17 +34,18 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.ArrayList;
-public class ItemCrafting{
+public final class ItemCrafting{
+ public static final ArrayList RECIPES_MASHED_FOOD = new ArrayList();
+ public static final ArrayList RECIPES_DRILL_COLORING = new ArrayList();
+ public static final ArrayList RECIPES_POTION_RINGS = new ArrayList();
public static IRecipe recipePhantomConnector;
public static IRecipe recipeCoil;
public static IRecipe recipeCoilAdvanced;
public static IRecipe recipeBook;
public static IRecipe recipeTinyCoal;
public static IRecipe recipeTinyChar;
- public static ArrayList recipesMashedFood = new ArrayList();
public static IRecipe recipeDrill;
- public static ArrayList recipesDrillColoring = new ArrayList();
public static IRecipe recipeDrillSpeedI;
public static IRecipe recipeDrillSpeedII;
public static IRecipe recipeDrillSpeedIII;
@@ -72,13 +74,15 @@ public class ItemCrafting{
public static IRecipe recipeRiceDough;
public static IRecipe recipeLeafBlower;
public static IRecipe recipeLeafBlowerAdvanced;
- public static ArrayList recipesPotionRings = new ArrayList();
public static IRecipe recipeChestToCrateUpgrade;
public static IRecipe recipeLaserWrench;
public static IRecipe recipeDrillCore;
public static IRecipe recipeBlackDye;
public static IRecipe recipeLens;
public static IRecipe recipeCrateKeeper;
+ public static IRecipe recipeEnderStar;
+ public static IRecipe recipeSpawnerChanger;
+ public static IRecipe recipeFilter;
public static void init(){
@@ -87,27 +91,37 @@ public class ItemCrafting{
"GGG", "GBG", "GGG",
'G', "blockGlass",
'B', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
- recipeLens = Util.GetRecipes.lastIRecipe();
+ recipeLens = RecipeUtil.lastIRecipe();
//Black Dye
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.BLACK_DYE.ordinal()), new ItemStack(InitBlocks.blockBlackLotus)));
- recipeBlackDye = Util.GetRecipes.lastIRecipe();
+ recipeBlackDye = RecipeUtil.lastIRecipe();
//Booklet
- GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemBooklet), new ItemStack(InitItems.itemCanolaSeed), new ItemStack(Items.paper)));
- recipeBook = Util.GetRecipes.lastIRecipe();
+ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemBooklet), new ItemStack(InitItems.itemCanolaSeed), new ItemStack(Items.PAPER)));
+ recipeBook = RecipeUtil.lastIRecipe();
//Clearing NBT Storage
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemLaserWrench), new ItemStack(InitItems.itemLaserWrench));
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPhantomConnector), new ItemStack(InitItems.itemPhantomConnector));
+ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemSpawnerChanger), new ItemStack(InitItems.itemSpawnerChanger));
//Chest To Crate Upgrade
if(ConfigCrafting.CHEST_TO_CRATE_UPGRADE.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemChestToCrateUpgrade),
- "CWC", "WWW", "CWC",
- 'C', new ItemStack(Blocks.chest),
+ " W ", "WCW", " W ",
+ 'C', new ItemStack(InitBlocks.blockGiantChest),
'W', "plankWood"));
- recipeChestToCrateUpgrade = Util.GetRecipes.lastIRecipe();
+ recipeChestToCrateUpgrade = RecipeUtil.lastIRecipe();
+ }
+
+ //Filter
+ if(ConfigCrafting.FILTER.isEnabled()){
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFilter),
+ "III", "IQI", "III",
+ 'I', new ItemStack(Blocks.IRON_BARS),
+ 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
+ recipeFilter = RecipeUtil.lastIRecipe();
}
//Crate Keeper
@@ -117,7 +131,17 @@ public class ItemCrafting{
'I', "ingotIron",
'W', "plankWood",
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
- recipeCrateKeeper = Util.GetRecipes.lastIRecipe();
+ recipeCrateKeeper = RecipeUtil.lastIRecipe();
+ }
+
+ //Spawner Changer
+ if(ConfigCrafting.SPAWNER_CHANGER.isEnabled()){
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSpawnerChanger),
+ "MSM", "SDS", "MSM",
+ 'M', new ItemStack(Items.MAGMA_CREAM),
+ 'S', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()),
+ 'D', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal())));
+ recipeSpawnerChanger = RecipeUtil.lastIRecipe();
}
//Laser Wrench
@@ -126,33 +150,33 @@ public class ItemCrafting{
"C ", " S ", " S",
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'S', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeLaserWrench = Util.GetRecipes.lastIRecipe();
+ recipeLaserWrench = RecipeUtil.lastIRecipe();
}
//Rice Stuff
if(ConfigCrafting.RICE_GADGETS.isEnabled()){
- GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.paper, 3),
+ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.PAPER, 3),
"R ", " R ", " R",
'R', new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal())));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 4, TheMiscItems.RICE_SLIME.ordinal()),
" R ", "RBR", " R ",
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RICE_DOUGH.ordinal()),
- 'B', Items.water_bucket));
+ 'B', Items.WATER_BUCKET));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 4, TheMiscItems.RICE_SLIME.ordinal()),
" R ", "RBR", " R ",
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RICE_DOUGH.ordinal()),
- 'B', new ItemStack(Items.potionitem)));
+ 'B', new ItemStack(Items.POTIONITEM)));
}
//Leaf Blower
if(ConfigCrafting.LEAF_BLOWER.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlower),
" F", "IP", "IC",
- 'F', new ItemStack(Items.flint),
+ 'F', new ItemStack(Items.FLINT),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
- 'P', new ItemStack(Blocks.piston),
+ 'P', new ItemStack(Blocks.PISTON),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeLeafBlower = Util.GetRecipes.lastIRecipe();
+ recipeLeafBlower = RecipeUtil.lastIRecipe();
}
//Drill
@@ -164,12 +188,12 @@ public class ItemCrafting{
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DRILL_CORE.ordinal()),
'I', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeDrill = Util.GetRecipes.lastIRecipe();
+ recipeDrill = RecipeUtil.lastIRecipe();
for(int i = 0; i < 16; i++){
if(i != TheColoredLampColors.LIGHT_BLUE.ordinal()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemDrill, 1, i), lightBlueDrill.copy(), "dye"+TheColoredLampColors.values()[i].name));
- recipesDrillColoring.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_DRILL_COLORING.add(RecipeUtil.lastIRecipe());
}
}
}
@@ -181,7 +205,7 @@ public class ItemCrafting{
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'I', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeDrillCore = Util.GetRecipes.lastIRecipe();
+ recipeDrillCore = RecipeUtil.lastIRecipe();
}
//Tele Staff
@@ -192,7 +216,7 @@ public class ItemCrafting{
'E', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()),
'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()),
'B', new ItemStack(InitItems.itemBattery, 1, Util.WILDCARD)));
- recipeStaff = Util.GetRecipes.lastIRecipe();
+ recipeStaff = RecipeUtil.lastIRecipe();
}
//Drill Speed
@@ -200,40 +224,40 @@ public class ItemCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeed),
"ISI", "SRS", "ISI",
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
- 'S', Items.sugar,
+ 'S', Items.SUGAR,
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal())));
- recipeDrillSpeedI = Util.GetRecipes.lastIRecipe();
+ recipeDrillSpeedI = RecipeUtil.lastIRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedII),
"ISI", "SCS", "ISI",
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
- 'S', Items.sugar,
- 'C', Items.cake));
- recipeDrillSpeedII = Util.GetRecipes.lastIRecipe();
+ 'S', Items.SUGAR,
+ 'C', Items.CAKE));
+ recipeDrillSpeedII = RecipeUtil.lastIRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedIII),
"ISI", "SFS", "ISI",
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
- 'S', Items.sugar,
+ 'S', Items.SUGAR,
'F', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal())));
- recipeDrillSpeedIII = Util.GetRecipes.lastIRecipe();
+ recipeDrillSpeedIII = RecipeUtil.lastIRecipe();
}
//Drill Fortune
if(ConfigCrafting.DRILL_FORTUNE.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortune),
"ISI", "SRS", "ISI",
- 'I', Blocks.glowstone,
- 'S', Items.redstone,
+ 'I', Blocks.GLOWSTONE,
+ 'S', Items.REDSTONE,
'R', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal())));
- recipeDrillFortuneI = Util.GetRecipes.lastIRecipe();
+ recipeDrillFortuneI = RecipeUtil.lastIRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortuneII),
"ISI", "SRS", "ISI",
- 'I', Blocks.glowstone,
+ 'I', Blocks.GLOWSTONE,
'S', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal())));
- recipeDrillFortuneII = Util.GetRecipes.lastIRecipe();
+ recipeDrillFortuneII = RecipeUtil.lastIRecipe();
}
//Drill Size
@@ -243,14 +267,14 @@ public class ItemCrafting{
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal())));
- recipeDrillThree = Util.GetRecipes.lastIRecipe();
+ recipeDrillThree = RecipeUtil.lastIRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFiveByFive),
"DID", "ICI", "DID",
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeDrillFive = Util.GetRecipes.lastIRecipe();
+ recipeDrillFive = RecipeUtil.lastIRecipe();
}
//Drill Silk Touch
@@ -260,7 +284,7 @@ public class ItemCrafting{
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()),
'S', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeDrillSilk = Util.GetRecipes.lastIRecipe();
+ recipeDrillSilk = RecipeUtil.lastIRecipe();
}
//Drill Placing
@@ -268,10 +292,10 @@ public class ItemCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeBlockPlacing),
"CEC", "RAR", "CEC",
'C', "cobblestone",
- 'E', Items.paper,
+ 'E', Items.PAPER,
'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal())));
- recipeDrillPlacing = Util.GetRecipes.lastIRecipe();
+ recipeDrillPlacing = RecipeUtil.lastIRecipe();
}
//Battery
@@ -281,7 +305,7 @@ public class ItemCrafting{
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeBattery = Util.GetRecipes.lastIRecipe();
+ recipeBattery = RecipeUtil.lastIRecipe();
}
//Double Battery
@@ -291,7 +315,7 @@ public class ItemCrafting{
'R', new ItemStack(InitItems.itemBattery),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeBatteryDouble = Util.GetRecipes.lastIRecipe();
+ recipeBatteryDouble = RecipeUtil.lastIRecipe();
}
//Magnet Ring
@@ -300,29 +324,29 @@ public class ItemCrafting{
"RIB", "IOI", "BIR",
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
- 'B', new ItemStack(Items.dye, 1, 4),
+ 'B', new ItemStack(Items.DYE, 1, 4),
'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())));
- recipeMagnetRing = Util.GetRecipes.lastIRecipe();
+ recipeMagnetRing = RecipeUtil.lastIRecipe();
}
//Growth Ring
if(ConfigCrafting.GROWTH_RING.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemGrowthRing),
"SIS", "IOI", "SIS",
- 'S', new ItemStack(Items.wheat_seeds),
+ 'S', new ItemStack(Items.WHEAT_SEEDS),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())));
- recipeGrowthRing = Util.GetRecipes.lastIRecipe();
+ recipeGrowthRing = RecipeUtil.lastIRecipe();
}
//Water Ring
if(ConfigCrafting.WATER_RING.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemWaterRemovalRing),
"BIB", "IOI", "BIB",
- 'B', new ItemStack(Items.water_bucket),
+ 'B', new ItemStack(Items.WATER_BUCKET),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())));
- recipeWaterRing = Util.GetRecipes.lastIRecipe();
+ recipeWaterRing = RecipeUtil.lastIRecipe();
}
//Triple Battery
@@ -332,7 +356,7 @@ public class ItemCrafting{
'R', new ItemStack(InitItems.itemBatteryDouble),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeBatteryTriple = Util.GetRecipes.lastIRecipe();
+ recipeBatteryTriple = RecipeUtil.lastIRecipe();
}
//Quadruple Battery
@@ -342,7 +366,7 @@ public class ItemCrafting{
'R', new ItemStack(InitItems.itemBatteryTriple),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeBatteryQuadruple = Util.GetRecipes.lastIRecipe();
+ recipeBatteryQuadruple = RecipeUtil.lastIRecipe();
}
//Quintuple Battery
@@ -352,7 +376,7 @@ public class ItemCrafting{
'R', new ItemStack(InitItems.itemBatteryQuadruple),
'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeBatteryQuintuple = Util.GetRecipes.lastIRecipe();
+ recipeBatteryQuintuple = RecipeUtil.lastIRecipe();
}
//Bat Wings
@@ -361,15 +385,15 @@ public class ItemCrafting{
"WNW", "WDW", "WNW",
'W', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal()),
'N', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()),
- 'D', new ItemStack(Items.nether_star)));
- recipeWings = Util.GetRecipes.lastIRecipe();
+ 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal())));
+ recipeWings = RecipeUtil.lastIRecipe();
}
//Quartz
if(ConfigCrafting.QUARTZ.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()),
- new ItemStack(Items.coal),
- new ItemStack(Items.quartz)));
+ new ItemStack(Items.COAL),
+ new ItemStack(Items.QUARTZ)));
}
//Coil
@@ -378,7 +402,7 @@ public class ItemCrafting{
" R ", "RIR", " R ",
'I', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()),
'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal())));
- recipeCoil = Util.GetRecipes.lastIRecipe();
+ recipeCoil = RecipeUtil.lastIRecipe();
}
//Cup
@@ -387,13 +411,13 @@ public class ItemCrafting{
"S S", "SCS", "SSS",
'S', "stone",
'C', InitItems.itemCoffeeBean));
- recipeCup = Util.GetRecipes.lastIRecipe();
+ recipeCup = RecipeUtil.lastIRecipe();
}
//Resonant Rice
- if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium").isEmpty()){
+ if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium", false).isEmpty()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice),
- new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), "nuggetEnderium", Items.gunpowder));
+ new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), "nuggetEnderium", Items.GUNPOWDER));
}
//Advanced Coil
@@ -402,28 +426,28 @@ public class ItemCrafting{
" G ", "GCG", " G ",
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'G', "ingotGold"));
- recipeCoilAdvanced = Util.GetRecipes.lastIRecipe();
+ recipeCoilAdvanced = RecipeUtil.lastIRecipe();
}
//Advanced Leaf Blower
if(ConfigCrafting.LEAF_BLOWER_ADVANCED.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced),
" F", "DP", "DC",
- 'F', new ItemStack(Items.flint),
+ 'F', new ItemStack(Items.FLINT),
'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()),
- 'P', new ItemStack(Blocks.piston),
+ 'P', new ItemStack(Blocks.PISTON),
'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal())));
- recipeLeafBlowerAdvanced = Util.GetRecipes.lastIRecipe();
+ recipeLeafBlowerAdvanced = RecipeUtil.lastIRecipe();
}
//Phantom Connector
if(ConfigCrafting.PHANTOM_CONNECTOR.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemPhantomConnector),
"YE", "EY", "S ",
- 'Y', Items.ender_eye,
- 'E', Items.ender_pearl,
+ 'Y', Items.ENDER_EYE,
+ 'E', Items.ENDER_PEARL,
'S', "stickWood"));
- recipePhantomConnector = Util.GetRecipes.lastIRecipe();
+ recipePhantomConnector = RecipeUtil.lastIRecipe();
}
//Quartz
@@ -435,23 +459,23 @@ public class ItemCrafting{
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemKnife),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal())));
- recipeKnife = Util.GetRecipes.lastIRecipe();
+ recipeKnife = RecipeUtil.lastIRecipe();
}
//Crafter on a Stick
if(ConfigCrafting.STICK_CRAFTER.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemCrafterOnAStick),
- new ItemStack(Blocks.crafting_table),
- new ItemStack(Items.sign)));
+ new ItemStack(Blocks.CRAFTING_TABLE),
+ new ItemStack(Items.SIGN)));
}
//Tiny Coal
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_COAL.ordinal()),
- new ItemStack(Items.coal));
- recipeTinyCoal = Util.GetRecipes.lastIRecipe();
+ new ItemStack(Items.COAL));
+ recipeTinyCoal = RecipeUtil.lastIRecipe();
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_CHAR.ordinal()),
- new ItemStack(Items.coal, 1, 1));
- recipeTinyChar = Util.GetRecipes.lastIRecipe();
+ new ItemStack(Items.COAL, 1, 1));
+ recipeTinyChar = RecipeUtil.lastIRecipe();
//Rice Seeds
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemRiceSeed),
@@ -466,21 +490,21 @@ public class ItemCrafting{
//Ingots from Dusts
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal()),
- new ItemStack(Items.iron_ingot), 1F);
+ new ItemStack(Items.IRON_INGOT), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()),
- new ItemStack(Items.gold_ingot), 1F);
+ new ItemStack(Items.GOLD_INGOT), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.DIAMOND.ordinal()),
- new ItemStack(Items.diamond), 1F);
+ new ItemStack(Items.DIAMOND), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.EMERALD.ordinal()),
- new ItemStack(Items.emerald), 1F);
+ new ItemStack(Items.EMERALD), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.LAPIS.ordinal()),
- new ItemStack(Items.dye, 1, 4), 1F);
+ new ItemStack(Items.DYE, 1, 4), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.QUARTZ_BLACK.ordinal()),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.QUARTZ.ordinal()),
- new ItemStack(Items.quartz), 1F);
+ new ItemStack(Items.QUARTZ), 1F);
GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()),
- new ItemStack(Items.coal), 1F);
+ new ItemStack(Items.COAL), 1F);
}
@@ -490,7 +514,7 @@ public class ItemCrafting{
'G', "ingotGold",
'I', "ingotIron",
'D', "dustGlowstone"));
- recipeRing = Util.GetRecipes.lastIRecipe();
+ recipeRing = RecipeUtil.lastIRecipe();
if(ConfigCrafting.RING_SPEED.isEnabled()){
addRingRecipeWithStack(ThePotionRings.SPEED.craftingItem, ThePotionRings.SPEED.ordinal());
@@ -525,20 +549,20 @@ public class ItemCrafting{
}
public static void addRingRecipeWithStack(ItemStack mainStack, int meta){
- GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, meta), mainStack, mainStack, mainStack, mainStack, new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), new ItemStack(Items.nether_wart), new ItemStack(Items.potionitem), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()));
- recipesPotionRings.add(Util.GetRecipes.lastIRecipe());
- GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(Items.nether_star), new ItemStack(Items.nether_star));
- recipesPotionRings.add(Util.GetRecipes.lastIRecipe());
+ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, meta), mainStack, mainStack, mainStack, mainStack, new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), new ItemStack(Items.NETHER_WART), new ItemStack(Items.POTIONITEM), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()));
+ RECIPES_POTION_RINGS.add(RecipeUtil.lastIRecipe());
+ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal()));
+ RECIPES_POTION_RINGS.add(RecipeUtil.lastIRecipe());
}
public static void initMashedFoodRecipes(){
if(ConfigCrafting.MASHED_FOOD.isEnabled()){
- for(Item item : Item.itemRegistry){
+ for(Item item : Item.REGISTRY){
if(item instanceof ItemFood || item instanceof IPlantable || item instanceof IGrowable){
if(!isBlacklisted(item)){
ItemStack ingredient = new ItemStack(item, 1, Util.WILDCARD);
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
- recipesMashedFood.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_MASHED_FOOD.add(RecipeUtil.lastIRecipe());
}
}
}
@@ -546,8 +570,8 @@ public class ItemCrafting{
}
private static boolean isBlacklisted(Item item){
- for(String except : ConfigValues.mashedFoodCraftingExceptions){
- if(item.getRegistryName().equals(except)){
+ for(String except : ConfigStringListValues.MASHED_FOOD_CRAFTING_EXCEPTIONS.getValue()){
+ if(item.getRegistryName().toString().equals(except)){
return true;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java
index 9618d86cd..6e93843d7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/MiscCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("MiscCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("MiscCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
@@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
-import de.ellpeck.actuallyadditions.mod.util.Util;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
@@ -24,50 +24,54 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
-public class MiscCrafting{
+public final class MiscCrafting{
- public static IRecipe[] recipesCrystals = new IRecipe[TheCrystals.values().length];
- public static IRecipe[] recipesCrystalBlocks = new IRecipe[TheCrystals.values().length];
+ public static final IRecipe[] RECIPES_CRYSTALS = new IRecipe[TheCrystals.values().length];
+ public static final IRecipe[] RECIPES_CRYSTAL_BLOCKS = new IRecipe[TheCrystals.values().length];
public static void init(){
+ //Bio Coal
+ GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()),
+ new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOCOAL.ordinal()), 1.0F);
+
//Crystals
for(int i = 0; i < TheCrystals.values().length; i++){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCrystal, 1, i),
"XXX", "XXX", "XXX",
'X', new ItemStack(InitItems.itemCrystal, 1, i)));
- recipesCrystalBlocks[i] = Util.GetRecipes.lastIRecipe();
+ RECIPES_CRYSTAL_BLOCKS[i] = RecipeUtil.lastIRecipe();
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemCrystal, 9, i), new ItemStack(InitBlocks.blockCrystal, 1, i)));
- recipesCrystals[i] = Util.GetRecipes.lastIRecipe();
+ RECIPES_CRYSTALS[i] = RecipeUtil.lastIRecipe();
}
//Dough
if(ConfigCrafting.DOUGH.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()),
"cropWheat", "cropWheat"));
- ItemCrafting.recipeDough = Util.GetRecipes.lastIRecipe();
+ ItemCrafting.recipeDough = RecipeUtil.lastIRecipe();
}
//Rice Dough
if(ConfigCrafting.RICE_DOUGH.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.RICE_DOUGH.ordinal()),
new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal())));
- ItemCrafting.recipeRiceDough = Util.GetRecipes.lastIRecipe();
+ ItemCrafting.recipeRiceDough = RecipeUtil.lastIRecipe();
}
//Paper Cone
if(ConfigCrafting.PAPER_CONE.isEnabled()){
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
"P P", " P ",
- 'P', new ItemStack(Items.paper));
+ 'P', new ItemStack(Items.PAPER));
}
//Knife Handle
if(ConfigCrafting.KNIFE_HANDLE.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()),
"stickWood",
- new ItemStack(Items.leather)));
- ItemCrafting.recipeKnifeHandle = Util.GetRecipes.lastIRecipe();
+ new ItemStack(Items.LEATHER)));
+ ItemCrafting.recipeKnifeHandle = RecipeUtil.lastIRecipe();
}
//Knife Blade
@@ -75,8 +79,17 @@ public class MiscCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
"K", "K", "F",
'K', "ingotIron",
- 'F', new ItemStack(Items.flint)));
- ItemCrafting.recipeKnifeBlade = Util.GetRecipes.lastIRecipe();
+ 'F', new ItemStack(Items.FLINT)));
+ ItemCrafting.recipeKnifeBlade = RecipeUtil.lastIRecipe();
+ }
+
+ //Ender Star
+ if(ConfigCrafting.ENDER_STAR.isEnabled()){
+ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal()),
+ new ItemStack(Items.NETHER_STAR),
+ new ItemStack(Items.DRAGON_BREATH),
+ new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())));
+ ItemCrafting.recipeEnderStar = RecipeUtil.lastIRecipe();
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java
index 03649ffc4..d0974ae16 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ToolCrafting.java
@@ -1,11 +1,11 @@
/*
- * This file ("ToolCrafting.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ToolCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.crafting;
@@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
-import de.ellpeck.actuallyadditions.mod.util.Util;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@@ -26,14 +26,14 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.ArrayList;
-public class ToolCrafting{
+public final class ToolCrafting{
- public static ArrayList recipesPaxels = new ArrayList();
+ public static final ArrayList RECIPES_PAXELS = new ArrayList();
public static void init(){
if(ConfigCrafting.TOOL_EMERALD.isEnabled()){
- addToolAndArmorRecipes(new ItemStack(Items.emerald), InitItems.itemPickaxeEmerald, InitItems.itemSwordEmerald, InitItems.itemAxeEmerald, InitItems.itemShovelEmerald, InitItems.itemHoeEmerald, InitItems.itemHelmEmerald, InitItems.itemChestEmerald, InitItems.itemPantsEmerald, InitItems.itemBootsEmerald);
+ addToolAndArmorRecipes(new ItemStack(Items.EMERALD), InitItems.itemPickaxeEmerald, InitItems.itemSwordEmerald, InitItems.itemAxeEmerald, InitItems.itemShovelEmerald, InitItems.itemHoeEmerald, InitItems.itemHelmEmerald, InitItems.itemChestEmerald, InitItems.itemPantsEmerald, InitItems.itemBootsEmerald);
}
if(ConfigCrafting.TOOL_QUARTZ.isEnabled()){
@@ -41,7 +41,7 @@ public class ToolCrafting{
}
if(ConfigCrafting.TOOL_OBSIDIAN.isEnabled()){
- addToolAndArmorRecipes(new ItemStack(Blocks.obsidian), InitItems.itemPickaxeObsidian, InitItems.itemSwordObsidian, InitItems.itemAxeObsidian, InitItems.itemShovelObsidian, InitItems.itemHoeObsidian, InitItems.itemHelmObsidian, InitItems.itemChestObsidian, InitItems.itemPantsObsidian, InitItems.itemBootsObsidian);
+ addToolAndArmorRecipes(new ItemStack(Blocks.OBSIDIAN), InitItems.itemPickaxeObsidian, InitItems.itemSwordObsidian, InitItems.itemAxeObsidian, InitItems.itemShovelObsidian, InitItems.itemHoeObsidian, InitItems.itemHelmObsidian, InitItems.itemChestObsidian, InitItems.itemPantsObsidian, InitItems.itemBootsObsidian);
}
if(ConfigCrafting.TOOL_CRYSTALS.isEnabled()){
@@ -56,61 +56,61 @@ public class ToolCrafting{
//Paxels
if(ConfigCrafting.PAXELS.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.woodenPaxel),
- new ItemStack(Items.wooden_axe),
- new ItemStack(Items.wooden_pickaxe),
- new ItemStack(Items.wooden_shovel),
- new ItemStack(Items.wooden_sword),
- new ItemStack(Items.wooden_hoe)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ new ItemStack(Items.WOODEN_AXE),
+ new ItemStack(Items.WOODEN_PICKAXE),
+ new ItemStack(Items.WOODEN_SHOVEL),
+ new ItemStack(Items.WOODEN_SWORD),
+ new ItemStack(Items.WOODEN_HOE)));
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.stonePaxel),
- new ItemStack(Items.stone_axe),
- new ItemStack(Items.stone_pickaxe),
- new ItemStack(Items.stone_shovel),
- new ItemStack(Items.stone_sword),
- new ItemStack(Items.stone_hoe)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ new ItemStack(Items.STONE_AXE),
+ new ItemStack(Items.STONE_PICKAXE),
+ new ItemStack(Items.STONE_SHOVEL),
+ new ItemStack(Items.STONE_SWORD),
+ new ItemStack(Items.STONE_HOE)));
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.ironPaxel),
- new ItemStack(Items.iron_axe),
- new ItemStack(Items.iron_pickaxe),
- new ItemStack(Items.iron_shovel),
- new ItemStack(Items.iron_sword),
- new ItemStack(Items.iron_hoe)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ new ItemStack(Items.IRON_AXE),
+ new ItemStack(Items.IRON_PICKAXE),
+ new ItemStack(Items.IRON_SHOVEL),
+ new ItemStack(Items.IRON_SWORD),
+ new ItemStack(Items.IRON_HOE)));
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.goldPaxel),
- new ItemStack(Items.golden_axe),
- new ItemStack(Items.golden_pickaxe),
- new ItemStack(Items.golden_shovel),
- new ItemStack(Items.golden_sword),
- new ItemStack(Items.golden_hoe)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ new ItemStack(Items.GOLDEN_AXE),
+ new ItemStack(Items.GOLDEN_PICKAXE),
+ new ItemStack(Items.GOLDEN_SHOVEL),
+ new ItemStack(Items.GOLDEN_SWORD),
+ new ItemStack(Items.GOLDEN_HOE)));
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.diamondPaxel),
- new ItemStack(Items.diamond_axe),
- new ItemStack(Items.diamond_pickaxe),
- new ItemStack(Items.diamond_shovel),
- new ItemStack(Items.diamond_sword),
- new ItemStack(Items.diamond_hoe)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ new ItemStack(Items.DIAMOND_AXE),
+ new ItemStack(Items.DIAMOND_PICKAXE),
+ new ItemStack(Items.DIAMOND_SHOVEL),
+ new ItemStack(Items.DIAMOND_SWORD),
+ new ItemStack(Items.DIAMOND_HOE)));
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.emeraldPaxel),
new ItemStack(InitItems.itemAxeEmerald),
new ItemStack(InitItems.itemPickaxeEmerald),
new ItemStack(InitItems.itemSwordEmerald),
new ItemStack(InitItems.itemShovelEmerald),
new ItemStack(InitItems.itemHoeEmerald)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.obsidianPaxel),
new ItemStack(InitItems.itemAxeObsidian),
new ItemStack(InitItems.itemPickaxeObsidian),
new ItemStack(InitItems.itemSwordObsidian),
new ItemStack(InitItems.itemShovelObsidian),
new ItemStack(InitItems.itemHoeObsidian)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.quartzPaxel),
new ItemStack(InitItems.itemAxeQuartz),
new ItemStack(InitItems.itemPickaxeQuartz),
new ItemStack(InitItems.itemSwordQuartz),
new ItemStack(InitItems.itemShovelQuartz),
new ItemStack(InitItems.itemHoeQuartz)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemPaxelCrystalRed),
new ItemStack(InitItems.itemAxeCrystalRed),
@@ -118,42 +118,42 @@ public class ToolCrafting{
new ItemStack(InitItems.itemSwordCrystalRed),
new ItemStack(InitItems.itemShovelCrystalRed),
new ItemStack(InitItems.itemHoeCrystalRed)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemPaxelCrystalGreen),
new ItemStack(InitItems.itemAxeCrystalGreen),
new ItemStack(InitItems.itemPickaxeCrystalGreen),
new ItemStack(InitItems.itemSwordCrystalGreen),
new ItemStack(InitItems.itemShovelCrystalGreen),
new ItemStack(InitItems.itemHoeCrystalGreen)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemPaxelCrystalBlue),
new ItemStack(InitItems.itemAxeCrystalBlue),
new ItemStack(InitItems.itemPickaxeCrystalBlue),
new ItemStack(InitItems.itemSwordCrystalBlue),
new ItemStack(InitItems.itemShovelCrystalBlue),
new ItemStack(InitItems.itemHoeCrystalBlue)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemPaxelCrystalLightBlue),
new ItemStack(InitItems.itemAxeCrystalLightBlue),
new ItemStack(InitItems.itemPickaxeCrystalLightBlue),
new ItemStack(InitItems.itemSwordCrystalLightBlue),
new ItemStack(InitItems.itemShovelCrystalLightBlue),
new ItemStack(InitItems.itemHoeCrystalLightBlue)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemPaxelCrystalBlack),
new ItemStack(InitItems.itemAxeCrystalBlack),
new ItemStack(InitItems.itemPickaxeCrystalBlack),
new ItemStack(InitItems.itemSwordCrystalBlack),
new ItemStack(InitItems.itemShovelCrystalBlack),
new ItemStack(InitItems.itemHoeCrystalBlack)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemPaxelCrystalWhite),
new ItemStack(InitItems.itemAxeCrystalWhite),
new ItemStack(InitItems.itemPickaxeCrystalWhite),
new ItemStack(InitItems.itemSwordCrystalWhite),
new ItemStack(InitItems.itemShovelCrystalWhite),
new ItemStack(InitItems.itemHoeCrystalWhite)));
- recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
}
}
@@ -162,31 +162,31 @@ public class ToolCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(pickaxe),
"EEE", " S ", " S ",
'E', base,
- 'S', new ItemStack(Items.stick)));
+ 'S', new ItemStack(Items.STICK)));
//Sword
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(sword),
"E", "E", "S",
'E', base,
- 'S', new ItemStack(Items.stick)));
+ 'S', new ItemStack(Items.STICK)));
//Axe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(axe),
"EE", "ES", " S",
'E', base,
- 'S', new ItemStack(Items.stick)));
+ 'S', new ItemStack(Items.STICK)));
//Shovel
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(shovel),
"E", "S", "S",
'E', base,
- 'S', new ItemStack(Items.stick)));
+ 'S', new ItemStack(Items.STICK)));
//Hoe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(hoe),
"EE", " S", " S",
'E', base,
- 'S', new ItemStack(Items.stick)));
+ 'S', new ItemStack(Items.STICK)));
//Helm
GameRegistry.addRecipe(new ItemStack(helm),
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java
index fb9c016fd..accdf5025 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java
@@ -1,16 +1,17 @@
/*
- * This file ("CreativeTab.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("CreativeTab.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.creative;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
+import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.InitForeignPaxels;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
@@ -18,6 +19,8 @@ import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.ForgeModContainer;
+import net.minecraftforge.fluids.UniversalBucket;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -25,11 +28,11 @@ import java.util.List;
public class CreativeTab extends CreativeTabs{
- public static CreativeTab instance = new CreativeTab();
- private List list;
+ public static final CreativeTab INSTANCE = new CreativeTab();
+ private List list;
public CreativeTab(){
- super(ModUtil.MOD_ID_LOWER);
+ super(ModUtil.MOD_ID);
}
@Override
@@ -44,261 +47,278 @@ public class CreativeTab extends CreativeTabs{
@Override
@SideOnly(Side.CLIENT)
- public void displayAllReleventItems(List list){
+ public void displayAllRelevantItems(List list){
this.list = list;
- add(InitItems.itemBooklet);
- add(InitBlocks.blockSmileyCloud);
+ this.add(InitItems.itemBooklet);
+ this.add(InitBlocks.blockSmileyCloud);
- add(InitBlocks.blockFireworkBox);
- add(InitBlocks.blockLaserRelay);
- add(InitBlocks.blockAtomicReconstructor);
- add(InitBlocks.blockPhantomface);
- add(InitBlocks.blockPhantomEnergyface);
- add(InitBlocks.blockPhantomLiquiface);
- add(InitBlocks.blockPhantomPlacer);
- add(InitBlocks.blockPhantomBreaker);
- add(InitBlocks.blockInputter);
- add(InitBlocks.blockInputterAdvanced);
- add(InitBlocks.blockPhantomBooster);
- add(InitBlocks.blockCoffeeMachine);
- add(InitBlocks.blockXPSolidifier);
+ this.add(InitBlocks.blockFireworkBox);
+ this.add(InitBlocks.blockLaserRelay);
+ this.add(InitBlocks.blockLaserRelayItem);
+ this.add(InitBlocks.blockLaserRelayItemWhitelist);
+ this.add(InitBlocks.blockItemViewer);
+ this.add(InitBlocks.blockAtomicReconstructor);
+ this.add(InitBlocks.blockPhantomface);
+ this.add(InitBlocks.blockPhantomEnergyface);
+ this.add(InitBlocks.blockPhantomLiquiface);
+ this.add(InitBlocks.blockPhantomRedstoneface);
+ this.add(InitBlocks.blockPhantomPlacer);
+ this.add(InitBlocks.blockPhantomBreaker);
+ this.add(InitBlocks.blockPlayerInterface);
+ this.add(InitBlocks.blockInputter);
+ this.add(InitBlocks.blockInputterAdvanced);
+ this.add(InitBlocks.blockPhantomBooster);
+ this.add(InitBlocks.blockCoffeeMachine);
+ this.add(InitBlocks.blockXPSolidifier);
+ this.add(InitBlocks.blockDisplayStand);
- add(InitBlocks.blockMiner);
- add(InitBlocks.blockGreenhouseGlass);
- add(InitBlocks.blockGrinder);
- add(InitBlocks.blockGrinderDouble);
- add(InitBlocks.blockFurnaceDouble);
- add(InitBlocks.blockLavaFactoryController);
+ this.add(InitBlocks.blockShockSuppressor);
+ this.add(InitBlocks.blockMiner);
+ this.add(InitBlocks.blockGreenhouseGlass);
+ this.add(InitBlocks.blockGrinder);
+ this.add(InitBlocks.blockGrinderDouble);
+ this.add(InitBlocks.blockFurnaceDouble);
+ this.add(InitBlocks.blockLavaFactoryController);
- add(InitBlocks.blockEnergizer);
- add(InitBlocks.blockEnervator);
+ this.add(InitBlocks.blockEnergizer);
+ this.add(InitBlocks.blockEnervator);
- add(InitBlocks.blockFurnaceSolar);
- add(InitBlocks.blockHeatCollector);
- add(InitBlocks.blockCoalGenerator);
- add(InitBlocks.blockOilGenerator);
- add(InitBlocks.blockLeafGenerator);
+ this.add(InitBlocks.blockFurnaceSolar);
+ this.add(InitBlocks.blockHeatCollector);
+ this.add(InitBlocks.blockCoalGenerator);
+ this.add(InitBlocks.blockOilGenerator);
+ this.add(InitBlocks.blockLeafGenerator);
- add(InitBlocks.blockItemRepairer);
- add(InitBlocks.blockFishingNet);
- add(InitBlocks.blockBreaker);
- add(InitBlocks.blockDirectionalBreaker);
- add(InitBlocks.blockRangedCollector);
- add(InitBlocks.blockPlacer);
- add(InitBlocks.blockDropper);
- add(InitBlocks.blockFluidPlacer);
- add(InitBlocks.blockFluidCollector);
+ this.add(InitBlocks.blockItemRepairer);
+ this.add(InitBlocks.blockFishingNet);
+ this.add(InitBlocks.blockBreaker);
+ this.add(InitBlocks.blockDirectionalBreaker);
+ this.add(InitBlocks.blockRangedCollector);
+ this.add(InitBlocks.blockPlacer);
+ this.add(InitBlocks.blockDropper);
+ this.add(InitBlocks.blockFluidPlacer);
+ this.add(InitBlocks.blockFluidCollector);
- add(InitBlocks.blockMisc);
- add(InitBlocks.blockFeeder);
- add(InitBlocks.blockCompost);
- add(InitBlocks.blockGiantChest);
- add(InitBlocks.blockCanolaPress);
- add(InitBlocks.blockFermentingBarrel);
+ this.add(InitBlocks.blockMisc);
+ this.add(InitBlocks.blockFeeder);
+ this.add(InitBlocks.blockCompost);
+ this.add(InitBlocks.blockGiantChest);
+ this.add(InitBlocks.blockGiantChestMedium);
+ this.add(InitBlocks.blockGiantChestLarge);
+ this.add(InitBlocks.blockCanolaPress);
+ this.add(InitBlocks.blockFermentingBarrel);
- add(InitBlocks.blockTestifiBucksGreenWall);
- add(InitBlocks.blockTestifiBucksWhiteWall);
- add(InitBlocks.blockTestifiBucksGreenStairs);
- add(InitBlocks.blockTestifiBucksWhiteStairs);
- add(InitBlocks.blockTestifiBucksGreenSlab);
- add(InitBlocks.blockTestifiBucksWhiteSlab);
- add(InitBlocks.blockTestifiBucksGreenFence);
- add(InitBlocks.blockTestifiBucksWhiteFence);
+ this.add(InitBlocks.blockTestifiBucksGreenWall);
+ this.add(InitBlocks.blockTestifiBucksWhiteWall);
+ this.add(InitBlocks.blockTestifiBucksGreenStairs);
+ this.add(InitBlocks.blockTestifiBucksWhiteStairs);
+ this.add(InitBlocks.blockTestifiBucksGreenSlab);
+ this.add(InitBlocks.blockTestifiBucksWhiteSlab);
+ this.add(InitBlocks.blockTestifiBucksGreenFence);
+ this.add(InitBlocks.blockTestifiBucksWhiteFence);
- add(InitBlocks.blockQuartzWall);
- add(InitBlocks.blockQuartzStair);
- add(InitBlocks.blockQuartzSlab);
- add(InitBlocks.blockChiseledQuartzWall);
- add(InitBlocks.blockChiseledQuartzStair);
- add(InitBlocks.blockChiseledQuartzSlab);
- add(InitBlocks.blockPillarQuartzWall);
- add(InitBlocks.blockPillarQuartzStair);
- add(InitBlocks.blockPillarQuartzSlab);
+ this.add(InitBlocks.blockQuartzWall);
+ this.add(InitBlocks.blockQuartzStair);
+ this.add(InitBlocks.blockQuartzSlab);
+ this.add(InitBlocks.blockChiseledQuartzWall);
+ this.add(InitBlocks.blockChiseledQuartzStair);
+ this.add(InitBlocks.blockChiseledQuartzSlab);
+ this.add(InitBlocks.blockPillarQuartzWall);
+ this.add(InitBlocks.blockPillarQuartzStair);
+ this.add(InitBlocks.blockPillarQuartzSlab);
- add(InitBlocks.blockColoredLamp);
- add(InitBlocks.blockColoredLampOn);
- add(InitBlocks.blockLampPowerer);
- add(InitBlocks.blockTreasureChest);
+ this.add(InitBlocks.blockColoredLamp);
+ this.add(InitBlocks.blockColoredLampOn);
+ this.add(InitBlocks.blockLampPowerer);
+ this.add(InitBlocks.blockTreasureChest);
- add(InitBlocks.blockBlackLotus);
+ this.add(InitBlocks.blockBlackLotus);
+ this.add(InitBlocks.blockBookletStand);
- add(InitItems.itemColorLens);
- add(InitItems.itemExplosionLens);
- add(InitItems.itemDamageLens);
- add(InitItems.itemLaserWrench);
- add(InitItems.itemCrateKeeper);
- add(InitItems.itemChestToCrateUpgrade);
+ this.add(InitItems.itemColorLens);
+ this.add(InitItems.itemExplosionLens);
+ this.add(InitItems.itemDamageLens);
+ this.add(InitItems.itemLaserWrench);
+ this.add(InitItems.itemCrateKeeper);
+ this.add(InitItems.itemChestToCrateUpgrade);
+ this.add(InitItems.itemSpawnerChanger);
+ this.add(InitItems.itemWaterBowl);
- add(InitItems.itemDrill);
- add(InitItems.itemDrillUpgradeSpeed);
- add(InitItems.itemDrillUpgradeSpeedII);
- add(InitItems.itemDrillUpgradeSpeedIII);
- add(InitItems.itemDrillUpgradeSilkTouch);
- add(InitItems.itemDrillUpgradeFortune);
- add(InitItems.itemDrillUpgradeFortuneII);
- add(InitItems.itemDrillUpgradeThreeByThree);
- add(InitItems.itemDrillUpgradeFiveByFive);
- add(InitItems.itemDrillUpgradeBlockPlacing);
- add(InitItems.itemBattery);
- add(InitItems.itemBatteryDouble);
- add(InitItems.itemBatteryTriple);
- add(InitItems.itemBatteryQuadruple);
- add(InitItems.itemBatteryQuintuple);
- add(InitItems.itemTeleStaff);
+ this.add(InitItems.itemDrill);
+ this.add(InitItems.itemDrillUpgradeSpeed);
+ this.add(InitItems.itemDrillUpgradeSpeedII);
+ this.add(InitItems.itemDrillUpgradeSpeedIII);
+ this.add(InitItems.itemDrillUpgradeSilkTouch);
+ this.add(InitItems.itemDrillUpgradeFortune);
+ this.add(InitItems.itemDrillUpgradeFortuneII);
+ this.add(InitItems.itemDrillUpgradeThreeByThree);
+ this.add(InitItems.itemDrillUpgradeFiveByFive);
+ this.add(InitItems.itemDrillUpgradeBlockPlacing);
+ this.add(InitItems.itemBattery);
+ this.add(InitItems.itemBatteryDouble);
+ this.add(InitItems.itemBatteryTriple);
+ this.add(InitItems.itemBatteryQuadruple);
+ this.add(InitItems.itemBatteryQuintuple);
+ this.add(InitItems.itemTeleStaff);
- add(InitItems.itemGrowthRing);
- add(InitItems.itemMagnetRing);
- add(InitItems.itemWaterRemovalRing);
+ this.add(InitItems.itemGrowthRing);
+ this.add(InitItems.itemMagnetRing);
+ this.add(InitItems.itemWaterRemovalRing);
- add(InitItems.itemPhantomConnector);
- add(InitItems.itemBucketCanolaOil);
- add(InitItems.itemBucketOil);
+ this.list.add(UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, InitFluids.fluidCanolaOil));
+ this.list.add(UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, InitFluids.fluidOil));
- add(InitItems.itemWingsOfTheBats);
+ this.add(InitItems.itemPhantomConnector);
+ this.add(InitItems.itemFilter);
+ this.add(InitItems.itemWingsOfTheBats);
- add(InitItems.itemCoffeeSeed);
- add(InitItems.itemCoffeeBean);
- add(InitItems.itemRiceSeed);
- add(InitItems.itemCanolaSeed);
- add(InitItems.itemFlaxSeed);
- add(InitItems.itemHairyBall);
- add(InitItems.itemMisc);
- add(InitItems.itemResonantRice);
- add(InitItems.itemFertilizer);
+ this.add(InitItems.itemCoffeeSeed);
+ this.add(InitItems.itemCoffeeBean);
+ this.add(InitItems.itemRiceSeed);
+ this.add(InitItems.itemCanolaSeed);
+ this.add(InitItems.itemFlaxSeed);
+ this.add(InitItems.itemHairyBall);
+ this.add(InitItems.itemMisc);
+ this.add(InitItems.itemResonantRice);
+ this.add(InitItems.itemFertilizer);
- add(InitItems.itemCoffee);
- add(InitItems.itemFoods);
- add(InitItems.itemKnife);
- add(InitItems.itemCrafterOnAStick);
- add(InitItems.itemDust);
- add(InitItems.itemSolidifiedExperience);
- add(InitItems.itemLeafBlower);
- add(InitItems.itemLeafBlowerAdvanced);
+ this.add(InitItems.itemCoffee);
+ this.add(InitItems.itemFoods);
+ this.add(InitItems.itemKnife);
+ this.add(InitItems.itemCrafterOnAStick);
+ this.add(InitItems.itemDust);
+ this.add(InitItems.itemSolidifiedExperience);
+ this.add(InitItems.itemLeafBlower);
+ this.add(InitItems.itemLeafBlowerAdvanced);
- add(InitItems.woodenPaxel);
- add(InitItems.stonePaxel);
- add(InitItems.ironPaxel);
- add(InitItems.goldPaxel);
- add(InitItems.diamondPaxel);
- add(InitItems.emeraldPaxel);
- add(InitItems.obsidianPaxel);
- add(InitItems.quartzPaxel);
- add(InitItems.itemPaxelCrystalRed);
- add(InitItems.itemPaxelCrystalBlue);
- add(InitItems.itemPaxelCrystalLightBlue);
- add(InitItems.itemPaxelCrystalBlack);
- add(InitItems.itemPaxelCrystalGreen);
- add(InitItems.itemPaxelCrystalWhite);
+ this.add(InitItems.woodenPaxel);
+ this.add(InitItems.stonePaxel);
+ this.add(InitItems.ironPaxel);
+ this.add(InitItems.goldPaxel);
+ this.add(InitItems.diamondPaxel);
+ this.add(InitItems.emeraldPaxel);
+ this.add(InitItems.obsidianPaxel);
+ this.add(InitItems.quartzPaxel);
+ this.add(InitItems.itemPaxelCrystalRed);
+ this.add(InitItems.itemPaxelCrystalBlue);
+ this.add(InitItems.itemPaxelCrystalLightBlue);
+ this.add(InitItems.itemPaxelCrystalBlack);
+ this.add(InitItems.itemPaxelCrystalGreen);
+ this.add(InitItems.itemPaxelCrystalWhite);
InitForeignPaxels.addToCreativeTab();
- add(InitBlocks.blockCrystal);
- add(InitItems.itemCrystal);
+ this.add(InitBlocks.blockCrystal);
+ this.add(InitItems.itemCrystal);
- add(InitItems.itemJams);
+ this.add(InitItems.itemJams);
- add(InitItems.itemPotionRing);
- add(InitItems.itemPotionRingAdvanced);
+ this.add(InitItems.itemPotionRing);
+ this.add(InitItems.itemPotionRingAdvanced);
- add(InitItems.itemPickaxeQuartz);
- add(InitItems.itemSwordQuartz);
- add(InitItems.itemAxeQuartz);
- add(InitItems.itemShovelQuartz);
- add(InitItems.itemHoeQuartz);
+ this.add(InitItems.itemPickaxeQuartz);
+ this.add(InitItems.itemSwordQuartz);
+ this.add(InitItems.itemAxeQuartz);
+ this.add(InitItems.itemShovelQuartz);
+ this.add(InitItems.itemHoeQuartz);
- add(InitItems.itemHelmQuartz);
- add(InitItems.itemChestQuartz);
- add(InitItems.itemPantsQuartz);
- add(InitItems.itemBootsQuartz);
+ this.add(InitItems.itemHelmQuartz);
+ this.add(InitItems.itemChestQuartz);
+ this.add(InitItems.itemPantsQuartz);
+ this.add(InitItems.itemBootsQuartz);
- add(InitItems.itemPickaxeEmerald);
- add(InitItems.itemSwordEmerald);
- add(InitItems.itemAxeEmerald);
- add(InitItems.itemShovelEmerald);
- add(InitItems.itemHoeEmerald);
+ this.add(InitItems.itemPickaxeEmerald);
+ this.add(InitItems.itemSwordEmerald);
+ this.add(InitItems.itemAxeEmerald);
+ this.add(InitItems.itemShovelEmerald);
+ this.add(InitItems.itemHoeEmerald);
- add(InitItems.itemHelmEmerald);
- add(InitItems.itemChestEmerald);
- add(InitItems.itemPantsEmerald);
- add(InitItems.itemBootsEmerald);
+ this.add(InitItems.itemHelmEmerald);
+ this.add(InitItems.itemChestEmerald);
+ this.add(InitItems.itemPantsEmerald);
+ this.add(InitItems.itemBootsEmerald);
- add(InitItems.itemPickaxeObsidian);
- add(InitItems.itemSwordObsidian);
- add(InitItems.itemAxeObsidian);
- add(InitItems.itemShovelObsidian);
- add(InitItems.itemHoeObsidian);
+ this.add(InitItems.itemPickaxeObsidian);
+ this.add(InitItems.itemSwordObsidian);
+ this.add(InitItems.itemAxeObsidian);
+ this.add(InitItems.itemShovelObsidian);
+ this.add(InitItems.itemHoeObsidian);
- add(InitItems.itemHelmObsidian);
- add(InitItems.itemChestObsidian);
- add(InitItems.itemPantsObsidian);
- add(InitItems.itemBootsObsidian);
+ this.add(InitItems.itemHelmObsidian);
+ this.add(InitItems.itemChestObsidian);
+ this.add(InitItems.itemPantsObsidian);
+ this.add(InitItems.itemBootsObsidian);
- add(InitItems.itemPickaxeCrystalRed);
- add(InitItems.itemAxeCrystalRed);
- add(InitItems.itemShovelCrystalRed);
- add(InitItems.itemSwordCrystalRed);
- add(InitItems.itemHoeCrystalRed);
- add(InitItems.itemHelmCrystalRed);
- add(InitItems.itemChestCrystalRed);
- add(InitItems.itemPantsCrystalRed);
- add(InitItems.itemBootsCrystalRed);
+ this.add(InitItems.itemPickaxeCrystalRed);
+ this.add(InitItems.itemAxeCrystalRed);
+ this.add(InitItems.itemShovelCrystalRed);
+ this.add(InitItems.itemSwordCrystalRed);
+ this.add(InitItems.itemHoeCrystalRed);
+ this.add(InitItems.itemHelmCrystalRed);
+ this.add(InitItems.itemChestCrystalRed);
+ this.add(InitItems.itemPantsCrystalRed);
+ this.add(InitItems.itemBootsCrystalRed);
- add(InitItems.itemPickaxeCrystalBlue);
- add(InitItems.itemAxeCrystalBlue);
- add(InitItems.itemShovelCrystalBlue);
- add(InitItems.itemSwordCrystalBlue);
- add(InitItems.itemHoeCrystalBlue);
- add(InitItems.itemHelmCrystalBlue);
- add(InitItems.itemChestCrystalBlue);
- add(InitItems.itemPantsCrystalBlue);
- add(InitItems.itemBootsCrystalBlue);
+ this.add(InitItems.itemPickaxeCrystalBlue);
+ this.add(InitItems.itemAxeCrystalBlue);
+ this.add(InitItems.itemShovelCrystalBlue);
+ this.add(InitItems.itemSwordCrystalBlue);
+ this.add(InitItems.itemHoeCrystalBlue);
+ this.add(InitItems.itemHelmCrystalBlue);
+ this.add(InitItems.itemChestCrystalBlue);
+ this.add(InitItems.itemPantsCrystalBlue);
+ this.add(InitItems.itemBootsCrystalBlue);
- add(InitItems.itemPickaxeCrystalLightBlue);
- add(InitItems.itemAxeCrystalLightBlue);
- add(InitItems.itemShovelCrystalLightBlue);
- add(InitItems.itemSwordCrystalLightBlue);
- add(InitItems.itemHoeCrystalLightBlue);
- add(InitItems.itemHelmCrystalLightBlue);
- add(InitItems.itemChestCrystalLightBlue);
- add(InitItems.itemPantsCrystalLightBlue);
- add(InitItems.itemBootsCrystalLightBlue);
+ this.add(InitItems.itemPickaxeCrystalLightBlue);
+ this.add(InitItems.itemAxeCrystalLightBlue);
+ this.add(InitItems.itemShovelCrystalLightBlue);
+ this.add(InitItems.itemSwordCrystalLightBlue);
+ this.add(InitItems.itemHoeCrystalLightBlue);
+ this.add(InitItems.itemHelmCrystalLightBlue);
+ this.add(InitItems.itemChestCrystalLightBlue);
+ this.add(InitItems.itemPantsCrystalLightBlue);
+ this.add(InitItems.itemBootsCrystalLightBlue);
- add(InitItems.itemPickaxeCrystalBlack);
- add(InitItems.itemAxeCrystalBlack);
- add(InitItems.itemShovelCrystalBlack);
- add(InitItems.itemSwordCrystalBlack);
- add(InitItems.itemHoeCrystalBlack);
- add(InitItems.itemHelmCrystalBlack);
- add(InitItems.itemChestCrystalBlack);
- add(InitItems.itemPantsCrystalBlack);
- add(InitItems.itemBootsCrystalBlack);
+ this.add(InitItems.itemPickaxeCrystalBlack);
+ this.add(InitItems.itemAxeCrystalBlack);
+ this.add(InitItems.itemShovelCrystalBlack);
+ this.add(InitItems.itemSwordCrystalBlack);
+ this.add(InitItems.itemHoeCrystalBlack);
+ this.add(InitItems.itemHelmCrystalBlack);
+ this.add(InitItems.itemChestCrystalBlack);
+ this.add(InitItems.itemPantsCrystalBlack);
+ this.add(InitItems.itemBootsCrystalBlack);
- add(InitItems.itemPickaxeCrystalGreen);
- add(InitItems.itemAxeCrystalGreen);
- add(InitItems.itemShovelCrystalGreen);
- add(InitItems.itemSwordCrystalGreen);
- add(InitItems.itemHoeCrystalGreen);
- add(InitItems.itemHelmCrystalGreen);
- add(InitItems.itemChestCrystalGreen);
- add(InitItems.itemPantsCrystalGreen);
- add(InitItems.itemBootsCrystalGreen);
+ this.add(InitItems.itemPickaxeCrystalGreen);
+ this.add(InitItems.itemAxeCrystalGreen);
+ this.add(InitItems.itemShovelCrystalGreen);
+ this.add(InitItems.itemSwordCrystalGreen);
+ this.add(InitItems.itemHoeCrystalGreen);
+ this.add(InitItems.itemHelmCrystalGreen);
+ this.add(InitItems.itemChestCrystalGreen);
+ this.add(InitItems.itemPantsCrystalGreen);
+ this.add(InitItems.itemBootsCrystalGreen);
- add(InitItems.itemPickaxeCrystalWhite);
- add(InitItems.itemAxeCrystalWhite);
- add(InitItems.itemShovelCrystalWhite);
- add(InitItems.itemSwordCrystalWhite);
- add(InitItems.itemHoeCrystalWhite);
- add(InitItems.itemHelmCrystalWhite);
- add(InitItems.itemChestCrystalWhite);
- add(InitItems.itemPantsCrystalWhite);
- add(InitItems.itemBootsCrystalWhite);
+ this.add(InitItems.itemPickaxeCrystalWhite);
+ this.add(InitItems.itemAxeCrystalWhite);
+ this.add(InitItems.itemShovelCrystalWhite);
+ this.add(InitItems.itemSwordCrystalWhite);
+ this.add(InitItems.itemHoeCrystalWhite);
+ this.add(InitItems.itemHelmCrystalWhite);
+ this.add(InitItems.itemChestCrystalWhite);
+ this.add(InitItems.itemPantsCrystalWhite);
+ this.add(InitItems.itemBootsCrystalWhite);
}
public void add(Item item){
- item.getSubItems(item, instance, this.list);
+ if(item != null){
+ item.getSubItems(item, INSTANCE, this.list);
+ }
}
public void add(Block block){
- block.getSubBlocks(new ItemStack(block).getItem(), instance, this.list);
+ if(block != null){
+ block.getSubBlocks(new ItemStack(block).getItem(), INSTANCE, this.list);
+ }
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentServerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java
similarity index 75%
rename from src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentServerData.java
rename to src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java
index 80bcb3501..2c4f5b8d7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentServerData.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java
@@ -1,14 +1,14 @@
/*
- * This file ("PersistentServerData.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("PersistentServerData.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
-package de.ellpeck.actuallyadditions.mod.util.playerdata;
+package de.ellpeck.actuallyadditions.mod.data;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@@ -16,27 +16,26 @@ import net.minecraft.nbt.NBTTagCompound;
import java.util.ArrayList;
import java.util.UUID;
-public class PersistentServerData{
+public final class PlayerData{
- public static ArrayList playerSaveData = new ArrayList();
-
- public static NBTTagCompound getDataFromPlayer(EntityPlayer player){
+ public static PlayerSave getDataFromPlayer(EntityPlayer player){
+ ArrayList data = WorldData.PLAYER_SAVE_DATA;
//Get Data from existing data
- for(PlayerSave save : playerSaveData){
+ for(PlayerSave save : data){
if(save.thePlayerUUID.equals(player.getUniqueID())){
- return save.theCompound;
+ return save;
}
}
//Add Data if none is existant
PlayerSave aSave = new PlayerSave(player.getUniqueID(), new NBTTagCompound());
- playerSaveData.add(aSave);
- return aSave.theCompound;
+ data.add(aSave);
+ return aSave;
}
public static class PlayerSave{
- public UUID thePlayerUUID;
+ public final UUID thePlayerUUID;
public NBTTagCompound theCompound;
public PlayerSave(UUID theUUID, NBTTagCompound theCompound){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java
new file mode 100644
index 000000000..7735892aa
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java
@@ -0,0 +1,169 @@
+/*
+ * This file ("WorldData.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.data;
+
+import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
+import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
+import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler.Network;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import io.netty.util.internal.ConcurrentSet;
+import net.minecraft.nbt.CompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+import net.minecraft.world.storage.ISaveHandler;
+import net.minecraftforge.common.WorldSpecificSaveHandler;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class WorldData{
+
+ public static final String DATA_TAG = ModUtil.MOD_ID+"data";
+ public static final ArrayList PLAYER_SAVE_DATA = new ArrayList();
+ private static final Map WORLD_DATA = new ConcurrentHashMap();
+ public final ConcurrentSet laserRelayNetworks = new ConcurrentSet();
+ private final ISaveHandler handler;
+ private final int dimension;
+
+ public WorldData(ISaveHandler handler, int dimension){
+ this.handler = handler;
+ this.dimension = dimension;
+ }
+
+ public static WorldData getDataForWorld(World world){
+ int dim = world.provider.getDimension();
+ WorldData data = WORLD_DATA.get(dim);
+
+ if(data == null){
+ data = new WorldData(null, dim);
+
+ if(world.isRemote){
+ WORLD_DATA.put(dim, data);
+ ModUtil.LOGGER.info("Creating temporary WorldData for world "+dim+" on the client!");
+ }
+ else{
+ ModUtil.LOGGER.warn("Trying to get WorldData from world "+dim+" that doesn't have any data!? This shouldn't happen!");
+ }
+ }
+
+ return data;
+ }
+
+ public static void load(World world){
+ if(!world.isRemote && world instanceof WorldServer){
+ WorldData data = new WorldData(new WorldSpecificSaveHandler((WorldServer)world, world.getSaveHandler()), world.provider.getDimension());
+ WORLD_DATA.put(data.dimension, data);
+
+ try{
+ File dataFile = data.handler.getMapFileFromName(DATA_TAG+data.dimension);
+
+ if(dataFile != null && dataFile.exists()){
+ FileInputStream stream = new FileInputStream(dataFile);
+ NBTTagCompound compound = CompressedStreamTools.readCompressed(stream);
+ stream.close();
+ data.readFromNBT(compound);
+
+ ModUtil.LOGGER.info("Successfully received WorldData for world "+data.dimension+"!");
+ }
+ else{
+ ModUtil.LOGGER.info("No WorldData found for world "+data.dimension+", creating...");
+ }
+
+ }
+ catch(Exception e){
+ ModUtil.LOGGER.error("Something went wrong trying to load WorldData for world "+data.dimension+"!", e);
+ }
+ }
+ }
+
+ public static void save(World world){
+ if(!world.isRemote){
+ WorldData data = WORLD_DATA.get(world.provider.getDimension());
+ if(data != null && data.handler != null){
+ try{
+ File dataFile = data.handler.getMapFileFromName(DATA_TAG+data.dimension);
+
+ if(dataFile != null){
+ if(!dataFile.exists()){
+ dataFile.createNewFile();
+ ModUtil.LOGGER.info("Creating new WorldData file for world "+data.dimension+"!");
+ }
+
+ NBTTagCompound compound = new NBTTagCompound();
+ data.writeToNBT(compound);
+ FileOutputStream stream = new FileOutputStream(dataFile);
+ CompressedStreamTools.writeCompressed(compound, stream);
+ stream.close();
+ }
+ }
+ catch(Exception e){
+ ModUtil.LOGGER.error("Something went wrong trying to save WorldData for world "+data.dimension+"!", e);
+ }
+ }
+ else{
+ ModUtil.LOGGER.error("Tried to save WorldData for "+world.provider.getDimension()+" without any data being present!?");
+ }
+ }
+ }
+
+ public static void unload(World world){
+ if(!world.isRemote){
+ WORLD_DATA.remove(world.provider.getDimension());
+ ModUtil.LOGGER.info("Unloading WorldData for world "+world.provider.getDimension()+"!");
+ }
+ }
+
+ private void readFromNBT(NBTTagCompound compound){
+ //Laser World Data
+ this.laserRelayNetworks.clear();
+
+ NBTTagList networkList = compound.getTagList("Networks", 10);
+ for(int i = 0; i < networkList.tagCount(); i++){
+ Network network = LaserRelayConnectionHandler.readNetworkFromNBT(networkList.getCompoundTagAt(i));
+ this.laserRelayNetworks.add(network);
+ }
+
+ if(this.dimension == 0){
+ //Player Data
+ PLAYER_SAVE_DATA.clear();
+
+ NBTTagList playerList = compound.getTagList("PlayerData", 10);
+ for(int i = 0; i < playerList.tagCount(); i++){
+ PlayerSave aSave = PlayerSave.fromNBT(playerList.getCompoundTagAt(i));
+ PLAYER_SAVE_DATA.add(aSave);
+ }
+ }
+ }
+
+ private void writeToNBT(NBTTagCompound compound){
+ //Laser World Data
+ NBTTagList networkList = new NBTTagList();
+ for(Network network : this.laserRelayNetworks){
+ networkList.appendTag(LaserRelayConnectionHandler.writeNetworkToNBT(network));
+ }
+ compound.setTag("Networks", networkList);
+
+ if(this.dimension == 0){
+ //Player Data
+ NBTTagList playerList = new NBTTagList();
+ for(PlayerSave theSave : PLAYER_SAVE_DATA){
+ playerList.appendTag(theSave.toNBT());
+ }
+ compound.setTag("PlayerData", playerList);
+ }
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java
deleted file mode 100644
index f86ab2dfe..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file ("BucketFillEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-
-import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
-import de.ellpeck.actuallyadditions.mod.items.InitItems;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
-import net.minecraft.block.Block;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.event.entity.player.FillBucketEvent;
-import net.minecraftforge.fml.common.eventhandler.Event;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-public class BucketFillEvent{
-
- @SubscribeEvent
- public void onBucketFilled(FillBucketEvent event){
- this.fillBucket(event, InitItems.itemBucketOil, InitFluids.blockOil);
- this.fillBucket(event, InitItems.itemBucketCanolaOil, InitFluids.blockCanolaOil);
- }
-
- private void fillBucket(FillBucketEvent event, Item item, Block fluid){
- Block block = PosUtil.getBlock(event.target.getBlockPos(), event.world);
- if(block == fluid){
- event.world.setBlockToAir(event.target.getBlockPos());
- event.result = new ItemStack(item);
- event.setResult(Event.Result.ALLOW);
- }
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java
new file mode 100644
index 000000000..1550e2a11
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java
@@ -0,0 +1,186 @@
+/*
+ * This file ("ClientEvents.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.event;
+
+import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
+import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockRedstoneTorch;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.profiler.Profiler;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+import net.minecraftforge.oredict.OreDictionary;
+
+import java.util.List;
+
+@SideOnly(Side.CLIENT)
+public class ClientEvents{
+
+ private static final String ADVANCED_INFO_TEXT_PRE = TextFormatting.DARK_GRAY+" ";
+ private static final String ADVANCED_INFO_HEADER_PRE = TextFormatting.GRAY+" -";
+
+ public ClientEvents(){
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @SubscribeEvent
+ public void onTooltipEvent(ItemTooltipEvent event){
+ //Advanced Item Info
+ if(event.getItemStack().getItem() != null){
+ if(ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()){
+ if(GuiScreen.isCtrlKeyDown()){
+ event.getToolTip().add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".extraInfo.desc")+":");
+
+ //OreDict Names
+ int[] oreIDs = OreDictionary.getOreIDs(event.getItemStack());
+ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".oredictName.desc")+":");
+ if(oreIDs.length > 0){
+ for(int oreID : oreIDs){
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+OreDictionary.getOreName(oreID));
+ }
+ }
+ else{
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".noOredictNameAvail.desc"));
+ }
+
+ //Code Name
+ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".codeName.desc")+":");
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+Item.REGISTRY.getNameForObject(event.getItemStack().getItem()));
+
+ //Base Item's Unlocalized Name
+ String baseName = event.getItemStack().getItem().getUnlocalizedName();
+ if(baseName != null){
+ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".baseUnlocName.desc")+":");
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+baseName);
+ }
+
+ //Metadata
+ int meta = event.getItemStack().getItemDamage();
+ int max = event.getItemStack().getMaxDamage();
+ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".meta.desc")+":");
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+meta+(max > 0 ? "/"+max : ""));
+
+ //Unlocalized Name
+ String metaName = event.getItemStack().getItem().getUnlocalizedName(event.getItemStack());
+ if(metaName != null && baseName != null && !metaName.equals(baseName)){
+ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".unlocName.desc")+":");
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+metaName);
+ }
+
+ //NBT
+ NBTTagCompound compound = event.getItemStack().getTagCompound();
+ if(compound != null && !compound.hasNoTags()){
+ event.getToolTip().add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".nbt.desc")+":");
+ if(GuiScreen.isShiftKeyDown()){
+ List strgList = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(compound.toString(), 200);
+ for(String strg : strgList){
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+strg);
+ }
+ }
+ else{
+ event.getToolTip().add(ADVANCED_INFO_TEXT_PRE+TextFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".pressShift.desc")+"]");
+ }
+ }
+
+ //Disabling Info
+ event.getToolTip().addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".disablingInfo.desc"), 200));
+
+ }
+ else{
+ if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){
+ event.getToolTip().add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".ctrlForMoreInfo.desc"));
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onGameOverlay(RenderGameOverlayEvent.Post event){
+ if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null){
+ Minecraft minecraft = Minecraft.getMinecraft();
+ Profiler profiler = minecraft.mcProfiler;
+ EntityPlayer player = minecraft.thePlayer;
+ RayTraceResult posHit = minecraft.objectMouseOver;
+ FontRenderer font = minecraft.fontRendererObj;
+ ItemStack stack = player.getHeldItemMainhand();
+
+ profiler.startSection(ModUtil.MOD_ID+"Hud");
+
+ if(stack != null){
+ if(stack.getItem() instanceof IHudDisplay){
+ profiler.startSection("ItemHudDisplay");
+ ((IHudDisplay)stack.getItem()).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution());
+ profiler.endSection();
+ }
+ }
+
+ if(posHit != null && posHit.getBlockPos() != null){
+ Block blockHit = minecraft.theWorld.getBlockState(posHit.getBlockPos()).getBlock();
+ TileEntity tileHit = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
+
+ if(blockHit instanceof IHudDisplay){
+ profiler.startSection("BlockHudDisplay");
+ ((IHudDisplay)blockHit).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution());
+ profiler.endSection();
+ }
+
+ if(tileHit instanceof TileEntityBase){
+ TileEntityBase base = (TileEntityBase)tileHit;
+ if(base.isRedstoneToggle()){
+ profiler.startSection("RedstoneToggleHudDisplay");
+
+ String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(base.isPulseMode ? "Pulse" : "Deactivation")+TextFormatting.RESET;
+ font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
+
+ if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
+ String expl = TextFormatting.GREEN+"Right-Click to toggle!";
+ font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
+ }
+
+ profiler.endSection();
+ }
+ }
+
+ if(tileHit instanceof IEnergyDisplay){
+ IEnergyDisplay display = (IEnergyDisplay)tileHit;
+ if(!display.needsHoldShift() || player.isSneaking()){
+ profiler.startSection("EnergyDisplay");
+ String strg = display.getEnergy()+"/"+display.getMaxEnergy()+" RF";
+ font.drawStringWithShadow(TextFormatting.GOLD+strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE);
+ profiler.endSection();
+ }
+ }
+ }
+
+ profiler.endSection();
+ }
+ }
+
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java
new file mode 100644
index 000000000..603ffe403
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java
@@ -0,0 +1,151 @@
+/*
+ * This file ("CommonEvents.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.event;
+
+import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
+import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
+import de.ellpeck.actuallyadditions.mod.data.PlayerData;
+import de.ellpeck.actuallyadditions.mod.data.WorldData;
+import de.ellpeck.actuallyadditions.mod.items.InitItems;
+import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
+import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.Util;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.monster.EntitySpider;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.EntityJoinWorldEvent;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
+import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.PlayerEvent;
+
+import java.util.Locale;
+
+public class CommonEvents{
+
+ public CommonEvents(){
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @SubscribeEvent
+ public void livingDeathEvent(LivingDeathEvent event){
+ if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)event.getEntityLiving();
+ PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
+
+ NBTTagList deaths = data.theCompound.getTagList("Deaths", 10);
+ while(deaths.tagCount() >= 5){
+ deaths.removeTag(0);
+ }
+
+ NBTTagCompound death = new NBTTagCompound();
+ death.setDouble("X", player.posX);
+ death.setDouble("Y", player.posY);
+ death.setDouble("Z", player.posZ);
+ deaths.appendTag(death);
+
+ data.theCompound.setTag("Deaths", deaths);
+
+ //player.addChatComponentMessage(new TextComponentTranslation("info."+ModUtil.MOD_ID+".deathRecorded"));
+ }
+ }
+
+ @SubscribeEvent
+ public void onEntityDropEvent(LivingDropsEvent event){
+ if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote && event.getSource().getEntity() instanceof EntityPlayer){
+ //Drop Cobwebs from Spiders
+ if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof EntitySpider){
+ if(Util.RANDOM.nextInt(20) <= event.getLootingLevel()*2){
+ event.getEntityLiving().entityDropItem(new ItemStack(Blocks.WEB, Util.RANDOM.nextInt(2+event.getLootingLevel())+1), 0);
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onLogInEvent(EntityJoinWorldEvent event){
+ if(!event.getEntity().worldObj.isRemote && event.getEntity() instanceof EntityPlayerMP){
+ EntityPlayerMP player = (EntityPlayerMP)event.getEntity();
+ PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
+ if(!data.theCompound.hasNoTags()){
+ PacketHandler.theNetwork.sendTo(new PacketServerToClient(data.theCompound, PacketHandler.PLAYER_DATA_TO_CLIENT_HANDLER), player);
+ }
+ }
+ }
+
+ public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
+ for(TheAchievements ach : TheAchievements.values()){
+ if(ach.type == type){
+ if(gotten != null && ach.chieve.theItemStack != null && gotten.getItem() == ach.chieve.theItemStack.getItem()){
+ if(gotten.getItemDamage() == ach.chieve.theItemStack.getItemDamage()){
+ player.addStat(ach.chieve, 1);
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
+ checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
+
+ if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){
+ if(!event.player.worldObj.isRemote && event.crafting != null && event.crafting.getItem() != null && event.crafting.getItem() != InitItems.itemBooklet){
+
+ String name = event.crafting.getItem().getRegistryName().toString();
+ if(name != null && name.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID)){
+ PlayerData.PlayerSave compound = PlayerData.getDataFromPlayer(event.player);
+ if(compound != null && !compound.theCompound.getBoolean("BookGottenAlready")){
+ compound.theCompound.setBoolean("BookGottenAlready", true);
+
+ EntityItem entityItem = new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(InitItems.itemBooklet));
+ entityItem.setPickupDelay(0);
+ event.player.worldObj.spawnEntityInWorld(entityItem);
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
+ checkAchievements(event.smelting, event.player, InitAchievements.Type.SMELTING);
+ }
+
+ @SubscribeEvent
+ public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
+ checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.Type.PICK_UP);
+ }
+
+ @SubscribeEvent
+ public void onLoad(WorldEvent.Load event){
+ WorldData.load(event.getWorld());
+ }
+
+ @SubscribeEvent
+ public void onUnload(WorldEvent.Unload event){
+ WorldData.unload(event.getWorld());
+ }
+
+ @SubscribeEvent
+ public void onSave(WorldEvent.Save event){
+ WorldData.save(event.getWorld());
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java
deleted file mode 100644
index 263ae1bb5..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This file ("EntityLivingEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.items.InitItems;
-import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
-import de.ellpeck.actuallyadditions.mod.util.Util;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.passive.EntityOcelot;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-import java.util.UUID;
-
-public class EntityLivingEvent{
-
- @SubscribeEvent
- public void livingUpdateEvent(LivingUpdateEvent event){
- //Ocelots dropping Hair Balls
- if(event.entityLiving != null && event.entityLiving.worldObj != null && !event.entityLiving.worldObj.isRemote){
- if((event.entityLiving instanceof EntityOcelot && ((EntityOcelot)event.entityLiving).isTamed()) || (event.entityLiving instanceof EntityPlayer && event.entityLiving.getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){
- if(ConfigBoolValues.DO_CAT_DROPS.isEnabled()){
- if(Util.RANDOM.nextInt(5000)+1 == 1){
- EntityItem item = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX+0.5, event.entityLiving.posY+0.5, event.entityLiving.posZ+0.5, new ItemStack(InitItems.itemHairyBall));
- event.entityLiving.worldObj.spawnEntityInWorld(item);
- }
- }
- }
- }
-
- //Wings allowing Flight
- this.doWingStuff(event);
- }
-
- /**
- * Makes players be able to fly if they have Wings Of The Bats equipped
- * (Partially excerpted from Botania's Wing System by Vazkii (as I had fiddled around with the system and couldn't make it work) with permission, thanks!)
- */
- private void doWingStuff(LivingUpdateEvent event){
- if(event.entityLiving instanceof EntityPlayer){
- EntityPlayer player = (EntityPlayer)event.entityLiving;
- boolean wingsEquipped = ItemWingsOfTheBats.getWingItem(player) != null;
-
- //If Player isn't (really) winged
- if(!ItemWingsOfTheBats.isPlayerWinged(player)){
- if(wingsEquipped){
- //Make the Player actually winged
- ItemWingsOfTheBats.addWingsToPlayer(player);
- }
- }
- //If Player is (or should be) winged
- else{
- if(wingsEquipped){
- //Allow the Player to fly when he has Wings equipped
- player.capabilities.allowFlying = true;
- }
- else{
- //Make the Player not winged
- ItemWingsOfTheBats.removeWingsFromPlayer(player);
- //Reset Player's Values
- if(!player.capabilities.isCreativeMode){
- player.capabilities.allowFlying = false;
- player.capabilities.isFlying = false;
- //Enables Fall Damage again (Automatically gets disabled for some reason)
- player.capabilities.disableDamage = false;
- }
- }
- }
- }
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java
deleted file mode 100644
index ceb691ded..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This file ("HudEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
-import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
-import de.ellpeck.actuallyadditions.mod.tile.IRedstoneToggle;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
-import de.ellpeck.actuallyadditions.mod.util.StringUtil;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockRedstoneTorch;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.profiler.Profiler;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.MovingObjectPosition;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-public class HudEvent{
-
- @SubscribeEvent
- public void onGameOverlay(RenderGameOverlayEvent.Post event){
- if(event.type == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null){
- Minecraft minecraft = Minecraft.getMinecraft();
- Profiler profiler = minecraft.mcProfiler;
- EntityPlayer player = minecraft.thePlayer;
- MovingObjectPosition posHit = minecraft.objectMouseOver;
- FontRenderer font = minecraft.fontRendererObj;
- ItemStack stack = player.getCurrentEquippedItem();
-
- profiler.startSection(ModUtil.MOD_ID+"Hud");
-
- if(stack != null){
- if(stack.getItem() instanceof IHudDisplay){
- profiler.startSection("ItemHudDisplay");
- ((IHudDisplay)stack.getItem()).displayHud(minecraft, player, stack, posHit, profiler, event.resolution);
- profiler.endSection();
- }
- }
-
- if(posHit != null && posHit.getBlockPos() != null){
- Block blockHit = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld);
- TileEntity tileHit = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
-
- if(blockHit instanceof IHudDisplay){
- profiler.startSection("BlockHudDisplay");
- ((IHudDisplay)blockHit).displayHud(minecraft, player, stack, posHit, profiler, event.resolution);
- profiler.endSection();
- }
-
- if(tileHit instanceof IRedstoneToggle){
- profiler.startSection("RedstoneToggleHudDisplay");
-
- String strg = "Redstone Mode: "+EnumChatFormatting.DARK_RED+(((IRedstoneToggle)tileHit).isPulseMode() ? "Pulse" : "Deactivation")+EnumChatFormatting.RESET;
- font.drawStringWithShadow(strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
-
- if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
- String expl = EnumChatFormatting.GREEN+"Right-Click to toggle!";
- font.drawStringWithShadow(expl, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
- }
-
- profiler.endSection();
- }
-
- if(tileHit instanceof IEnergyDisplay){
- profiler.startSection("EnergyDisplay");
- String strg = ((IEnergyDisplay)tileHit).getEnergy()+"/"+((IEnergyDisplay)tileHit).getMaxEnergy()+" RF";
- font.drawStringWithShadow(EnumChatFormatting.GOLD+strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE);
- profiler.endSection();
- }
- }
-
- profiler.endSection();
- }
- }
-
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java
deleted file mode 100644
index 1ddf59809..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file ("InitEvents.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.nei.NEIScreenEvents;
-import de.ellpeck.actuallyadditions.mod.update.UpdateCheckerClientNotificationEvent;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.Util;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.Loader;
-
-public class InitEvents{
-
- public static void init(){
- ModUtil.LOGGER.info("Initializing Events...");
-
- Util.registerEvent(new PlayerObtainEvents());
- Util.registerEvent(new LivingDropEvent());
- Util.registerEvent(new EntityLivingEvent());
- Util.registerEvent(new BucketFillEvent());
- Util.registerEvent(new LogoutEvent());
- Util.registerEvent(new WorldLoadingEvents());
- MinecraftForge.TERRAIN_GEN_BUS.register(new WorldDecorationEvent());
-
- }
-
- public static void initClient(){
- Util.registerEvent(new TooltipEvent());
- Util.registerEvent(new HudEvent());
-
- if(Loader.isModLoaded("NotEnoughItems")){
- Util.registerEvent(new NEIScreenEvents());
- }
-
- if(ConfigBoolValues.DO_UPDATE_CHECK.isEnabled() && !Util.isDevVersion()){
- Util.registerEvent(new UpdateCheckerClientNotificationEvent());
- }
- }
-
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java
deleted file mode 100644
index c84cf1df8..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file ("LivingDropEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.items.InitItems;
-import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
-import de.ellpeck.actuallyadditions.mod.util.Util;
-import net.minecraft.entity.EntityCreature;
-import net.minecraft.entity.monster.EntitySpider;
-import net.minecraft.entity.passive.EntityBat;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.event.entity.living.LivingDropsEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-public class LivingDropEvent{
-
- @SubscribeEvent
- public void onEntityDropEvent(LivingDropsEvent event){
- if(event.source.getEntity() instanceof EntityPlayer){
- //Drop Solidified XP
- if(event.entityLiving instanceof EntityCreature){
- if(Util.RANDOM.nextInt(15) <= 0){
- event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSolidifiedExperience, Util.RANDOM.nextInt(2)+1), 0);
- }
- }
-
- //Drop Cobwebs from Spiders
- if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.entityLiving instanceof EntitySpider){
- if(Util.RANDOM.nextInt(80) <= 0){
- event.entityLiving.entityDropItem(new ItemStack(Blocks.web, Util.RANDOM.nextInt(2)+1), 0);
- }
- }
-
- //Drop Wings from Bats
- if(ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.entityLiving instanceof EntityBat){
- if(Util.RANDOM.nextInt(30) <= 0){
- event.entityLiving.entityDropItem(new ItemStack(InitItems.itemMisc, Util.RANDOM.nextInt(2)+1, TheMiscItems.BAT_WING.ordinal()), 0);
- }
- }
- }
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/LogoutEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/LogoutEvent.java
deleted file mode 100644
index 2d14f6a0e..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/LogoutEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file ("LogoutEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.PlayerEvent;
-
-public class LogoutEvent{
-
- @SubscribeEvent
- public void onLogOutEvent(PlayerEvent.PlayerLoggedOutEvent event){
- //Remove Player from Wings' Fly Permission List
- ItemWingsOfTheBats.removeWingsFromPlayer(event.player, true);
- ItemWingsOfTheBats.removeWingsFromPlayer(event.player, false);
- }
-
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java
deleted file mode 100644
index d8f009d22..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file ("PlayerObtainEvents.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
-import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.items.InitItems;
-import de.ellpeck.actuallyadditions.mod.misc.WorldData;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentServerData;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.PlayerEvent;
-
-import java.util.Locale;
-
-public class PlayerObtainEvents{
-
- public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
- for(int i = 0; i < TheAchievements.values().length; i++){
- TheAchievements ach = TheAchievements.values()[i];
- if(ach.type == type){
- if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){
- if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
- player.addStat(ach.ach, 1);
- }
- }
- }
- }
- }
-
- @SubscribeEvent
- public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
- checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING);
-
- if(ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()){
- if(!event.player.worldObj.isRemote && event.crafting != null && event.crafting.getItem() != null && event.crafting.getItem() != InitItems.itemBooklet){
-
- String name = event.crafting.getItem().getRegistryName();
- if(name != null && name.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID_LOWER)){
- NBTTagCompound compound = PersistentServerData.getDataFromPlayer(event.player);
- if(compound != null && !compound.getBoolean("BookGottenAlready")){
- compound.setBoolean("BookGottenAlready", true);
- WorldData.makeDirty();
-
- EntityItem entityItem = new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(InitItems.itemBooklet));
- entityItem.setPickupDelay(0);
- event.player.worldObj.spawnEntityInWorld(entityItem);
- }
- }
- }
- }
- }
-
- @SubscribeEvent
- public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
- checkAchievements(event.smelting, event.player, InitAchievements.Type.SMELTING);
- }
-
- @SubscribeEvent
- public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
- checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.Type.PICK_UP);
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java
deleted file mode 100644
index 2821db6b4..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * This file ("TooltipEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.util.KeyUtil;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.StringUtil;
-import net.minecraft.client.Minecraft;
-import net.minecraft.item.Item;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.event.entity.player.ItemTooltipEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.oredict.OreDictionary;
-
-import java.util.List;
-
-public class TooltipEvent{
-
- private static final String ADVANCED_INFO_TEXT_PRE = EnumChatFormatting.DARK_GRAY+" ";
- private static final String ADVANCED_INFO_HEADER_PRE = EnumChatFormatting.GRAY+" -";
-
- @SuppressWarnings("unchecked")
- @SubscribeEvent
- public void onTooltipEvent(ItemTooltipEvent event){
- //Advanced Item Info
- if(event.itemStack.getItem() != null){
- if(ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()){
- if(KeyUtil.isControlPressed()){
- event.toolTip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".extraInfo.desc")+":");
-
- //OreDict Names
- int[] oreIDs = OreDictionary.getOreIDs(event.itemStack);
- event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".oredictName.desc")+":");
- if(oreIDs.length > 0){
- for(int oreID : oreIDs){
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+OreDictionary.getOreName(oreID));
- }
- }
- else{
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".noOredictNameAvail.desc"));
- }
-
- //Code Name
- event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".codeName.desc")+":");
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+Item.itemRegistry.getNameForObject(event.itemStack.getItem()));
-
- //Base Item's Unlocalized Name
- String baseName = event.itemStack.getItem().getUnlocalizedName();
- if(baseName != null){
- event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".baseUnlocName.desc")+":");
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+baseName);
- }
-
- //Metadata
- int meta = event.itemStack.getItemDamage();
- event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".meta.desc")+":");
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+meta);
-
- //Unlocalized Name
- String metaName = event.itemStack.getItem().getUnlocalizedName(event.itemStack);
- if(metaName != null && baseName != null && !metaName.equals(baseName)){
- event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".unlocName.desc")+":");
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+metaName);
- }
-
- //NBT
- NBTTagCompound compound = event.itemStack.getTagCompound();
- if(compound != null && !compound.hasNoTags()){
- event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".nbt.desc")+":");
- if(KeyUtil.isShiftPressed()){
- List strgList = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(compound.toString(), 200);
- for(String strg : strgList){
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+strg);
- }
- }
- else{
- event.toolTip.add(ADVANCED_INFO_TEXT_PRE+EnumChatFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]");
- }
- }
-
- //Disabling Info
- event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200));
-
- }
- else{
- if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){
- event.toolTip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".ctrlForMoreInfo.desc"));
- }
- }
- }
- }
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java
deleted file mode 100644
index 2b5f9da86..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file ("WorldDecorationEvent.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-
-import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
-import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
-import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
-import de.ellpeck.actuallyadditions.mod.util.Util;
-import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.util.BlockPos;
-import net.minecraft.world.biome.BiomeGenOcean;
-import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
-import net.minecraftforge.fml.common.eventhandler.Event;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-import java.util.ArrayList;
-
-public class WorldDecorationEvent{
-
- @SubscribeEvent
- public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
- if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
- if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.getDimensionId()) < 0){
- this.generateRice(event);
- this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.grass, event);
- this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event);
- this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.COFFEE.ordinal(), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.grass, event);
- this.genPlantNormally(InitBlocks.blockBlackLotus, 0, ConfigIntValues.BLACK_LOTUS_AMOUNT.getValue(), ConfigBoolValues.DO_LOTUS_GEN.isEnabled(), Material.grass, event);
- }
-
- //Generate Treasure Chests
- if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
- if(event.rand.nextInt(300) == 0){
- BlockPos randomPos = new BlockPos(event.pos.getX()+event.rand.nextInt(16)+8, 0, event.pos.getZ()+event.rand.nextInt(16)+8);
- randomPos = event.world.getTopSolidOrLiquidBlock(randomPos);
-
- if(event.world.getBiomeGenForCoords(randomPos) instanceof BiomeGenOcean){
- if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
- if(PosUtil.getBlock(randomPos, event.world).getMaterial() == Material.water){
- if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.world).isSolid()){
- PosUtil.setBlock(randomPos, event.world, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2);
- }
- }
- }
- }
- }
- }
- }
- }
-
- private void generateRice(DecorateBiomeEvent event){
- if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
- for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
- if(event.rand.nextInt(50) == 0){
- BlockPos randomPos = new BlockPos(event.pos.getX()+event.rand.nextInt(16)+8, 0, event.pos.getZ()+event.rand.nextInt(16)+8);
- randomPos = event.world.getTopSolidOrLiquidBlock(randomPos);
- if(PosUtil.getMaterial(randomPos, event.world) == Material.water){
- ArrayList blocksAroundBottom = WorldUtil.getMaterialsAround(event.world, randomPos);
- BlockPos posToGenAt = PosUtil.offset(randomPos, 0, 1, 0);
- ArrayList blocksAroundTop = WorldUtil.getMaterialsAround(event.world, posToGenAt);
- if(blocksAroundBottom.contains(Material.grass) || blocksAroundBottom.contains(Material.ground) || blocksAroundBottom.contains(Material.rock) || blocksAroundBottom.contains(Material.sand)){
- if(!blocksAroundTop.contains(Material.water) && PosUtil.getMaterial(posToGenAt, event.world) == Material.air){
- PosUtil.setBlock(posToGenAt, event.world, InitBlocks.blockWildPlant, TheWildPlants.RICE.ordinal(), 2);
- }
- }
- }
- }
- }
- }
- }
-
- private void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
- if(doIt){
- for(int i = 0; i < amount; i++){
- if(event.rand.nextInt(400) == 0){
- BlockPos randomPos = new BlockPos(event.pos.getX()+event.rand.nextInt(16)+8, 0, event.pos.getZ()+event.rand.nextInt(16)+8);
- randomPos = event.world.getTopSolidOrLiquidBlock(randomPos);
-
- if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.world) == blockBelow){
- if(plant.canPlaceBlockAt(event.world, randomPos)){
- PosUtil.setBlock(randomPos, event.world, plant, meta, 2);
- }
- }
- }
- }
- }
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java
deleted file mode 100644
index 602ca99b7..000000000
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file ("WorldLoadingEvents.java") is part of the Actually Additions Mod for Minecraft.
- * It is created and owned by Ellpeck and distributed
- * under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
- * View the source code at https://github.com/Ellpeck/ActuallyAdditions
- *
- * © 2016 Ellpeck
- */
-
-package de.ellpeck.actuallyadditions.mod.event;
-
-import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
-import de.ellpeck.actuallyadditions.mod.misc.WorldData;
-import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-public class WorldLoadingEvents{
-
- @SubscribeEvent
- public void onLoad(WorldEvent.Load event){
- if(LaserRelayConnectionHandler.getInstance() == null){
- LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
- }
- }
-
- @SubscribeEvent
- public void onUnload(WorldEvent.Unload event){
- WorldData.makeDirty();
- }
-
- @SubscribeEvent
- public void onSave(WorldEvent.Save event){
- WorldData.makeDirty();
- }
-}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java
index c71e0a1a6..c1bd9b6ff 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java
@@ -1,11 +1,11 @@
/*
- * This file ("FluidAA.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("FluidAA.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.fluids;
@@ -17,11 +17,11 @@ import net.minecraftforge.fluids.Fluid;
public class FluidAA extends Fluid{
public FluidAA(String fluidName, String textureName){
- super(fluidName, new ResourceLocation(ModUtil.MOD_ID_LOWER, "blocks/"+textureName+"Still"), new ResourceLocation(ModUtil.MOD_ID_LOWER, "blocks/"+textureName+"Flowing"));
+ super(fluidName, new ResourceLocation(ModUtil.MOD_ID, "blocks/"+textureName+"Still"), new ResourceLocation(ModUtil.MOD_ID, "blocks/"+textureName+"Flowing"));
}
@Override
public String getUnlocalizedName(){
- return "fluid."+ModUtil.MOD_ID_LOWER+"."+this.unlocalizedName;
+ return "fluid."+ModUtil.MOD_ID+"."+this.unlocalizedName;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java
index 0bab1171f..9e4130746 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java
@@ -1,25 +1,25 @@
/*
- * This file ("InitFluids.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitFluids.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.fluids;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockFluidFlowing;
-import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
-public class InitFluids{
+import java.util.Locale;
+
+public final class InitFluids{
public static Fluid fluidCanolaOil;
public static Fluid fluidOil;
@@ -28,48 +28,22 @@ public class InitFluids{
public static Block blockOil;
public static void init(){
- //Canola Fluid
- String canolaOil = "canolaoil";
- if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){
- fluidCanolaOil = new FluidAA(canolaOil, "blockCanolaOil").setRarity(EnumRarity.UNCOMMON);
- FluidRegistry.registerFluid(fluidCanolaOil);
- }
- else{
- errorAlreadyRegistered("Canola Oil Fluid");
- }
- fluidCanolaOil = FluidRegistry.getFluid(canolaOil);
+ fluidCanolaOil = registerFluid("canolaoil", "blockCanolaOil", EnumRarity.UNCOMMON);
+ fluidOil = registerFluid("oil", "blockOil", EnumRarity.UNCOMMON);
- //Canola Block
- if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){
- blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil");
- }
- else{
- errorAlreadyRegistered("Canola Oil Block");
- }
- blockCanolaOil = fluidCanolaOil.getBlock();
-
- //Oil Fluid
- String oil = "oil";
- if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){
- fluidOil = new FluidAA(oil, "blockOil").setRarity(EnumRarity.UNCOMMON);
- FluidRegistry.registerFluid(fluidOil);
- }
- else{
- errorAlreadyRegistered("Oil Fluid");
- }
- fluidOil = FluidRegistry.getFluid(oil);
-
- //Oil Block
- if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){
- blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil");
- }
- else{
- errorAlreadyRegistered("Oil Block");
- }
- blockOil = fluidOil.getBlock();
+ blockCanolaOil = registerFluidBlock(fluidCanolaOil, Material.WATER, "blockCanolaOil");
+ blockOil = registerFluidBlock(fluidOil, Material.WATER, "blockOil");
}
- public static void errorAlreadyRegistered(String str){
- ModUtil.LOGGER.warn(str+" from "+ModUtil.NAME+" is not getting used as it has already been registered by another Mod! If this causes Issues (which it shouldn't!), you can turn this off in the Config File!");
+ private static Fluid registerFluid(String fluidName, String fluidTextureName, EnumRarity rarity){
+ Fluid fluid = new FluidAA(fluidName.toLowerCase(Locale.ROOT), fluidTextureName).setRarity(rarity);
+ FluidRegistry.registerFluid(fluid);
+ FluidRegistry.addBucketForFluid(fluid);
+
+ return fluid;
+ }
+
+ private static Block registerFluidBlock(Fluid fluid, Material material, String name){
+ return new BlockFluidFlowing(fluid, material, name);
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/InitVillager.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/InitVillager.java
index f46d3b9a2..ddacb3eff 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/InitVillager.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/InitVillager.java
@@ -1,11 +1,11 @@
/*
- * This file ("InitVillager.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitVillager.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
@@ -13,10 +13,11 @@ package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.world.gen.structure.MapGenStructureIO;
+import net.minecraftforge.fml.common.registry.VillagerRegistry;
-public class InitVillager{
+public final class InitVillager{
- public static final String JAM_HOUSE_CHEST_NAME = ModUtil.MOD_ID_LOWER+".jamHouseChest";
+ public static final String JAM_HOUSE_CHEST_NAME = ModUtil.MOD_ID+".jamHouseChest";
public static void init(){
ModUtil.LOGGER.info("Initializing Village Addons...");
@@ -32,8 +33,8 @@ public class InitVillager{
private static void initJamVillagePart(){
//TODO Fix villager
/*int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue();
- VillagerRegistry.instance().registerVillagerId(jamID);
- VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler());
+ VillagerRegistry.INSTANCE().registerVillagerId(jamID);
+ VillagerRegistry.INSTANCE().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler());
ChestGenHooks jamHouseChest = ChestGenHooks.getInfo(JAM_HOUSE_CHEST_NAME);
jamHouseChest.setMin(5);
@@ -42,16 +43,15 @@ public class InitVillager{
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, 1, i), 1, 1, 10));
}
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.glass_bottle), 1, 2, 30));
- ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20));
+ ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20));*/
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
- MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER+":jamHouseStructure");*/
+ MapGenStructureIO.registerStructureComponent(VillageComponentJamHouse.class, ModUtil.MOD_ID+":jamHouseStructure");
}
private static void initCustomCropFieldPart(){
- //TODO Fix village
- //VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
- MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID_LOWER+":customCropFieldStructure");
+ VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
+ MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID+":customCropFieldStructure");
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java
index a67fbfeb7..f8f0ab7e6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java
@@ -1,11 +1,11 @@
/*
- * This file ("JamVillagerTradeHandler.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("JamVillagerTradeHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
@@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.MathHelper;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import net.minecraftforge.oredict.OreDictionary;
@@ -23,47 +23,44 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.Random;
-//TODO Fix the villager
public class JamVillagerTradeHandler{
- private ArrayList trades = new ArrayList();
+ private final ArrayList trades = new ArrayList();
public JamVillagerTradeHandler(){
this.addWants("ingotGold", 5, 7);
this.addWants("cropWheat", 15, 25);
this.addWants("dustRedstone", 25, 40);
- this.addWants(new ItemStack(Items.bucket), 5, 9);
- this.addWants(new ItemStack(Items.glass_bottle), 12, 17);
- this.addWants(new ItemStack(Items.potionitem), 1, 1);
+ this.addWants(new ItemStack(Items.BUCKET), 5, 9);
+ this.addWants(new ItemStack(Items.GLASS_BOTTLE), 12, 17);
+ this.addWants(new ItemStack(Items.POTIONITEM), 1, 1);
this.addWants("ingotIron", 10, 15);
this.addWants("gemDiamond", 1, 2);
this.addWants("dustGlowstone", 12, 22);
}
public void addWants(String oredictName, int minSize, int maxSize){
- ArrayList stacks = (ArrayList)OreDictionary.getOres(oredictName);
- trades.add(new Trade(stacks, minSize, maxSize));
+ ArrayList stacks = (ArrayList)OreDictionary.getOres(oredictName, false);
+ this.trades.add(new Trade(stacks, minSize, maxSize));
}
public void addWants(ItemStack stack, int minSize, int maxSize){
- trades.add(new Trade(stack, minSize, maxSize));
+ this.trades.add(new Trade(stack, minSize, maxSize));
}
- //TODO Fix the Villager
//@Override
- @SuppressWarnings("all")
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){
- for(int trade = 0; trade < trades.size(); trade++){
- for(int want = 0; want < trades.get(trade).wants.size(); want++){
- ItemStack wantsOne = trades.get(trade).wants.get(want);
- wantsOne.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(trade).minStackSize, trades.get(trade).maxStackSize);
+ for(int trade = 0; trade < this.trades.size(); trade++){
+ for(int want = 0; want < this.trades.get(trade).wants.size(); want++){
+ ItemStack wantsOne = this.trades.get(trade).wants.get(want);
+ wantsOne.stackSize = MathHelper.getRandomIntegerInRange(rand, this.trades.get(trade).minStackSize, this.trades.get(trade).maxStackSize);
ItemStack wantsTwo = null;
if(rand.nextInt(3) == 0){
- int randomSecondTrade = rand.nextInt(trades.size());
- for(int randomSecondWant = 0; randomSecondWant < trades.get(randomSecondTrade).wants.size(); randomSecondWant++){
- wantsTwo = trades.get(randomSecondTrade).wants.get(randomSecondWant);
- wantsTwo.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(randomSecondTrade).minStackSize, trades.get(randomSecondTrade).maxStackSize);
+ int randomSecondTrade = rand.nextInt(this.trades.size());
+ for(int randomSecondWant = 0; randomSecondWant < this.trades.get(randomSecondTrade).wants.size(); randomSecondWant++){
+ wantsTwo = this.trades.get(randomSecondTrade).wants.get(randomSecondWant);
+ wantsTwo.stackSize = MathHelper.getRandomIntegerInRange(rand, this.trades.get(randomSecondTrade).minStackSize, this.trades.get(randomSecondTrade).maxStackSize);
}
}
if(wantsOne == wantsTwo){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java
index 46a556502..317cdc0fe 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java
@@ -1,33 +1,45 @@
/*
- * This file ("OreGen.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("OreGen.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
-import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
+import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
-import net.minecraft.block.state.pattern.BlockHelper;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.init.Blocks;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.MathHelper;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
+import net.minecraft.world.biome.BiomeOcean;
+import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.fml.common.IWorldGenerator;
+import net.minecraftforge.fml.common.eventhandler.Event;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
+import org.apache.commons.lang3.ArrayUtils;
+import java.util.ArrayList;
import java.util.Random;
public class OreGen implements IWorldGenerator{
@@ -35,40 +47,32 @@ public class OreGen implements IWorldGenerator{
public static final int QUARTZ_MIN = 0;
public static final int QUARTZ_MAX = 45;
- public static void init(){
+ private final WorldGenLushCaves caveGen = new WorldGenLushCaves();
+
+ public OreGen(){
ModUtil.LOGGER.info("Registering World Generator...");
- GameRegistry.registerWorldGenerator(new OreGen(), 10);
+ GameRegistry.registerWorldGenerator(this, 10);
+ MinecraftForge.TERRAIN_GEN_BUS.register(this);
}
@Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
- if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimensionId()) < 0){
- switch(world.provider.getDimensionId()){
- case -1:
- generateNether(world, random, chunkX*16, chunkZ*16);
- //case 0:
- // generateSurface(world, random, chunkX*16, chunkZ*16);
- case 1:
- generateEnd(world, random, chunkX*16, chunkZ*16);
- default:
- generateSurface(world, random, chunkX*16, chunkZ*16);
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
+ int dimension = world.provider.getDimension();
+ if(dimension != -1 && dimension != 1){
+ if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ArrayUtils.toObject(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue()), world.provider.getDimension()) < 0){
+ this.generateDefault(world, random, chunkX*16, chunkZ*16);
}
}
}
- @SuppressWarnings("unused")
- private void generateNether(World world, Random random, int x, int z){
-
- }
-
- @SuppressWarnings("unused")
- private void generateEnd(World world, Random random, int x, int z){
-
- }
-
- private void generateSurface(World world, Random random, int x, int z){
+ private void generateDefault(World world, Random random, int x, int z){
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
- this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
+ this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.STONE, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
+ }
+
+ if(ConfigBoolValues.GEN_LUSH_CAVES.isEnabled() && random.nextInt(ConfigIntValues.LUSH_CAVE_CHANCE.getValue()) <= 0){
+ BlockPos posAtHeight = world.getTopSolidOrLiquidBlock(new BlockPos(x+random.nextInt(16)+8, 0, z+random.nextInt(16)+8));
+ this.caveGen.generate(world, random, posAtHeight.down(MathHelper.getRandomIntegerInRange(random, 10, posAtHeight.getY()-10)));
}
}
@@ -79,11 +83,80 @@ public class OreGen implements IWorldGenerator{
int posX = blockXPos+random.nextInt(16);
int posY = minY+random.nextInt(yDiff);
int posZ = blockZPos+random.nextInt(16);
- new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockHelper.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ));
+ new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockMatcher.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ));
}
}
else{
ModUtil.LOGGER.fatal("Couldn't generate '"+block.getUnlocalizedName()+"' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!");
}
}
+
+ @SubscribeEvent
+ public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
+ if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
+ if(Util.arrayContains(ArrayUtils.toObject(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue()), event.getWorld().provider.getDimension()) < 0){
+ this.generateRice(event);
+ this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
+ this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event);
+ this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.COFFEE.ordinal(), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.GRASS, event);
+ this.genPlantNormally(InitBlocks.blockBlackLotus, 0, ConfigIntValues.BLACK_LOTUS_AMOUNT.getValue(), ConfigBoolValues.DO_LOTUS_GEN.isEnabled(), Material.GRASS, event);
+ }
+
+ //Generate Treasure Chests
+ if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
+ if(event.getRand().nextInt(300) == 0){
+ BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
+ randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
+
+ if(event.getWorld().getBiomeGenForCoords(randomPos) instanceof BiomeOcean){
+ if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
+ if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
+ if(event.getWorld().getBlockState(randomPos.down()).getMaterial().isSolid()){
+ event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getStateFromMeta(event.getRand().nextInt(4)), 2);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void generateRice(DecorateBiomeEvent event){
+ if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
+ for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
+ if(event.getRand().nextInt(50) == 0){
+ BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
+ randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
+ if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
+ ArrayList blocksAroundBottom = WorldUtil.getMaterialsAround(event.getWorld(), randomPos);
+ BlockPos posToGenAt = randomPos.up();
+ ArrayList blocksAroundTop = WorldUtil.getMaterialsAround(event.getWorld(), posToGenAt);
+ if(blocksAroundBottom.contains(Material.GRASS) || blocksAroundBottom.contains(Material.GROUND) || blocksAroundBottom.contains(Material.ROCK) || blocksAroundBottom.contains(Material.SAND)){
+ if(!blocksAroundTop.contains(Material.WATER) && event.getWorld().getBlockState(posToGenAt).getMaterial() == Material.AIR){
+ event.getWorld().setBlockState(posToGenAt, InitBlocks.blockWildPlant.getStateFromMeta(TheWildPlants.RICE.ordinal()), 2);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
+ if(doIt){
+ for(int i = 0; i < amount; i++){
+ if(event.getRand().nextInt(400) == 0){
+ BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
+ randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
+
+ if(event.getWorld().getBlockState(randomPos.down()).getMaterial() == blockBelow){
+ if(plant.canPlaceBlockAt(event.getWorld(), randomPos) && event.getWorld().isAirBlock(randomPos)){
+ event.getWorld().setBlockState(randomPos, plant.getStateFromMeta(meta), 2);
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentCustomCropField.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentCustomCropField.java
index 2106b9729..61c054aa0 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentCustomCropField.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentCustomCropField.java
@@ -1,38 +1,48 @@
/*
- * This file ("VillageComponentCustomCropField.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("VillageComponentCustomCropField.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
+import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
+import net.minecraft.block.Block;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.math.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
+import java.util.List;
+import java.util.Random;
+
public class VillageComponentCustomCropField extends StructureVillagePieces.House1{
- private static final int xSize = 13;
- private static final int ySize = 4;
- private static final int zSize = 9;
+ private static final int X_SIZE = 13;
+ private static final int Y_SIZE = 4;
+ private static final int Z_SIZE = 9;
private int averageGroundLevel = -1;
- @SuppressWarnings("unused")
public VillageComponentCustomCropField(){
}
- //TODO Fix village
- /*public VillageComponentCustomCropField(StructureBoundingBox boundingBox, int par5){
- this.coordBaseMode = par5;
+ public VillageComponentCustomCropField(StructureBoundingBox boundingBox, EnumFacing par5){
+ this.setCoordBaseMode(par5);
this.boundingBox = boundingBox;
}
- public static VillageComponentCustomCropField buildComponent(List pieces, int p1, int p2, int p3, int p4){
- StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4);
+ public static VillageComponentCustomCropField buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
+ StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentCustomCropField(boundingBox, p4) : null;
}
@@ -43,16 +53,16 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
if(this.averageGroundLevel < 0){
return true;
}
- this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
+ this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+Y_SIZE-1, 0);
}
- this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.air);
+ this.fillWithBlocks(world, sbb, 0, 0, 0, X_SIZE-1, Y_SIZE-1, Z_SIZE-1, Blocks.AIR);
this.spawnActualHouse(world, rand, sbb);
- for(int i = 0; i < xSize; i++){
- for(int j = 0; j < zSize; j++){
- this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb);
- this.func_151554_b(world, Blocks.dirt, 0, i, -1, j, sbb);
+ for(int i = 0; i < X_SIZE; i++){
+ for(int j = 0; j < Z_SIZE; j++){
+ this.clearCurrentPositionBlocksUpwards(world, i, Y_SIZE, j, sbb);
+ this.replaceAirAndLiquidDownwards(world, Blocks.DIRT.getDefaultState(), i, -1, j, sbb);
}
}
@@ -60,44 +70,45 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
}
public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){
- this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false);
+ this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block.getDefaultState(), block.getDefaultState(), false);
}
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
- this.fillWithBlocks(world, sbb, 1, 0, 1, 2, 0, 7, Blocks.farmland);
- this.fillWithBlocks(world, sbb, 4, 0, 1, 5, 0, 7, Blocks.farmland);
- this.fillWithBlocks(world, sbb, 7, 0, 1, 8, 0, 7, Blocks.farmland);
- this.fillWithBlocks(world, sbb, 10, 0, 1, 11, 0, 7, Blocks.farmland);
- this.fillWithBlocks(world, sbb, 0, 0, 0, 0, 0, 8, Blocks.log);
- this.fillWithBlocks(world, sbb, 6, 0, 0, 6, 0, 8, Blocks.log);
- this.fillWithBlocks(world, sbb, 12, 0, 0, 12, 0, 8, Blocks.log);
- this.fillWithBlocks(world, sbb, 1, 0, 0, 11, 0, 0, Blocks.log);
- this.fillWithBlocks(world, sbb, 1, 0, 8, 11, 0, 8, Blocks.log);
- this.fillWithBlocks(world, sbb, 3, 0, 1, 3, 0, 7, Blocks.water);
- this.fillWithBlocks(world, sbb, 9, 0, 1, 9, 0, 7, Blocks.water);
+ this.fillWithBlocks(world, sbb, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND);
+ this.fillWithBlocks(world, sbb, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND);
+ this.fillWithBlocks(world, sbb, 7, 0, 1, 8, 0, 7, Blocks.FARMLAND);
+ this.fillWithBlocks(world, sbb, 10, 0, 1, 11, 0, 7, Blocks.FARMLAND);
+ this.fillWithBlocks(world, sbb, 0, 0, 0, 0, 0, 8, Blocks.LOG);
+ this.fillWithBlocks(world, sbb, 6, 0, 0, 6, 0, 8, Blocks.LOG);
+ this.fillWithBlocks(world, sbb, 12, 0, 0, 12, 0, 8, Blocks.LOG);
+ this.fillWithBlocks(world, sbb, 1, 0, 0, 11, 0, 0, Blocks.LOG);
+ this.fillWithBlocks(world, sbb, 1, 0, 8, 11, 0, 8, Blocks.LOG);
+ this.fillWithBlocks(world, sbb, 3, 0, 1, 3, 0, 7, Blocks.WATER);
+ this.fillWithBlocks(world, sbb, 9, 0, 1, 9, 0, 7, Blocks.WATER);
for(int i = 1; i <= 7; ++i){
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 1, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 2, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 4, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 5, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 7, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 8, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 10, 1, i, sbb);
- this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 11, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 1, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 2, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 4, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 5, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 7, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 8, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 10, 1, i, sbb);
+ this.setBlockState(world, this.getRandomCropType(rand), 11, 1, i, sbb);
}
}
- private Block getRandomCropType(Random rand){
+ private IBlockState getRandomCropType(Random rand){
+ int randomMeta = MathHelper.getRandomIntegerInRange(rand, 1, 7);
switch(rand.nextInt(4)){
case 0:
- return InitBlocks.blockFlax;
+ return InitBlocks.blockFlax.getStateFromMeta(randomMeta);
case 1:
- return InitBlocks.blockCoffee;
+ return InitBlocks.blockCoffee.getStateFromMeta(randomMeta);
case 2:
- return InitBlocks.blockRice;
+ return InitBlocks.blockRice.getStateFromMeta(randomMeta);
default:
- return InitBlocks.blockCanola;
+ return InitBlocks.blockCanola.getStateFromMeta(randomMeta);
}
- }*/
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentJamHouse.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentJamHouse.java
index 7fe2d8b9e..2ce2f0e6e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentJamHouse.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageComponentJamHouse.java
@@ -1,38 +1,46 @@
/*
- * This file ("VillageComponentJamHouse.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("VillageComponentJamHouse.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
+import net.minecraft.block.*;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.structure.StructureBoundingBox;
+import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
+import java.util.List;
+import java.util.Random;
+
public class VillageComponentJamHouse extends StructureVillagePieces.House1{
- private static final int xSize = 11;
- private static final int ySize = 8;
- private static final int zSize = 12;
+ private static final int X_SIZE = 11;
+ private static final int Y_SIZE = 8;
+ private static final int Z_SIZE = 12;
private int averageGroundLevel = -1;
- @SuppressWarnings("unused")
public VillageComponentJamHouse(){
}
- //TODO Fix village
- /*public VillageComponentJamHouse(StructureBoundingBox boundingBox, int par5){
- this.coordBaseMode = par5;
+ public VillageComponentJamHouse(StructureBoundingBox boundingBox, EnumFacing par5){
+ this.setCoordBaseMode(par5);
this.boundingBox = boundingBox;
}
- public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, int p4){
- StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4);
+ public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
+ StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null;
}
@@ -43,16 +51,16 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
if(this.averageGroundLevel < 0){
return true;
}
- this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
+ this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+Y_SIZE-1, 0);
}
- this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.air);
+ this.fillWithBlocks(world, sbb, 0, 0, 0, X_SIZE-1, Y_SIZE-1, Z_SIZE-1, Blocks.AIR);
this.spawnActualHouse(world, rand, sbb);
- for(int i = 0; i < xSize; i++){
- for(int j = 0; j < zSize; j++){
- this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb);
- this.func_151554_b(world, Blocks.cobblestone, 0, i, -1, j, sbb);
+ for(int i = 0; i < X_SIZE; i++){
+ for(int j = 0; j < Z_SIZE; j++){
+ this.clearCurrentPositionBlocksUpwards(world, i, Y_SIZE, j, sbb);
+ this.replaceAirAndLiquidDownwards(world, Blocks.COBBLESTONE.getDefaultState(), i, -1, j, sbb);
}
}
@@ -62,131 +70,133 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
}
public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){
- this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false);
+ this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block.getDefaultState(), block.getDefaultState(), false);
}
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
//Base
- this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.grass);
- this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 2, 0, 0, 4, 0, 1, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 9, 0, 0, 10, 0, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 6, 0, 0, 8, 0, 1, Blocks.cobblestone);
- this.placeBlockAtCurrentPosition(world, Blocks.stone_stairs, this.getMetadataWithOffset(Blocks.stone_stairs, 3), 5, 0, 0, sbb);
- this.fillWithBlocks(world, sbb, 2, 0, 7, 3, 0, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 5, 0, 7, 8, 0, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 10, 0, 8, 10, 0, 11, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 0, 0, 8, 0, 0, 11, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 0, 11, Blocks.cobblestone);
- this.fillWithMetadataBlocks(world, sbb, 2, 0, 2, 8, 0, 6, Blocks.planks, 1, Blocks.planks, 1, false);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 5, 0, 1, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 4, 0, 7, sbb);
+ this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.GRASS);
+ this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 2, 0, 0, 4, 0, 1, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 9, 0, 0, 10, 0, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 6, 0, 0, 8, 0, 1, Blocks.COBBLESTONE);
+ this.setBlockState(world, Blocks.STONE_STAIRS.getStateFromMeta(3), 5, 0, 0, sbb);
+ this.fillWithBlocks(world, sbb, 2, 0, 7, 3, 0, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 5, 0, 7, 8, 0, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 10, 0, 8, 10, 0, 11, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 0, 0, 8, 0, 0, 11, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 0, 11, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 2, 0, 2, 8, 0, 6, Blocks.PLANKS.getStateFromMeta(1), Blocks.PLANKS.getStateFromMeta(1), false);
+ this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(1), 5, 0, 1, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(1), 4, 0, 7, sbb);
- //Garden Fence
- this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 1, 11, Blocks.fence);
- this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 1, 11, Blocks.fence);
- this.fillWithBlocks(world, sbb, 1, 1, 11, 9, 1, 11, Blocks.fence);
+ //Garden FENCE
+ this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 1, 11, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 1, 11, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 1, 1, 11, 9, 1, 11, Blocks.OAK_FENCE);
//Side Walls
for(int i = 0; i < 2; i++){
- this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 1, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 4, 1, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 1+i*8, 1, 7, 1+i*8, 4, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 1+i*8, 4, 2, 1+i*8, 5, 6, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 1+i*8, 3, 2, 1+i*8, 3, 6, Blocks.planks);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i*8, 2, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i*8, 2, 6, sbb);
- this.fillWithBlocks(world, sbb, 1+i*8, 2, 3, 1+i*8, 2, 5, Blocks.glass_pane);
+ this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 1, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 4, 1, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 1+i*8, 1, 7, 1+i*8, 4, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 1+i*8, 4, 2, 1+i*8, 5, 6, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 1+i*8, 3, 2, 1+i*8, 3, 6, Blocks.PLANKS);
+ this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 1+i*8, 2, 2, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 1+i*8, 2, 6, sbb);
+ this.fillWithBlocks(world, sbb, 1+i*8, 2, 3, 1+i*8, 2, 5, Blocks.GLASS_PANE);
}
//Front Wall
- this.fillWithBlocks(world, sbb, 7, 1, 1, 8, 4, 1, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 2, 1, 1, 3, 4, 1, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 4, 4, 1, 7, 4, 1, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 3, 1, Blocks.planks);
- this.fillWithBlocks(world, sbb, 4, 1, 1, 4, 3, 1, Blocks.planks);
- this.fillWithBlocks(world, sbb, 5, 3, 1, 5, 3, 1, Blocks.planks);
- this.placeDoorAtCurrentPosition(world, sbb, rand, 5, 1, 1, this.getMetadataWithOffset(Blocks.wooden_door, 1));
+ this.fillWithBlocks(world, sbb, 7, 1, 1, 8, 4, 1, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 2, 1, 1, 3, 4, 1, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 4, 4, 1, 7, 4, 1, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 3, 1, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 4, 1, 1, 4, 3, 1, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 5, 3, 1, 5, 3, 1, Blocks.PLANKS);
+ this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState(), 5, 1, 1, sbb);
+ this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 5, 2, 1, sbb);
+
//Back Wall
- this.fillWithBlocks(world, sbb, 2, 1, 7, 2, 4, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 3, 1, 7, 3, 3, 7, Blocks.planks);
- this.fillWithBlocks(world, sbb, 4, 3, 7, 8, 3, 7, Blocks.planks);
- this.fillWithBlocks(world, sbb, 3, 4, 7, 8, 4, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 5, 1, 7, 5, 2, 7, Blocks.planks);
- this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.cobblestone);
- this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.glass_pane);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 8, 2, 7, sbb);
- this.placeDoorAtCurrentPosition(world, sbb, rand, 4, 1, 7, this.getMetadataWithOffset(Blocks.wooden_door, 1));
+ this.fillWithBlocks(world, sbb, 2, 1, 7, 2, 4, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 3, 1, 7, 3, 3, 7, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 4, 3, 7, 8, 3, 7, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 3, 4, 7, 8, 4, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 5, 1, 7, 5, 2, 7, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.COBBLESTONE);
+ this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.GLASS_PANE);
+ this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 8, 2, 7, sbb);
+ this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.SOUTH), 4, 1, 7, sbb);
+ this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.SOUTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 4, 2, 7, sbb);
- //Fence Supports
- this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.fence);
- this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 3, 8, Blocks.fence);
- this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 3, 0, Blocks.fence);
- this.fillWithBlocks(world, sbb, 10, 1, 0, 10, 3, 0, Blocks.fence);
+ //FENCE Supports
+ this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 3, 8, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 3, 0, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 10, 1, 0, 10, 3, 0, Blocks.OAK_FENCE);
//Roof
- this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.planks);
- this.fillWithMetadataBlocks(world, sbb, 0, 4, 0, 10, 4, 0, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false);
- this.fillWithMetadataBlocks(world, sbb, 0, 5, 1, 10, 5, 1, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false);
- this.fillWithMetadataBlocks(world, sbb, 0, 6, 2, 10, 6, 2, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false);
- this.fillWithMetadataBlocks(world, sbb, 0, 4, 8, 10, 4, 8, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false);
- this.fillWithMetadataBlocks(world, sbb, 0, 5, 7, 10, 5, 7, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false);
- this.fillWithMetadataBlocks(world, sbb, 0, 6, 6, 10, 6, 6, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false);
- this.fillWithBlocks(world, sbb, 0, 7, 3, 10, 7, 5, Blocks.wooden_slab);
+ this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.PLANKS);
+ IBlockState stairSouth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH);
+ IBlockState stairNorth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH);
+ this.fillWithBlocks(world, sbb, 0, 4, 0, 10, 4, 0, stairNorth, stairNorth, false);
+ this.fillWithBlocks(world, sbb, 0, 5, 1, 10, 5, 1, stairNorth, stairNorth, false);
+ this.fillWithBlocks(world, sbb, 0, 6, 2, 10, 6, 2, stairNorth, stairNorth, false);
+ this.fillWithBlocks(world, sbb, 0, 4, 8, 10, 4, 8, stairSouth, stairSouth, false);
+ this.fillWithBlocks(world, sbb, 0, 5, 7, 10, 5, 7, stairSouth, stairSouth, false);
+ this.fillWithBlocks(world, sbb, 0, 6, 6, 10, 6, 6, stairSouth, stairSouth, false);
+ this.fillWithBlocks(world, sbb, 0, 7, 3, 10, 7, 5, Blocks.WOODEN_SLAB);
//Roof Gadgets
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 1, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 1, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 7, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 6, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 7, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 6, sbb);
- this.fillWithBlocks(world, sbb, 0, 6, 3, 0, 6, 5, Blocks.planks);
- this.fillWithBlocks(world, sbb, 10, 6, 3, 10, 6, 5, Blocks.planks);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 4, 1, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 5, 2, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 4, 1, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 5, 2, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 4, 7, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 5, 6, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 4, 7, sbb);
+ this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 5, 6, sbb);
+ this.fillWithBlocks(world, sbb, 0, 6, 3, 0, 6, 5, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 10, 6, 3, 10, 6, 5, Blocks.PLANKS);
//Counter
- this.fillWithMetadataBlocks(world, sbb, 6, 3, 2, 6, 3, 4, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false);
- this.fillWithMetadataBlocks(world, sbb, 5, 3, 4, 5, 3, 6, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false);
- this.fillWithBlocks(world, sbb, 6, 1, 2, 6, 1, 4, Blocks.planks);
- this.fillWithBlocks(world, sbb, 5, 1, 4, 5, 1, 5, Blocks.planks);
- this.fillWithBlocks(world, sbb, 6, 4, 2, 6, 5, 2, Blocks.fence);
- this.fillWithBlocks(world, sbb, 5, 4, 4, 5, 5, 4, Blocks.fence);
- this.fillWithBlocks(world, sbb, 5, 4, 6, 5, 5, 6, Blocks.fence);
+ this.fillWithBlocks(world, sbb, 6, 3, 2, 6, 3, 4, Blocks.WOODEN_SLAB.getStateFromMeta(8), Blocks.WOODEN_SLAB.getStateFromMeta(8), false);
+ this.fillWithBlocks(world, sbb, 5, 3, 4, 5, 3, 6, Blocks.WOODEN_SLAB.getStateFromMeta(8), Blocks.WOODEN_SLAB.getStateFromMeta(8), false);
+ this.fillWithBlocks(world, sbb, 6, 1, 2, 6, 1, 4, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 5, 1, 4, 5, 1, 5, Blocks.PLANKS);
+ this.fillWithBlocks(world, sbb, 6, 4, 2, 6, 5, 2, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 5, 4, 4, 5, 5, 4, Blocks.OAK_FENCE);
+ this.fillWithBlocks(world, sbb, 5, 4, 6, 5, 5, 6, Blocks.OAK_FENCE);
//Decoration
- this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 8, 1, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 8, 2, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 6, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 6, sbb);
- this.fillWithMetadataBlocks(world, sbb, 2, 1, 3, 2, 1, 5, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), false);
- this.fillWithMetadataBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.carpet, 10, Blocks.carpet, 10, false);
- this.fillWithMetadataBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.carpet, 10, Blocks.carpet, 10, false);
+ this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 2, 1, 2, sbb);
+ this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 2, 2, 2, sbb);
+ this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 8, 1, 2, sbb);
+ this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 8, 2, 2, sbb);
+ this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 2, 1, 6, sbb);
+ this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 2, 2, 6, sbb);
+ IBlockState stairWest = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST);
+ this.fillWithBlocks(world, sbb, 2, 1, 3, 2, 1, 5, stairWest, stairWest, false);
+ this.fillWithBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false);
+ this.fillWithBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false);
//Loot Chest
- this.placeBlockAtCurrentPosition(world, Blocks.chest, 0, 8, 1, 6, sbb);
- TileEntity chest = world.getTileEntity(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6));
- if(chest != null && chest instanceof TileEntityChest){
+ this.setBlockState(world, Blocks.CHEST.getDefaultState(), 8, 1, 6, sbb);
+ //TileEntity chest = world.getTileEntity(new BlockPos(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6)));
+ //TODO Chest content
+ /*if(chest != null && chest instanceof TileEntityChest){
WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(InitVillager.JAM_HOUSE_CHEST_NAME, rand), (TileEntityChest)chest, ChestGenHooks.getCount(InitVillager.JAM_HOUSE_CHEST_NAME, rand));
- }
+ }*/
//Torches
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 2, 0, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 4, 2, 0, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 2, 8, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 2, 8, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 6, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 6, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 2, 0, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 4, 2, 0, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 5, 2, 8, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 3, 2, 8, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST), 2, 3, 2, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST), 2, 3, 6, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST), 8, 3, 2, sbb);
+ this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST), 8, 3, 6, sbb);
}
-
- @Override
- protected int getVillagerType(int par1){
- return ConfigIntValues.JAM_VILLAGER_ID.getValue();
- }*/
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageCustomCropFieldHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageCustomCropFieldHandler.java
index f5d6af12d..198e85d57 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageCustomCropFieldHandler.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageCustomCropFieldHandler.java
@@ -1,22 +1,24 @@
/*
- * This file ("VillageCustomCropFieldHandler.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("VillageCustomCropFieldHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
+import java.util.List;
import java.util.Random;
-//TODO Fix village
-public abstract class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
+public class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
@@ -28,8 +30,8 @@ public abstract class VillageCustomCropFieldHandler implements VillagerRegistry.
return VillageComponentCustomCropField.class;
}
- /*@Override
- public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){
- return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, p4);
- }*/
+ @Override
+ public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5){
+ return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, facing);
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageJamHouseHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageJamHouseHandler.java
index f847cdd2a..ac2809b31 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageJamHouseHandler.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/VillageJamHouseHandler.java
@@ -1,22 +1,24 @@
/*
- * This file ("VillageJamHouseHandler.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("VillageJamHouseHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.gen;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
+import java.util.List;
import java.util.Random;
-//TODO Fix village
-public abstract class VillageJamHouseHandler implements VillagerRegistry.IVillageCreationHandler{
+public class VillageJamHouseHandler implements VillagerRegistry.IVillageCreationHandler{
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
@@ -28,8 +30,8 @@ public abstract class VillageJamHouseHandler implements VillagerRegistry.IVillag
return VillageComponentJamHouse.class;
}
- /*@Override
- public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){
- return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, p4);
- }*/
+ @Override
+ public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5){
+ return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, facing);
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java
new file mode 100644
index 000000000..4b1dba16c
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java
@@ -0,0 +1,100 @@
+/*
+ * This file ("WorldGenLushCaves.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.gen;
+
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.EnumDyeColor;
+import net.minecraft.item.ItemDye;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.*;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+public class WorldGenLushCaves extends WorldGenerator{
+
+ @Override
+ public boolean generate(World world, Random rand, BlockPos position){
+ this.generateCave(world, position, rand);
+ return true;
+ }
+
+ private void generateCave(World world, BlockPos center, Random rand){
+ int spheres = rand.nextInt(5)+3;
+ for(int i = 0; i <= spheres; i++){
+ this.makeSphereWithGrassFloor(world, center.add(rand.nextInt(11)-5, rand.nextInt(7)-3, rand.nextInt(11)-5), rand.nextInt(3)+5);
+ }
+
+ this.genTreesAndTallGrass(world, center, 10, spheres*3, rand);
+ }
+
+ private void genTreesAndTallGrass(World world, BlockPos center, int radius, int amount, Random rand){
+ List possiblePoses = new ArrayList();
+ for(double x = -radius; x < radius; x++){
+ for(double y = -radius; y < radius; y++){
+ for(double z = -radius; z < radius; z++){
+ if(rand.nextDouble() >= 0.5D){
+ BlockPos pos = center.add(x, y, z);
+ if(world.getBlockState(pos).getBlock() == Blocks.GRASS){
+ possiblePoses.add(pos);
+ }
+ }
+ }
+ }
+ }
+
+ if(!possiblePoses.isEmpty()){
+ for(int i = 0; i <= amount; i++){
+ Collections.shuffle(possiblePoses);
+ BlockPos pos = possiblePoses.get(0);
+ if(rand.nextBoolean()){
+ WorldGenAbstractTree trees = rand.nextBoolean() ? (rand.nextBoolean() ? new WorldGenBigTree(false) : new WorldGenShrub(Blocks.LOG.getDefaultState(), Blocks.LEAVES.getDefaultState())) : new WorldGenTrees(false);
+ trees.generate(world, rand, pos.up());
+ }
+ else{
+ Blocks.GRASS.grow(world, rand, pos, world.getBlockState(pos));
+ }
+ }
+ }
+ }
+
+ private void makeSphereWithGrassFloor(World world, BlockPos center, int radius){
+ for(double x = -radius; x < radius; x++){
+ for(double y = -radius; y < radius; y++){
+ for(double z = -radius; z < radius; z++){
+ if(Math.sqrt((x*x)+(y*y)+(z*z)) < radius){
+ world.setBlockToAir(center.add(x, y, z));
+ }
+ }
+ }
+ }
+
+ for(double x = -radius; x < radius; x++){
+ for(double z = -radius; z < radius; z++){
+ for(double y = -radius; y <= -3; y++){
+ BlockPos pos = center.add(x, y, z);
+ IBlockState state = world.getBlockState(pos);
+ BlockPos posUp = pos.up();
+ IBlockState stateUp = world.getBlockState(posUp);
+ if(!state.getBlock().isAir(state, world, pos) && stateUp.getBlock().isAir(stateUp, world, posUp)){
+ world.setBlockState(pos, Blocks.GRASS.getDefaultState());
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java
index 35e952d42..d32505358 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java
@@ -1,28 +1,27 @@
/*
- * This file ("ContainerBreaker.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerBreaker.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerBreaker extends Container{
- private TileEntityBreaker breaker;
+ private final TileEntityBreaker breaker;
public ContainerBreaker(InventoryPlayer inventory, TileEntityBase tile){
this.breaker = (TileEntityBreaker)tile;
@@ -45,12 +44,12 @@ public class ContainerBreaker extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 9;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 9;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -75,7 +74,7 @@ public class ContainerBreaker extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java
index dc636f81f..0fa580100 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java
@@ -1,41 +1,34 @@
/*
- * This file ("ContainerCanolaPress.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerCanolaPress.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
-import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
-import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-import net.minecraftforge.fluids.FluidStack;
-@InventoryContainer
+
public class ContainerCanolaPress extends Container{
- private TileEntityCanolaPress press;
+ private final TileEntityCanolaPress press;
public ContainerCanolaPress(InventoryPlayer inventory, TileEntityBase tile){
this.press = (TileEntityCanolaPress)tile;
this.addSlotToContainer(new Slot(this.press, 0, 81, 10));
- this.addSlotToContainer(new Slot(this.press, 1, 136, 73));
- this.addSlotToContainer(new SlotOutput(this.press, 2, 136, 42));
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
@@ -49,12 +42,12 @@ public class ContainerCanolaPress extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 3;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 1;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -68,11 +61,6 @@ public class ContainerCanolaPress extends Container{
return null;
}
}
- else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitFluids.fluidCanolaOil, 1), newStack) > 0){
- if(!this.mergeItemStack(newStack, 1, 2, false)){
- return null;
- }
- }
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
@@ -88,7 +76,7 @@ public class ContainerCanolaPress extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java
index 6c7dacdfa..ac31b4c08 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java
@@ -1,18 +1,17 @@
/*
- * This file ("ContainerCoalGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerCoalGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -20,10 +19,10 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
-@InventoryContainer
+
public class ContainerCoalGenerator extends Container{
- private TileEntityCoalGenerator generator;
+ private final TileEntityCoalGenerator generator;
public ContainerCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
this.generator = (TileEntityCoalGenerator)tile;
@@ -42,12 +41,12 @@ public class ContainerCoalGenerator extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 1;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 1;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -76,7 +75,7 @@ public class ContainerCoalGenerator extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java
index d9e5a4824..6a3235757 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerCoffeeMachine.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -16,37 +16,30 @@ import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-import net.minecraftforge.fluids.FluidRegistry;
-import net.minecraftforge.fluids.FluidStack;
-@InventoryContainer
+
public class ContainerCoffeeMachine extends Container{
- private TileEntityCoffeeMachine machine;
+ private final TileEntityCoffeeMachine machine;
public ContainerCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile){
this.machine = (TileEntityCoffeeMachine)tile;
- this.addSlotToContainer(new Slot(machine, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, 37, 6));
- this.addSlotToContainer(new Slot(machine, TileEntityCoffeeMachine.SLOT_INPUT, 80, 42));
- this.addSlotToContainer(new SlotOutput(machine, TileEntityCoffeeMachine.SLOT_OUTPUT, 80, 73));
+ this.addSlotToContainer(new Slot(this.machine, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, 37, 6));
+ this.addSlotToContainer(new Slot(this.machine, TileEntityCoffeeMachine.SLOT_INPUT, 80, 42));
+ this.addSlotToContainer(new SlotOutput(this.machine, TileEntityCoffeeMachine.SLOT_OUTPUT, 80, 73));
for(int i = 0; i < 4; i++){
for(int j = 0; j < 2; j++){
- this.addSlotToContainer(new Slot(machine, j+i*2+3, 125+j*18, 6+i*18));
+ this.addSlotToContainer(new Slot(this.machine, j+i*2+3, 125+j*18, 6+i*18));
}
}
- this.addSlotToContainer(new Slot(machine, TileEntityCoffeeMachine.SLOT_WATER_INPUT, 26, 73));
- this.addSlotToContainer(new SlotOutput(machine, TileEntityCoffeeMachine.SLOT_WATER_OUTPUT, 45, 73));
-
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18));
@@ -59,12 +52,12 @@ public class ContainerCoffeeMachine extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 13;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 11;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -85,11 +78,6 @@ public class ContainerCoffeeMachine extends Container{
return null;
}
}
- else if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(FluidRegistry.WATER, 1))){
- if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_WATER_INPUT, TileEntityCoffeeMachine.SLOT_WATER_INPUT+1, false)){
- return null;
- }
- }
else if(ItemCoffee.getIngredientFromStack(newStack) != null){
if(!this.mergeItemStack(newStack, 3, 11, false)){
return null;
@@ -115,7 +103,7 @@ public class ContainerCoffeeMachine extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCrafter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCrafter.java
index 25c9dc220..347630639 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCrafter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCrafter.java
@@ -1,16 +1,16 @@
/*
- * This file ("ContainerCrafter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerCrafter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
-import invtweaks.api.container.InventoryContainer;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
@@ -18,23 +18,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
-@InventoryContainer
+
public class ContainerCrafter extends Container{
- public final int x;
- public final int y;
- public final int z;
public final World world;
- public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
- public IInventory craftResult = new InventoryCraftResult();
+ public final InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
+ public final IInventory craftResult = new InventoryCraftResult();
public ContainerCrafter(EntityPlayer player){
InventoryPlayer inventory = player.inventory;
this.world = player.worldObj;
- this.x = (int)player.posX;
- this.y = (int)player.posY;
- this.z = (int)player.posZ;
this.addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
for(int i = 0; i < 3; i++){
@@ -56,44 +50,55 @@ public class ContainerCrafter extends Container{
}
@Override
- public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- ItemStack stack = null;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ public ItemStack transferStackInSlot(EntityPlayer player, int index){
+ ItemStack itemstack = null;
+ Slot slot = this.inventorySlots.get(index);
- if(theSlot != null && theSlot.getHasStack()){
- ItemStack savedStack = theSlot.getStack();
- stack = savedStack.copy();
+ if(slot != null && slot.getHasStack()){
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
- if(slot == 0){
- if(!this.mergeItemStack(savedStack, 10, 46, true)){
+ if(index == 0){
+ if(!this.mergeItemStack(itemstack1, 10, 46, true)){
return null;
}
- theSlot.onSlotChange(savedStack, stack);
+
+ slot.onSlotChange(itemstack1, itemstack);
}
- else if(slot >= 10 && slot < 37 && !this.mergeItemStack(savedStack, 37, 46, false)){
- return null;
+ else if(index >= 10 && index < 37){
+ if(!this.mergeItemStack(itemstack1, 37, 46, false)){
+ return null;
+ }
}
- else if(slot >= 37 && slot < 46 && !this.mergeItemStack(savedStack, 10, 37, false)){
- return null;
+ else if(index >= 37 && index < 46){
+ if(!this.mergeItemStack(itemstack1, 10, 37, false)){
+ return null;
+ }
}
- else if(!this.mergeItemStack(savedStack, 10, 46, false)){
+ else if(!this.mergeItemStack(itemstack1, 10, 46, false)){
return null;
}
- if(savedStack.stackSize == 0){
- theSlot.putStack(null);
+ if(itemstack1.stackSize <= 0){
+ slot.putStack(null);
}
else{
- theSlot.onSlotChanged();
+ slot.onSlotChanged();
}
- if(savedStack.stackSize == stack.stackSize){
+ if(itemstack1.stackSize == itemstack.stackSize){
return null;
}
- theSlot.onPickupFromSlot(player, savedStack);
+ slot.onPickupFromSlot(player, itemstack1);
}
- return stack;
+
+ return itemstack;
+ }
+
+ @Override
+ public boolean canMergeSlot(ItemStack stack, Slot slotIn){
+ return slotIn.inventory != this.craftResult && super.canMergeSlot(stack, slotIn);
}
@Override
@@ -104,7 +109,7 @@ public class ContainerCrafter extends Container{
for(int i = 0; i < 9; ++i){
ItemStack stack = this.craftMatrix.removeStackFromSlot(i);
if(stack != null){
- player.dropPlayerItemWithRandomChoice(stack, false);
+ player.dropItem(stack, false);
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java
index 09523d780..31f567093 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java
@@ -1,28 +1,27 @@
/*
- * This file ("ContainerDirectionalBreaker.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerDirectionalBreaker.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerDirectionalBreaker extends Container{
- private TileEntityDirectionalBreaker breaker;
+ private final TileEntityDirectionalBreaker breaker;
public ContainerDirectionalBreaker(InventoryPlayer inventory, TileEntityBase tile){
this.breaker = (TileEntityDirectionalBreaker)tile;
@@ -45,12 +44,12 @@ public class ContainerDirectionalBreaker extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 9;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 9;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -75,7 +74,7 @@ public class ContainerDirectionalBreaker extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java
index 17914bb9e..e0871a873 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerDrill.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerDrill.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -14,28 +14,29 @@ import cofh.api.energy.IEnergyContainerItem;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable;
import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.IChatComponent;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TextComponentTranslation;
+
-@InventoryContainer
public class ContainerDrill extends Container{
- private static final int SLOT_AMOUNT = 5;
+ public static final int SLOT_AMOUNT = 5;
- private InventoryDrill drillInventory = new InventoryDrill();
- private InventoryPlayer inventory;
+ private final InventoryDrill drillInventory = new InventoryDrill();
+ private final InventoryPlayer inventory;
public ContainerDrill(InventoryPlayer inventory){
this.inventory = inventory;
for(int i = 0; i < SLOT_AMOUNT; i++){
- this.addSlotToContainer(new Slot(drillInventory, i, 44+i*18, 19){
+ this.addSlotToContainer(new Slot(this.drillInventory, i, 44+i*18, 19){
@Override
public boolean isItemValid(ItemStack stack){
return stack.getItem() instanceof ItemDrillUpgrade || stack.getItem() instanceof IEnergyContainerItem;
@@ -59,19 +60,16 @@ public class ContainerDrill extends Container{
ItemStack stack = inventory.getCurrentItem();
if(stack != null && stack.getItem() instanceof ItemDrill){
- ItemStack[] slots = ((ItemDrill)stack.getItem()).getSlotsFromNBT(inventory.getCurrentItem());
- if(slots != null && slots.length > 0){
- this.drillInventory.slots = slots;
- }
+ ItemDrill.loadSlotsFromNBT(this.drillInventory.slots, inventory.getCurrentItem());
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 5;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 5;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
Slot theSlot = this.inventorySlots.get(slot);
@@ -102,7 +100,7 @@ public class ContainerDrill extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
@@ -120,22 +118,20 @@ public class ContainerDrill extends Container{
}
@Override
- public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
- //par3 appears to be the type of clicking
- //par3 == 2 appears to be one of the number keys being hit
- if(par3 == 2 && par2 == inventory.currentItem){
+ public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
+ if(clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem){
return null;
}
else{
- return super.slotClick(par1, par2, par3, player);
+ return super.slotClick(slotId, dragType, clickTypeIn, player);
}
}
@Override
public void onContainerClosed(EntityPlayer player){
- ItemStack stack = inventory.getCurrentItem();
+ ItemStack stack = this.inventory.getCurrentItem();
if(stack != null && stack.getItem() instanceof ItemDrill){
- ((ItemDrill)stack.getItem()).writeSlotsToNBT(this.drillInventory.slots, inventory.getCurrentItem());
+ ItemDrill.writeSlotsToNBT(this.drillInventory.slots, this.inventory.getCurrentItem());
}
super.onContainerClosed(player);
}
@@ -154,16 +150,6 @@ public class ContainerDrill extends Container{
return "drill";
}
- @Override
- public boolean hasCustomName(){
- return false;
- }
-
- @Override
- public IChatComponent getDisplayName(){
- return null;
- }
-
@Override
public int getInventoryStackLimit(){
return 64;
@@ -175,7 +161,22 @@ public class ContainerDrill extends Container{
}
@Override
- public boolean isItemValidForSlot(int slot, ItemStack stack){
+ public boolean isUseableByPlayer(EntityPlayer player){
+ return true;
+ }
+
+ @Override
+ public void openInventory(EntityPlayer player){
+
+ }
+
+ @Override
+ public void closeInventory(EntityPlayer player){
+
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int index, ItemStack stack){
return true;
}
@@ -196,22 +197,8 @@ public class ContainerDrill extends Container{
@Override
public void clear(){
- this.slots = new ItemStack[this.slots.length];
- }
-
- @Override
- public boolean isUseableByPlayer(EntityPlayer player){
- return true;
- }
-
- @Override
- public void openInventory(EntityPlayer player){
-
- }
-
- @Override
- public void closeInventory(EntityPlayer player){
-
+ int length = this.slots.length;
+ this.slots = new ItemStack[length];
}
@Override
@@ -222,31 +209,31 @@ public class ContainerDrill extends Container{
@Override
public int getSizeInventory(){
- return slots.length;
+ return this.slots.length;
}
@Override
public ItemStack getStackInSlot(int i){
if(i < this.getSizeInventory()){
- return slots[i];
+ return this.slots[i];
}
return null;
}
@Override
public ItemStack decrStackSize(int i, int j){
- if(slots[i] != null){
+ if(this.slots[i] != null){
ItemStack stackAt;
- if(slots[i].stackSize <= j){
- stackAt = slots[i];
- slots[i] = null;
+ if(this.slots[i].stackSize <= j){
+ stackAt = this.slots[i];
+ this.slots[i] = null;
this.markDirty();
return stackAt;
}
else{
- stackAt = slots[i].splitStack(j);
- if(slots[i].stackSize == 0){
- slots[i] = null;
+ stackAt = this.slots[i].splitStack(j);
+ if(this.slots[i].stackSize <= 0){
+ this.slots[i] = null;
}
this.markDirty();
return stackAt;
@@ -261,5 +248,16 @@ public class ContainerDrill extends Container{
this.slots[index] = null;
return stack;
}
+
+ @Override
+ public boolean hasCustomName(){
+ return false;
+ }
+
+
+ @Override
+ public ITextComponent getDisplayName(){
+ return new TextComponentTranslation(this.getName());
+ }
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java
index f6b268e0a..f6843b5b9 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java
@@ -1,28 +1,27 @@
/*
- * This file ("ContainerDropper.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerDropper.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerDropper extends Container{
- private TileEntityDropper dropper;
+ private final TileEntityDropper dropper;
public ContainerDropper(InventoryPlayer inventory, TileEntityBase tile){
this.dropper = (TileEntityDropper)tile;
@@ -45,12 +44,12 @@ public class ContainerDropper extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 9;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 9;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -75,7 +74,7 @@ public class ContainerDropper extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java
index d28356719..4f3382ad8 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerEnergizer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerEnergizer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -14,22 +14,23 @@ import cofh.api.energy.IEnergyContainerItem;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@InventoryContainer
+
public class ContainerEnergizer extends Container{
- private TileEntityEnergizer energizer;
+ public static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[]{EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
+ private final TileEntityEnergizer energizer;
- public ContainerEnergizer(EntityPlayer player, TileEntityBase tile){
+ public ContainerEnergizer(final EntityPlayer player, TileEntityBase tile){
this.energizer = (TileEntityEnergizer)tile;
InventoryPlayer inventory = player.inventory;
@@ -44,24 +45,24 @@ public class ContainerEnergizer extends Container{
for(int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155));
}
- final EntityPlayer finalPlayer = player;
- for(int i = 0; i < 4; ++i){
- final int finalI = i;
- this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){
- @Override
- public boolean isItemValid(ItemStack stack){
- return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer);
- }
+ for(int k = 0; k < 4; ++k){
+ final EntityEquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k];
+ this.addSlotToContainer(new Slot(player.inventory, 36+(3-k), 102, 19+k*18){
@Override
public int getSlotStackLimit(){
return 1;
}
+ @Override
+ public boolean isItemValid(ItemStack stack){
+ return stack != null && stack.getItem().isValidArmor(stack, slot, player);
+ }
+
@Override
@SideOnly(Side.CLIENT)
public String getSlotTexture(){
- return ItemArmor.EMPTY_SLOT_NAMES[finalI];
+ return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()];
}
});
}
@@ -69,12 +70,12 @@ public class ContainerEnergizer extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 2;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 2;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -110,7 +111,7 @@ public class ContainerEnergizer extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java
index 95829c910..d13fa3cd6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerEnervator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerEnervator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -14,22 +14,22 @@ import cofh.api.energy.IEnergyContainerItem;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@InventoryContainer
+
public class ContainerEnervator extends Container{
- private TileEntityEnervator enervator;
+ private final TileEntityEnervator enervator;
- public ContainerEnervator(EntityPlayer player, TileEntityBase tile){
+ public ContainerEnervator(final EntityPlayer player, TileEntityBase tile){
this.enervator = (TileEntityEnervator)tile;
InventoryPlayer inventory = player.inventory;
@@ -44,24 +44,24 @@ public class ContainerEnervator extends Container{
for(int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155));
}
- final EntityPlayer finalPlayer = player;
- for(int i = 0; i < 4; ++i){
- final int finalI = i;
- this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){
- @Override
- public boolean isItemValid(ItemStack stack){
- return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer);
- }
+ for(int k = 0; k < 4; ++k){
+ final EntityEquipmentSlot slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k];
+ this.addSlotToContainer(new Slot(player.inventory, 36+(3-k), 102, 19+k*18){
@Override
public int getSlotStackLimit(){
return 1;
}
+ @Override
+ public boolean isItemValid(ItemStack stack){
+ return stack != null && stack.getItem().isValidArmor(stack, slot, player);
+ }
+
@Override
@SideOnly(Side.CLIENT)
public String getSlotTexture(){
- return ItemArmor.EMPTY_SLOT_NAMES[finalI];
+ return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()];
}
});
}
@@ -69,12 +69,12 @@ public class ContainerEnervator extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 2;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 2;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -110,7 +110,7 @@ public class ContainerEnervator extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java
index 267b17a25..847331f2a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java
@@ -1,28 +1,27 @@
/*
- * This file ("ContainerFeeder.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerFeeder.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerFeeder extends Container{
- private TileEntityFeeder tileFeeder;
+ private final TileEntityFeeder tileFeeder;
public ContainerFeeder(InventoryPlayer inventory, TileEntityBase tile){
this.tileFeeder = (TileEntityFeeder)tile;
@@ -40,12 +39,12 @@ public class ContainerFeeder extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 1;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 1;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -70,7 +69,7 @@ public class ContainerFeeder extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java
index 6a23ad5df..eaa94d1f6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java
@@ -1,41 +1,31 @@
/*
- * This file ("ContainerFermentingBarrel.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerFermentingBarrel.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
-import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
-import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-import net.minecraftforge.fluids.FluidStack;
-@InventoryContainer
+
public class ContainerFermentingBarrel extends Container{
- private TileEntityFermentingBarrel barrel;
+ private final TileEntityFermentingBarrel barrel;
public ContainerFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){
this.barrel = (TileEntityFermentingBarrel)tile;
- this.addSlotToContainer(new Slot(this.barrel, 0, 42, 74));
- this.addSlotToContainer(new SlotOutput(this.barrel, 1, 42, 43));
- this.addSlotToContainer(new Slot(this.barrel, 2, 118, 74));
- this.addSlotToContainer(new SlotOutput(this.barrel, 3, 118, 43));
-
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18));
@@ -48,12 +38,12 @@ public class ContainerFermentingBarrel extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 4;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 0;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -61,20 +51,7 @@ public class ContainerFermentingBarrel extends Container{
//Other Slots in Inventory excluded
if(slot >= inventoryStart){
- //Shift from Inventory
- if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitFluids.fluidCanolaOil, 1))){
- if(!this.mergeItemStack(newStack, 0, 1, false)){
- return null;
- }
- }
- else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitFluids.fluidOil, 1), newStack) > 0){
- if(!this.mergeItemStack(newStack, 2, 3, false)){
- return null;
- }
- }
- //
-
- else if(slot >= inventoryStart && slot <= inventoryEnd){
+ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
@@ -87,7 +64,7 @@ public class ContainerFermentingBarrel extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
@@ -106,6 +83,6 @@ public class ContainerFermentingBarrel extends Container{
@Override
public boolean canInteractWith(EntityPlayer player){
- return this.barrel.isUseableByPlayer(player);
+ return this.barrel.canPlayerUse(player);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java
new file mode 100644
index 000000000..e0855fe6c
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java
@@ -0,0 +1,258 @@
+/*
+ * This file ("ContainerFilter.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.inventory;
+
+import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
+import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable;
+import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
+import de.ellpeck.actuallyadditions.mod.items.ItemFilter;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ClickType;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TextComponentTranslation;
+
+
+public class ContainerFilter extends Container{
+
+ public static final int SLOT_AMOUNT = 24;
+
+ private final InventoryFilter filterInventory = new InventoryFilter();
+ private final InventoryPlayer inventory;
+
+ public ContainerFilter(InventoryPlayer inventory){
+ this.inventory = inventory;
+
+ for(int i = 0; i < 4; i++){
+ for(int j = 0; j < 6; j++){
+ this.addSlotToContainer(new SlotFilter(this.filterInventory, j+(i*6), 35+j*18, 10+i*18));
+ }
+ }
+
+ for(int i = 0; i < 3; i++){
+ for(int j = 0; j < 9; j++){
+ this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 94+i*18));
+ }
+ }
+ for(int i = 0; i < 9; i++){
+ if(i == inventory.currentItem){
+ this.addSlotToContainer(new SlotImmovable(inventory, i, 8+i*18, 152));
+ }
+ else{
+ this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 152));
+ }
+ }
+
+ ItemStack stack = inventory.getCurrentItem();
+ if(stack != null && stack.getItem() instanceof ItemFilter){
+ ItemDrill.loadSlotsFromNBT(this.filterInventory.slots, inventory.getCurrentItem());
+ }
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slot){
+ int inventoryStart = SLOT_AMOUNT;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
+
+ Slot theSlot = this.inventorySlots.get(slot);
+
+ if(theSlot != null && theSlot.getHasStack()){
+ ItemStack newStack = theSlot.getStack();
+ ItemStack currentStack = newStack.copy();
+
+ //Other Slots in Inventory excluded
+ if(slot >= inventoryStart){
+ //Shift from Inventory
+ //
+ if(slot >= inventoryStart && slot <= inventoryEnd){
+ if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
+ return null;
+ }
+ }
+ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
+ return null;
+ }
+ }
+ else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
+ return null;
+ }
+
+ if(newStack.stackSize == 0){
+ theSlot.putStack(null);
+ }
+ else{
+ theSlot.onSlotChanged();
+ }
+
+ if(newStack.stackSize == currentStack.stackSize){
+ return null;
+ }
+ theSlot.onPickupFromSlot(player, newStack);
+
+ return currentStack;
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
+ if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){
+ //Calls the Filter's SlotClick function
+ return ((SlotFilter)this.getSlot(slotId)).slotClick(player);
+ }
+ else if(clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem){
+ return null;
+ }
+ else{
+ return super.slotClick(slotId, dragType, clickTypeIn, player);
+ }
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer player){
+ ItemStack stack = this.inventory.getCurrentItem();
+ if(stack != null && stack.getItem() instanceof ItemFilter){
+ ItemDrill.writeSlotsToNBT(this.filterInventory.slots, this.inventory.getCurrentItem());
+ }
+ super.onContainerClosed(player);
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player){
+ return this.filterInventory.isUseableByPlayer(player);
+ }
+
+ public static class InventoryFilter implements IInventory{
+
+ public ItemStack[] slots = new ItemStack[SLOT_AMOUNT];
+
+ @Override
+ public String getName(){
+ return "filter";
+ }
+
+ @Override
+ public int getInventoryStackLimit(){
+ return 64;
+ }
+
+ @Override
+ public void markDirty(){
+
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer player){
+ return true;
+ }
+
+ @Override
+ public void openInventory(EntityPlayer player){
+
+ }
+
+ @Override
+ public void closeInventory(EntityPlayer player){
+
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int index, ItemStack stack){
+ return true;
+ }
+
+ @Override
+ public int getField(int id){
+ return 0;
+ }
+
+ @Override
+ public void setField(int id, int value){
+
+ }
+
+ @Override
+ public int getFieldCount(){
+ return 0;
+ }
+
+ @Override
+ public void clear(){
+ int length = this.slots.length;
+ this.slots = new ItemStack[length];
+ }
+
+ @Override
+ public void setInventorySlotContents(int i, ItemStack stack){
+ this.slots[i] = stack;
+ this.markDirty();
+ }
+
+ @Override
+ public int getSizeInventory(){
+ return this.slots.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int i){
+ if(i < this.getSizeInventory()){
+ return this.slots[i];
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int i, int j){
+ if(this.slots[i] != null){
+ ItemStack stackAt;
+ if(this.slots[i].stackSize <= j){
+ stackAt = this.slots[i];
+ this.slots[i] = null;
+ this.markDirty();
+ return stackAt;
+ }
+ else{
+ stackAt = this.slots[i].splitStack(j);
+ if(this.slots[i].stackSize <= 0){
+ this.slots[i] = null;
+ }
+ this.markDirty();
+ return stackAt;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack removeStackFromSlot(int index){
+ ItemStack stack = this.slots[index];
+ this.slots[index] = null;
+ return stack;
+ }
+
+ @Override
+ public boolean hasCustomName(){
+ return false;
+ }
+
+
+ @Override
+ public ITextComponent getDisplayName(){
+ return new TextComponentTranslation(this.getName());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java
index 0ff708024..e48cd81d1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java
@@ -1,37 +1,31 @@
/*
- * This file ("ContainerFluidCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerFluidCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
-import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-@InventoryContainer
+
public class ContainerFluidCollector extends Container{
- private TileEntityFluidCollector collector;
+ private final TileEntityFluidCollector collector;
public ContainerFluidCollector(InventoryPlayer inventory, TileEntityBase tile){
this.collector = (TileEntityFluidCollector)tile;
- this.addSlotToContainer(new Slot(collector, 0, 90, 73));
- this.addSlotToContainer(new SlotOutput(collector, 1, 90, 42));
-
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18));
@@ -44,12 +38,12 @@ public class ContainerFluidCollector extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 2;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 0;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -64,15 +58,7 @@ public class ContainerFluidCollector extends Container{
}
//Other Slots in Inventory excluded
else if(slot >= inventoryStart){
- //Shift from Inventory
- if(FluidContainerRegistry.isEmptyContainer(newStack)){
- if(!this.mergeItemStack(newStack, 0, 1, false)){
- return null;
- }
- }
- //
-
- else if(slot >= inventoryStart && slot <= inventoryEnd){
+ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
@@ -85,7 +71,7 @@ public class ContainerFluidCollector extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
@@ -104,6 +90,6 @@ public class ContainerFluidCollector extends Container{
@Override
public boolean canInteractWith(EntityPlayer player){
- return this.collector.isUseableByPlayer(player);
+ return this.collector.canPlayerUse(player);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java
index 0bf493f40..cc5a34e4f 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java
@@ -1,18 +1,17 @@
/*
- * This file ("ContainerFurnaceDouble.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerFurnaceDouble.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -21,10 +20,10 @@ import net.minecraft.inventory.SlotFurnaceOutput;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
-@InventoryContainer
+
public class ContainerFurnaceDouble extends Container{
- private TileEntityFurnaceDouble tileFurnace;
+ private final TileEntityFurnaceDouble tileFurnace;
public ContainerFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
this.tileFurnace = (TileEntityFurnaceDouble)tile;
@@ -46,12 +45,12 @@ public class ContainerFurnaceDouble extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 4;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 4;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -89,7 +88,7 @@ public class ContainerFurnaceDouble extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java
index f28af7335..c66995247 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerGiantChest.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerGiantChest.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -19,17 +19,17 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@ChestContainer(rowSize = 13)
+@ChestContainer(rowSize = 13, isLargeChest = true)
public class ContainerGiantChest extends Container{
- public TileEntityGiantChest tileChest;
+ public final TileEntityGiantChest tileChest;
- public ContainerGiantChest(InventoryPlayer inventory, TileEntityBase tile){
+ public ContainerGiantChest(InventoryPlayer inventory, TileEntityBase tile, int page){
this.tileChest = (TileEntityGiantChest)tile;
for(int i = 0; i < 9; i++){
for(int j = 0; j < 13; j++){
- this.addSlotToContainer(new Slot(this.tileChest, j+(i*13), 5+j*18, 5+i*18));
+ this.addSlotToContainer(new Slot(this.tileChest, (9*13*page)+j+(i*13), 5+j*18, 5+i*18));
}
}
@@ -45,12 +45,12 @@ public class ContainerGiantChest extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 117;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 117;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -75,7 +75,7 @@ public class ContainerGiantChest extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java
index 8d7b36b63..9ec622969 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerGrinder.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerGrinder.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -22,11 +21,10 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
public class ContainerGrinder extends Container{
- public TileEntityGrinder tileGrinder;
- private boolean isDouble;
+ public final TileEntityGrinder tileGrinder;
+ private final boolean isDouble;
public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){
this.tileGrinder = (TileEntityGrinder)tile;
@@ -53,12 +51,12 @@ public class ContainerGrinder extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = this.isDouble ? 6 : 3;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = this.isDouble ? 6 : 3;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -101,7 +99,7 @@ public class ContainerGrinder extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java
index 82efa927d..d8ae94535 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerInputter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerInputter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -14,19 +14,19 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerInputter extends Container{
- private TileEntityInputter tileInputter;
+ private final TileEntityInputter tileInputter;
- private boolean isAdvanced;
+ private final boolean isAdvanced;
public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile, boolean isAdvanced){
this.tileInputter = (TileEntityInputter)tile;
@@ -46,22 +46,22 @@ public class ContainerInputter extends Container{
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
- this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18+(isAdvanced ? GuiInputter.OFFSET_ADVANCED : 0)));
+ this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 101+i*18+(isAdvanced ? GuiInputter.OFFSET_ADVANCED : 0)));
}
}
for(int i = 0; i < 9; i++){
- this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155+(isAdvanced ? GuiInputter.OFFSET_ADVANCED : 0)));
+ this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 159+(isAdvanced ? GuiInputter.OFFSET_ADVANCED : 0)));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = this.isAdvanced ? 25 : 1;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = this.isAdvanced ? 25 : 1;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -86,7 +86,7 @@ public class ContainerInputter extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
@@ -104,13 +104,13 @@ public class ContainerInputter extends Container{
}
@Override
- public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
- if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
+ public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
+ if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){
//Calls the Filter's SlotClick function
- return ((SlotFilter)getSlot(par1)).slotClick(player);
+ return ((SlotFilter)this.getSlot(slotId)).slotClick(player);
}
else{
- return super.slotClick(par1, par2, par3, player);
+ return super.slotClick(slotId, dragType, clickTypeIn, player);
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java
new file mode 100644
index 000000000..db0bfd991
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java
@@ -0,0 +1,109 @@
+/*
+ * This file ("ContainerLaserRelayItemWhitelist.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.inventory;
+
+import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ClickType;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+
+public class ContainerLaserRelayItemWhitelist extends Container{
+
+ private final TileEntityLaserRelayItemWhitelist tile;
+
+ public ContainerLaserRelayItemWhitelist(InventoryPlayer inventory, TileEntityBase tile){
+ this.tile = (TileEntityLaserRelayItemWhitelist)tile;
+
+ for(int i = 0; i < 2; i++){
+ for(int x = 0; x < 3; x++){
+ for(int y = 0; y < 4; y++){
+ this.addSlotToContainer(new SlotFilter(this.tile.filterInventory, y+x*4+i*12, 20+i*84+x*18, 6+y*18));
+ }
+ }
+ }
+
+ for(int i = 0; i < 3; i++){
+ for(int j = 0; j < 9; j++){
+ this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18));
+ }
+ }
+ for(int i = 0; i < 9; i++){
+ this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155));
+ }
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slot){
+ int inventoryStart = 0;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
+
+ Slot theSlot = this.inventorySlots.get(slot);
+
+ if(theSlot != null && theSlot.getHasStack()){
+ ItemStack newStack = theSlot.getStack();
+ ItemStack currentStack = newStack.copy();
+
+ //Other Slots in Inventory excluded
+ if(slot >= inventoryStart){
+ if(slot >= inventoryStart && slot <= inventoryEnd){
+ if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
+ return null;
+ }
+ }
+ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
+ return null;
+ }
+ }
+ else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
+ return null;
+ }
+
+ if(newStack.stackSize <= 0){
+ theSlot.putStack(null);
+ }
+ else{
+ theSlot.onSlotChanged();
+ }
+
+ if(newStack.stackSize == currentStack.stackSize){
+ return null;
+ }
+ theSlot.onPickupFromSlot(player, newStack);
+
+ return currentStack;
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
+ if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){
+ //Calls the Filter's SlotClick function
+ return ((SlotFilter)this.getSlot(slotId)).slotClick(player);
+ }
+ else{
+ return super.slotClick(slotId, dragType, clickTypeIn, player);
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player){
+ return this.tile.canPlayerUse(player);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java
index e42b19279..f88888640 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java
@@ -1,28 +1,27 @@
/*
- * This file ("ContainerMiner.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerMiner.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerMiner extends Container{
- private TileEntityMiner miner;
+ private final TileEntityMiner miner;
public ContainerMiner(InventoryPlayer inventory, TileEntityBase tile){
this.miner = (TileEntityMiner)tile;
@@ -45,12 +44,12 @@ public class ContainerMiner extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 9;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 9;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -75,7 +74,7 @@ public class ContainerMiner extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java
index a41d04864..a77bcc3cf 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java
@@ -1,39 +1,30 @@
/*
- * This file ("ContainerOilGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerOilGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
-import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
-import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-import net.minecraftforge.fluids.FluidStack;
-@InventoryContainer
public class ContainerOilGenerator extends Container{
- private TileEntityOilGenerator generator;
+ private final TileEntityOilGenerator generator;
public ContainerOilGenerator(InventoryPlayer inventory, TileEntityBase tile){
this.generator = (TileEntityOilGenerator)tile;
- this.addSlotToContainer(new Slot(this.generator, 0, 98, 74));
- this.addSlotToContainer(new SlotOutput(this.generator, 1, 98, 43));
-
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18));
@@ -46,12 +37,12 @@ public class ContainerOilGenerator extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 2;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 0;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -59,15 +50,7 @@ public class ContainerOilGenerator extends Container{
//Other Slots in Inventory excluded
if(slot >= inventoryStart){
- //Shift from Inventory
- if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitFluids.fluidOil, 1))){
- if(!this.mergeItemStack(newStack, 0, 1, false)){
- return null;
- }
- }
- //
-
- else if(slot >= inventoryStart && slot <= inventoryEnd){
+ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
@@ -80,7 +63,7 @@ public class ContainerOilGenerator extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
@@ -99,6 +82,6 @@ public class ContainerOilGenerator extends Container{
@Override
public boolean canInteractWith(EntityPlayer player){
- return this.generator.isUseableByPlayer(player);
+ return this.generator.canPlayerUse(player);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java
index b41246de6..9b82c73b1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java
@@ -1,28 +1,27 @@
/*
- * This file ("ContainerPhantomPlacer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerPhantomPlacer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerPhantomPlacer extends Container{
- private TileEntityPhantomPlacer placer;
+ private final TileEntityPhantomPlacer placer;
public ContainerPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){
this.placer = (TileEntityPhantomPlacer)tile;
@@ -45,12 +44,12 @@ public class ContainerPhantomPlacer extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 9;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 9;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -75,7 +74,7 @@ public class ContainerPhantomPlacer extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java
index 89eb7b93c..44ae77f02 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerRangedCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerRangedCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -13,17 +13,17 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerRangedCollector extends Container{
- private TileEntityRangedCollector collector;
+ private final TileEntityRangedCollector collector;
public ContainerRangedCollector(InventoryPlayer inventory, TileEntityBase tile){
this.collector = (TileEntityRangedCollector)tile;
@@ -51,12 +51,12 @@ public class ContainerRangedCollector extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 18;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 18;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -81,7 +81,7 @@ public class ContainerRangedCollector extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
@@ -99,13 +99,13 @@ public class ContainerRangedCollector extends Container{
}
@Override
- public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
- if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
+ public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
+ if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){
//Calls the Filter's SlotClick function
- return ((SlotFilter)getSlot(par1)).slotClick(player);
+ return ((SlotFilter)this.getSlot(slotId)).slotClick(player);
}
else{
- return super.slotClick(par1, par2, par3, player);
+ return super.slotClick(slotId, dragType, clickTypeIn, player);
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java
index c75ab13c4..6f1e45d81 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerRepairer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerRepairer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -13,17 +13,16 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerRepairer extends Container{
- private TileEntityItemRepairer tileRepairer;
+ private final TileEntityItemRepairer tileRepairer;
public ContainerRepairer(InventoryPlayer inventory, TileEntityBase tile){
this.tileRepairer = (TileEntityItemRepairer)tile;
@@ -43,12 +42,12 @@ public class ContainerRepairer extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 2;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 2;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -77,7 +76,7 @@ public class ContainerRepairer extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java
index 586303d7a..7e32752a8 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerSmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java
index 961b346f2..a224ac39e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java
@@ -1,11 +1,11 @@
/*
- * This file ("ContainerXPSolidifier.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ContainerXPSolidifier.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
@@ -13,22 +13,21 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
-import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-@InventoryContainer
+
public class ContainerXPSolidifier extends Container{
- private TileEntityXPSolidifier solidifier;
+ private final TileEntityXPSolidifier solidifier;
public ContainerXPSolidifier(InventoryPlayer inventory, TileEntityBase tile){
this.solidifier = (TileEntityXPSolidifier)tile;
- this.addSlotToContainer(new SlotOutput(solidifier, 0, 80, 8));
+ this.addSlotToContainer(new SlotOutput(this.solidifier, 0, 80, 8));
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
@@ -42,12 +41,12 @@ public class ContainerXPSolidifier extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
- final int inventoryStart = 1;
- final int inventoryEnd = inventoryStart+26;
- final int hotbarStart = inventoryEnd+1;
- final int hotbarEnd = hotbarStart+8;
+ int inventoryStart = 1;
+ int inventoryEnd = inventoryStart+26;
+ int hotbarStart = inventoryEnd+1;
+ int hotbarEnd = hotbarStart+8;
- Slot theSlot = (Slot)this.inventorySlots.get(slot);
+ Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack();
@@ -68,7 +67,7 @@ public class ContainerXPSolidifier extends Container{
return null;
}
- if(newStack.stackSize == 0){
+ if(newStack.stackSize <= 0){
theSlot.putStack(null);
}
else{
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java
index 3ce88f5d0..600f10cfc 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java
@@ -1,22 +1,23 @@
/*
- * This file ("GuiHandler.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
+import de.ellpeck.actuallyadditions.mod.booklet.GuiBookletStand;
import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
@@ -38,7 +39,11 @@ public class GuiHandler implements IGuiHandler{
case FEEDER:
return new ContainerFeeder(entityPlayer.inventory, tile);
case GIANT_CHEST:
- return new ContainerGiantChest(entityPlayer.inventory, tile);
+ return new ContainerGiantChest(entityPlayer.inventory, tile, 0);
+ case GIANT_CHEST_PAGE_2:
+ return new ContainerGiantChest(entityPlayer.inventory, tile, 1);
+ case GIANT_CHEST_PAGE_3:
+ return new ContainerGiantChest(entityPlayer.inventory, tile, 2);
case CRAFTER:
return new ContainerCrafter(entityPlayer);
case GRINDER:
@@ -73,6 +78,8 @@ public class GuiHandler implements IGuiHandler{
return new ContainerCoffeeMachine(entityPlayer.inventory, tile);
case DRILL:
return new ContainerDrill(entityPlayer.inventory);
+ case FILTER:
+ return new ContainerFilter(entityPlayer.inventory);
case ENERGIZER:
return new ContainerEnergizer(entityPlayer, tile);
case ENERVATOR:
@@ -87,6 +94,8 @@ public class GuiHandler implements IGuiHandler{
return new ContainerRangedCollector(entityPlayer.inventory, tile);
case MINER:
return new ContainerMiner(entityPlayer.inventory, tile);
+ case LASER_RELAY_ITEM_WHITELIST:
+ return new ContainerLaserRelayItemWhitelist(entityPlayer.inventory, tile);
default:
return null;
}
@@ -102,7 +111,11 @@ public class GuiHandler implements IGuiHandler{
case FEEDER:
return new GuiFeeder(entityPlayer.inventory, tile);
case GIANT_CHEST:
- return new GuiGiantChest(entityPlayer.inventory, tile);
+ return new GuiGiantChest(entityPlayer.inventory, tile, 0);
+ case GIANT_CHEST_PAGE_2:
+ return new GuiGiantChest(entityPlayer.inventory, tile, 1);
+ case GIANT_CHEST_PAGE_3:
+ return new GuiGiantChest(entityPlayer.inventory, tile, 2);
case CRAFTER:
return new GuiCrafter(entityPlayer);
case GRINDER:
@@ -137,6 +150,8 @@ public class GuiHandler implements IGuiHandler{
return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world);
case DRILL:
return new GuiDrill(entityPlayer.inventory);
+ case FILTER:
+ return new GuiFilter(entityPlayer.inventory);
case ENERGIZER:
return new GuiEnergizer(entityPlayer, tile);
case ENERVATOR:
@@ -153,6 +168,10 @@ public class GuiHandler implements IGuiHandler{
return new GuiRangedCollector(entityPlayer.inventory, tile, x, y, z, world);
case MINER:
return new GuiMiner(entityPlayer.inventory, tile);
+ case BOOK_STAND:
+ return new GuiBookletStand(tile);
+ case LASER_RELAY_ITEM_WHITELIST:
+ return new GuiLaserRelayItemWhitelist(entityPlayer.inventory, tile);
default:
return null;
}
@@ -161,6 +180,8 @@ public class GuiHandler implements IGuiHandler{
public enum GuiTypes{
FEEDER,
GIANT_CHEST,
+ GIANT_CHEST_PAGE_2,
+ GIANT_CHEST_PAGE_3,
CRAFTER(false),
GRINDER,
GRINDER_DOUBLE,
@@ -185,9 +206,12 @@ public class GuiHandler implements IGuiHandler{
BOOK(false),
DIRECTIONAL_BREAKER,
RANGED_COLLECTOR,
- MINER;
+ MINER,
+ BOOK_STAND,
+ LASER_RELAY_ITEM_WHITELIST,
+ FILTER(false);
- public boolean checkTileEntity;
+ public final boolean checkTileEntity;
GuiTypes(){
this(true);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java
index 413ff5cb3..3ca67be11 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiBreaker.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiBreaker.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -24,8 +24,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiBreaker extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
- private TileEntityBreaker breaker;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiBreaker");
+ private final TileEntityBreaker breaker;
public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerBreaker(inventory, tile));
@@ -34,14 +34,9 @@ public class GuiBreaker extends GuiContainer{
this.ySize = 93+86;
}
- @Override
- public void drawScreen(int x, int y, float f){
- super.drawScreen(x, y, f);
- }
-
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.breaker.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.breaker);
}
@Override
@@ -51,7 +46,7 @@ public class GuiBreaker extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java
index 8594f6447..2d28853e6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiCanolaPress.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiCanolaPress.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -27,8 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiCanolaPress extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCanolaPress");
- private TileEntityCanolaPress press;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiCanolaPress");
+ private final TileEntityCanolaPress press;
public GuiCanolaPress(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerCanolaPress(inventory, tile));
@@ -41,19 +41,19 @@ public class GuiCanolaPress extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.press.storage.getEnergyStored()+"/"+this.press.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
+ if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
String text2 = StringUtil.getFluidInfo(this.press.tank);
- if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){
+ if(x >= this.guiLeft+117 && y >= this.guiTop+6 && x <= this.guiLeft+132 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.press);
}
@Override
@@ -63,22 +63,22 @@ public class GuiCanolaPress extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.press.storage.getEnergyStored() > 0){
int i = this.press.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 29, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 29, 16, i);
}
if(this.press.tank.getFluidAmount() > 0){
int i = this.press.getTankScaled(83);
- drawTexturedModalRect(this.guiLeft+117, this.guiTop+89-i, 192, 29, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+117, this.guiTop+89-i, 192, 29, 16, i);
}
if(this.press.currentProcessTime > 0){
int i = this.press.getProcessScaled(29);
- drawTexturedModalRect(this.guiLeft+83, this.guiTop+32, 176, 0, 12, i);
+ this.drawTexturedModalRect(this.guiLeft+83, this.guiTop+32, 176, 0, 12, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java
index a0d541a9d..36ea1bb24 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiCoalGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiCoalGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,8 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiCoalGenerator extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoalGenerator");
- private TileEntityCoalGenerator generator;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiCoalGenerator");
+ private final TileEntityCoalGenerator generator;
public GuiCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerCoalGenerator(inventory, tile));
@@ -40,14 +40,14 @@ public class GuiCoalGenerator extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.generator.storage.getEnergyStored()+"/"+this.generator.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
+ if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.generator);
}
@Override
@@ -57,17 +57,17 @@ public class GuiCoalGenerator extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.generator.storage.getEnergyStored() > 0){
int i = this.generator.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
}
if(this.generator.currentBurnTime > 0){
int i = this.generator.getBurningScaled(13);
- this.drawTexturedModalRect(guiLeft+87, guiTop+27+12-i, 176, 96-i, 14, i);
+ this.drawTexturedModalRect(this.guiLeft+87, this.guiTop+27+12-i, 176, 96-i, 14, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java
index 9991570ec..e745b36d3 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java
@@ -1,18 +1,18 @@
/*
- * This file ("GuiCoffeeMachine.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiButton;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@@ -23,6 +23,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -33,12 +34,12 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiCoffeeMachine extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoffeeMachine");
- private TileEntityCoffeeMachine machine;
- private int x;
- private int y;
- private int z;
- private World world;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiCoffeeMachine");
+ private final TileEntityCoffeeMachine machine;
+ private final int x;
+ private final int y;
+ private final int z;
+ private final World world;
public GuiCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerCoffeeMachine(inventory, tile));
@@ -51,12 +52,11 @@ public class GuiCoffeeMachine extends GuiContainer{
this.world = world;
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
- GuiButton buttonOkay = new GuiButton(0, guiLeft+60, guiTop+11, 58, 20, StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.ok"));
+ GuiButton buttonOkay = new GuiButton(0, this.guiLeft+60, this.guiTop+11, 58, 20, StringUtil.localize("info."+ModUtil.MOD_ID+".gui.ok"));
this.buttonList.add(buttonOkay);
}
@@ -65,23 +65,23 @@ public class GuiCoffeeMachine extends GuiContainer{
super.drawScreen(x, y, f);
String text1 = this.machine.storage.getEnergyStored()+"/"+this.machine.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+16 && y >= guiTop+5 && x <= guiLeft+23 && y <= guiTop+89){
+ if(x >= this.guiLeft+16 && y >= this.guiTop+5 && x <= this.guiLeft+23 && y <= this.guiTop+89){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
String text3 = StringUtil.getFluidInfo(this.machine.tank);
- if(x >= guiLeft+27 && y >= guiTop+5 && x <= guiLeft+33 && y <= guiTop+70){
+ if(x >= this.guiLeft+27 && y >= this.guiTop+5 && x <= this.guiLeft+33 && y <= this.guiTop+70){
this.drawHoveringText(Collections.singletonList(text3), x, y);
}
- String text2 = this.machine.coffeeCacheAmount+"/"+TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.coffee");
- if(x >= guiLeft+40 && y >= guiTop+25 && x <= guiLeft+49 && y <= guiTop+56){
+ String text2 = this.machine.coffeeCacheAmount+"/"+TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT+" "+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.coffee");
+ if(x >= this.guiLeft+40 && y >= this.guiTop+25 && x <= this.guiLeft+49 && y <= this.guiTop+56){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.machine.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.machine);
}
@Override
@@ -91,34 +91,41 @@ public class GuiCoffeeMachine extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.machine.storage.getEnergyStored() > 0){
int i = this.machine.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+17, this.guiTop+89-i, 176, 0, 6, i);
+ this.drawTexturedModalRect(this.guiLeft+17, this.guiTop+89-i, 176, 0, 6, i);
}
if(this.machine.tank.getFluidAmount() > 0){
int i = this.machine.getWaterScaled(64);
- drawTexturedModalRect(this.guiLeft+27, this.guiTop+70-i, 182, 0, 6, i);
+ this.drawTexturedModalRect(this.guiLeft+27, this.guiTop+70-i, 182, 0, 6, i);
}
if(this.machine.coffeeCacheAmount > 0){
int i = this.machine.getCoffeeScaled(30);
- drawTexturedModalRect(this.guiLeft+41, this.guiTop+56-i, 192, 0, 8, i);
+ this.drawTexturedModalRect(this.guiLeft+41, this.guiTop+56-i, 192, 0, 8, i);
}
if(this.machine.brewTime > 0){
int i = this.machine.getBrewScaled(23);
- drawTexturedModalRect(this.guiLeft+53, this.guiTop+42, 192, 30, i, 16);
+ this.drawTexturedModalRect(this.guiLeft+53, this.guiTop+42, 192, 30, i, 16);
int j = this.machine.getBrewScaled(26);
- drawTexturedModalRect(this.guiLeft+99+25-j, this.guiTop+44, 192+25-j, 46, j, 12);
+ this.drawTexturedModalRect(this.guiLeft+99+25-j, this.guiTop+44, 192+25-j, 46, j, 12);
}
}
@Override
public void actionPerformed(GuiButton button){
- PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.x);
+ compound.setInteger("Y", this.y);
+ compound.setInteger("Z", this.z);
+ compound.setInteger("WorldID", this.world.provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCrafter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCrafter.java
index e66956e1b..b097bf05f 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCrafter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCrafter.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiCrafter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiCrafter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -23,7 +23,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiCrafter extends GuiContainer{
- private static final ResourceLocation resLoc = new ResourceLocation("textures/gui/container/crafting_table.png");
+ private static final ResourceLocation RES_LOC = new ResourceLocation("textures/gui/container/crafting_table.png");
public GuiCrafter(EntityPlayer player){
super(new ContainerCrafter(player));
@@ -34,13 +34,13 @@ public class GuiCrafter extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, "container."+ModUtil.MOD_ID_LOWER+".crafting");
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, "container."+ModUtil.MOD_ID+".crafting");
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java
index f3dacb552..5bb51f2ef 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiDirectionalBreaker.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiDirectionalBreaker.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,8 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiDirectionalBreaker extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiDirectionalBreaker");
- private TileEntityDirectionalBreaker breaker;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiDirectionalBreaker");
+ private final TileEntityDirectionalBreaker breaker;
public GuiDirectionalBreaker(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerDirectionalBreaker(inventory, tile));
@@ -41,14 +41,14 @@ public class GuiDirectionalBreaker extends GuiContainer{
super.drawScreen(x, y, f);
String text1 = this.breaker.storage.getEnergyStored()+"/"+this.breaker.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
+ if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.breaker.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.breaker);
}
@Override
@@ -58,12 +58,12 @@ public class GuiDirectionalBreaker extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.breaker.storage.getEnergyStored() > 0){
int i = this.breaker.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 29, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 29, 16, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java
index fce51af26..24cdb2e1c 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiDrill.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiDrill.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -23,7 +23,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiDrill extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiDrill");
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiDrill");
public GuiDrill(InventoryPlayer inventory){
super(new ContainerDrill(inventory));
@@ -33,7 +33,7 @@ public class GuiDrill extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, "container."+ModUtil.MOD_ID_LOWER+".drill");
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, "container."+ModUtil.MOD_ID+".drill");
}
@Override
@@ -43,7 +43,7 @@ public class GuiDrill extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+54, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 54);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java
index a015c2eef..ad94d37e7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiDropper.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiDropper.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -24,8 +24,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiDropper extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
- private TileEntityDropper dropper;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiBreaker");
+ private final TileEntityDropper dropper;
public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerDropper(inventory, tile));
@@ -34,14 +34,9 @@ public class GuiDropper extends GuiContainer{
this.ySize = 93+86;
}
- @Override
- public void drawScreen(int x, int y, float f){
- super.drawScreen(x, y, f);
- }
-
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.dropper.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.dropper);
}
@Override
@@ -51,7 +46,7 @@ public class GuiDropper extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java
index 57e370a46..2e8251dc1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiEnergizer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiEnergizer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,8 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiEnergizer extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer");
- private TileEntityEnergizer energizer;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiEnergizer");
+ private final TileEntityEnergizer energizer;
public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile){
super(new ContainerEnergizer(inventory, tile));
@@ -40,14 +40,14 @@ public class GuiEnergizer extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.energizer.storage.getEnergyStored()+"/"+this.energizer.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+57 && y >= guiTop+6 && x <= guiLeft+72 && y <= guiTop+88){
+ if(x >= this.guiLeft+57 && y >= this.guiTop+6 && x <= this.guiLeft+72 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.energizer.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.energizer);
}
@Override
@@ -57,12 +57,12 @@ public class GuiEnergizer extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.energizer.storage.getEnergyStored() > 0){
int i = this.energizer.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java
index 866c82aa0..49a30f393 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiEnervator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiEnervator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,8 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiEnervator extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer");
- private TileEntityEnervator enervator;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiEnergizer");
+ private final TileEntityEnervator enervator;
public GuiEnervator(EntityPlayer inventory, TileEntityBase tile){
super(new ContainerEnervator(inventory, tile));
@@ -40,14 +40,14 @@ public class GuiEnervator extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.enervator.storage.getEnergyStored()+"/"+this.enervator.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+57 && y >= guiTop+6 && x <= guiLeft+72 && y <= guiTop+88){
+ if(x >= this.guiLeft+57 && y >= this.guiTop+6 && x <= this.guiLeft+72 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.enervator.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.enervator);
}
@Override
@@ -57,12 +57,12 @@ public class GuiEnervator extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.enervator.storage.getEnergyStored() > 0){
int i = this.enervator.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java
index 7e60a3795..fbb9bead4 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiFeeder.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiFeeder.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -28,8 +28,8 @@ import java.util.Arrays;
@SideOnly(Side.CLIENT)
public class GuiFeeder extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFeeder");
- public TileEntityFeeder tileFeeder;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFeeder");
+ public final TileEntityFeeder tileFeeder;
public GuiFeeder(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFeeder(inventory, tile));
@@ -41,15 +41,15 @@ public class GuiFeeder extends GuiContainer{
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
- if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){
- String[] array = new String[]{(this.tileFeeder.currentAnimalAmount+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.tooMany") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.notEnough")))};
+ if(x >= this.guiLeft+69 && y >= this.guiTop+30 && x <= this.guiLeft+69+10 && y <= this.guiTop+30+10){
+ String[] array = new String[]{(this.tileFeeder.currentAnimalAmount+" "+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.tooMany") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.notEnough")))};
this.drawHoveringText(Arrays.asList(array), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileFeeder.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileFeeder);
}
@Override
@@ -57,20 +57,20 @@ public class GuiFeeder extends GuiContainer{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+70, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 70);
if(this.tileFeeder.currentTimer > 0){
int i = this.tileFeeder.getCurrentTimerToScale(20);
- this.drawTexturedModalRect(guiLeft+85, guiTop+42-i, 181, 19+19-i, 6, 20);
+ this.drawTexturedModalRect(this.guiLeft+85, this.guiTop+42-i, 181, 19+19-i, 6, 20);
}
if(this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD){
- this.drawTexturedModalRect(guiLeft+70, guiTop+31, 192, 16, 8, 8);
+ this.drawTexturedModalRect(this.guiLeft+70, this.guiTop+31, 192, 16, 8, 8);
}
if(this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD){
- this.drawTexturedModalRect(guiLeft+70, guiTop+31, 192, 24, 8, 8);
+ this.drawTexturedModalRect(this.guiLeft+70, this.guiTop+31, 192, 24, 8, 8);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java
index 543f88437..9d45e29df 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiFermentingBarrel.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiFermentingBarrel.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -27,8 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiFermentingBarrel extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFermentingBarrel");
- private TileEntityFermentingBarrel press;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFermentingBarrel");
+ private final TileEntityFermentingBarrel press;
public GuiFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFermentingBarrel(inventory, tile));
@@ -42,19 +42,19 @@ public class GuiFermentingBarrel extends GuiContainer{
super.drawScreen(x, y, f);
String text1 = StringUtil.getFluidInfo(this.press.canolaTank);
- if(x >= guiLeft+61 && y >= guiTop+6 && x <= guiLeft+76 && y <= guiTop+88){
+ if(x >= this.guiLeft+61 && y >= this.guiTop+6 && x <= this.guiLeft+76 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
String text2 = StringUtil.getFluidInfo(this.press.oilTank);
- if(x >= guiLeft+99 && y >= guiTop+6 && x <= guiLeft+114 && y <= guiTop+88){
+ if(x >= this.guiLeft+99 && y >= this.guiTop+6 && x <= this.guiLeft+114 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.press);
}
@Override
@@ -64,22 +64,22 @@ public class GuiFermentingBarrel extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.press.canolaTank.getFluidAmount() > 0){
int i = this.press.getCanolaTankScaled(83);
- drawTexturedModalRect(this.guiLeft+61, this.guiTop+89-i, 192, 29, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+61, this.guiTop+89-i, 192, 29, 16, i);
}
if(this.press.oilTank.getFluidAmount() > 0){
int i = this.press.getOilTankScaled(83);
- drawTexturedModalRect(this.guiLeft+99, this.guiTop+89-i, 176, 29, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+99, this.guiTop+89-i, 176, 29, 16, i);
}
if(this.press.currentProcessTime > 0){
int i = this.press.getProcessScaled(29);
- drawTexturedModalRect(this.guiLeft+82, this.guiTop+34, 176, 0, 12, i);
+ this.drawTexturedModalRect(this.guiLeft+82, this.guiTop+34, 176, 0, 12, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java
new file mode 100644
index 000000000..398971903
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java
@@ -0,0 +1,49 @@
+/*
+ * This file ("GuiFilter.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.inventory.gui;
+
+import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+@SideOnly(Side.CLIENT)
+public class GuiFilter extends GuiContainer{
+
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFilter");
+
+ public GuiFilter(InventoryPlayer inventory){
+ super(new ContainerFilter(inventory));
+ this.xSize = 176;
+ this.ySize = 90+86;
+ }
+
+ @Override
+ public void drawGuiContainerForegroundLayer(int x, int y){
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, "container."+ModUtil.MOD_ID+".filter");
+ }
+
+ @Override
+ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop+90, 0, 0, 176, 86);
+
+ this.mc.getTextureManager().bindTexture(RES_LOC);
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 90);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java
index bf3aedf77..bcb33a796 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiFluidCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiFluidCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -27,8 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiFluidCollector extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFluidCollector");
- private TileEntityFluidCollector collector;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFluidCollector");
+ private final TileEntityFluidCollector collector;
public GuiFluidCollector(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFluidCollector(inventory, tile));
@@ -42,14 +42,14 @@ public class GuiFluidCollector extends GuiContainer{
super.drawScreen(x, y, f);
String text2 = StringUtil.getFluidInfo(this.collector.tank);
- if(x >= guiLeft+68 && y >= guiTop+6 && x <= guiLeft+83 && y <= guiTop+88){
+ if(x >= this.guiLeft+68 && y >= this.guiTop+6 && x <= this.guiLeft+83 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.collector.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.collector);
}
@Override
@@ -59,12 +59,12 @@ public class GuiFluidCollector extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.collector.tank.getFluidAmount() > 0){
int i = this.collector.getTankScaled(83);
- drawTexturedModalRect(this.guiLeft+68, this.guiTop+89-i, 176, 0, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+68, this.guiTop+89-i, 176, 0, 16, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java
index a821f0a28..9e97b5af5 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiFurnaceDouble.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiFurnaceDouble.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,8 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiFurnaceDouble extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFurnaceDouble");
- private TileEntityFurnaceDouble tileFurnace;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFurnaceDouble");
+ private final TileEntityFurnaceDouble tileFurnace;
public GuiFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFurnaceDouble(inventory, tile));
@@ -40,14 +40,14 @@ public class GuiFurnaceDouble extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text = this.tileFurnace.storage.getEnergyStored()+"/"+this.tileFurnace.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+28 && y >= guiTop+6 && x <= guiLeft+43 && y <= guiTop+88){
+ if(x >= this.guiLeft+28 && y >= this.guiTop+6 && x <= this.guiLeft+43 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileFurnace.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileFurnace);
}
@Override
@@ -57,12 +57,12 @@ public class GuiFurnaceDouble extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileFurnace.storage.getEnergyStored() > 0){
int i = this.tileFurnace.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
}
if(this.tileFurnace.firstSmeltTime > 0){
int i = this.tileFurnace.getFirstTimeToScale(23);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java
index 87acd5918..769a80037 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java
@@ -1,50 +1,86 @@
/*
- * This file ("GuiGiantChest.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiGiantChest.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGiantChest;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
+import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
+import java.io.IOException;
+
@SideOnly(Side.CLIENT)
public class GuiGiantChest extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGiantChest");
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiGiantChest");
- TileEntityGiantChest chest;
+ private final TileEntityGiantChest chest;
+ private final int page;
- public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){
- super(new ContainerGiantChest(inventory, tile));
+ public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile, int page){
+ super(new ContainerGiantChest(inventory, tile, page));
this.chest = (TileEntityGiantChest)tile;
+ this.page = page;
this.xSize = 242;
this.ySize = 172+86;
}
+ @Override
+ public void initGui(){
+ super.initGui();
+
+ if(this.page > 0){
+ this.buttonList.add(new GuiButton(this.page-1, this.guiLeft+13, this.guiTop+172, 20, 20, "<"));
+ }
+
+ if((this.page == 0 && this.chest instanceof TileEntityGiantChestMedium) || (this.page <= 1 && this.chest instanceof TileEntityGiantChestLarge)){
+ this.buttonList.add(new GuiButton(this.page+1, this.guiLeft+209, this.guiTop+172, 20, 20, ">"));
+ }
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton button) throws IOException{
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.chest.getPos().getX());
+ compound.setInteger("Y", this.chest.getPos().getY());
+ compound.setInteger("Z", this.chest.getPos().getZ());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("WorldID", this.chest.getWorld().provider.getDimension());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
+ }
+
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.chest.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.chest);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 190);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft+33, this.guiTop+172, 0, 0, 176, 86);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java
index db7c2e000..5336aa460 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiGrinder.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiGrinder.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,10 +26,10 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiGrinder extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGrinder");
- private static final ResourceLocation resLocDouble = AssetUtil.getGuiLocation("guiGrinderDouble");
- private TileEntityGrinder tileGrinder;
- private boolean isDouble;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiGrinder");
+ private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("guiGrinderDouble");
+ private final TileEntityGrinder tileGrinder;
+ private final boolean isDouble;
public GuiGrinder(InventoryPlayer inventoryPlayer, TileEntityBase tile){
this(inventoryPlayer, tile, false);
@@ -47,14 +47,14 @@ public class GuiGrinder extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text = this.tileGrinder.storage.getEnergyStored()+"/"+this.tileGrinder.storage.getMaxEnergyStored()+" RF";
- if((this.isDouble && x >= guiLeft+14 && y >= guiTop+6 && x <= guiLeft+29 && y <= guiTop+88) || (!this.isDouble && x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88)){
+ if((this.isDouble && x >= this.guiLeft+14 && y >= this.guiTop+6 && x <= this.guiLeft+29 && y <= this.guiTop+88) || (!this.isDouble && x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88)){
this.drawHoveringText(Collections.singletonList(text), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileGrinder.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileGrinder);
}
@Override
@@ -64,16 +64,16 @@ public class GuiGrinder extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(this.isDouble ? resLocDouble : resLoc);
+ this.mc.getTextureManager().bindTexture(this.isDouble ? RES_LOC_DOUBLE : RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileGrinder.storage.getEnergyStored() > 0){
int i = this.tileGrinder.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+(isDouble ? 14 : 43), this.guiTop+89-i, 176, (isDouble ? 44 : 23), 16, i);
+ this.drawTexturedModalRect(this.guiLeft+(this.isDouble ? 14 : 43), this.guiTop+89-i, 176, (this.isDouble ? 44 : 23), 16, i);
}
if(this.tileGrinder.firstCrushTime > 0){
int i = this.tileGrinder.getFirstTimeToScale(23);
- this.drawTexturedModalRect(this.guiLeft+(isDouble ? 51 : 80), this.guiTop+40, 176, 0, 24, i);
+ this.drawTexturedModalRect(this.guiLeft+(this.isDouble ? 51 : 80), this.guiTop+40, 176, 0, 24, i);
}
if(this.isDouble){
if(this.tileGrinder.secondCrushTime > 0){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java
index ba72bc1ff..7e6dcd7b1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java
@@ -1,19 +1,18 @@
/*
- * This file ("GuiInputter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiInputter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiButton;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiNumber;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@@ -25,8 +24,9 @@ import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -40,28 +40,28 @@ import java.util.List;
public class GuiInputter extends GuiContainer{
public static final int OFFSET_ADVANCED = 12+36;
- public static final String[] sideString = new String[]{
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.disabled"),
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.up"),
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.down"),
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.north"),
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.east"),
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.south"),
- StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.west")};
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter");
- private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced");
- public TileEntityInputter tileInputter;
- private int x;
- private int y;
- private int z;
- private World world;
+ public static final String[] SIDES = new String[]{
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.disabled"),
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.up"),
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.down"),
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.north"),
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.east"),
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.south"),
+ StringUtil.localize("info."+ModUtil.MOD_ID+".gui.west")};
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiInputter");
+ private static final ResourceLocation RES_LOC_ADVANCED = AssetUtil.getGuiLocation("guiInputterAdvanced");
+ public final TileEntityInputter tileInputter;
+ private final int x;
+ private final int y;
+ private final int z;
+ private final World world;
+ private final boolean isAdvanced;
private SmallerButton whitelistPut;
private SmallerButton whitelistPull;
private GuiTextField fieldPutStart;
private GuiTextField fieldPutEnd;
private GuiTextField fieldPullStart;
private GuiTextField fieldPullEnd;
- private boolean isAdvanced;
public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){
super(new ContainerInputter(inventory, tile, isAdvanced));
@@ -71,52 +71,50 @@ public class GuiInputter extends GuiContainer{
this.z = z;
this.world = world;
this.xSize = 176;
- this.ySize = 93+86+(isAdvanced ? OFFSET_ADVANCED : 0);
+ this.ySize = 97+86+(isAdvanced ? OFFSET_ADVANCED : 0);
this.isAdvanced = isAdvanced;
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
- this.fieldPullStart = new GuiTextField(3000, this.fontRendererObj, guiLeft+13, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8);
- this.fieldPullStart.setMaxStringLength(4);
+ this.fieldPullStart = new GuiTextField(3000, this.fontRendererObj, this.guiLeft+6, this.guiTop+80+(this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8);
+ this.fieldPullStart.setMaxStringLength(5);
this.fieldPullStart.setEnableBackgroundDrawing(false);
- this.fieldPullEnd = new GuiTextField(3001, this.fontRendererObj, guiLeft+50, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8);
- this.fieldPullEnd.setMaxStringLength(4);
+ this.fieldPullEnd = new GuiTextField(3001, this.fontRendererObj, this.guiLeft+50, this.guiTop+80+(this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8);
+ this.fieldPullEnd.setMaxStringLength(5);
this.fieldPullEnd.setEnableBackgroundDrawing(false);
- this.fieldPutStart = new GuiTextField(3002, this.fontRendererObj, guiLeft+98, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8);
- this.fieldPutStart.setMaxStringLength(4);
+ this.fieldPutStart = new GuiTextField(3002, this.fontRendererObj, this.guiLeft+91, this.guiTop+80+(this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8);
+ this.fieldPutStart.setMaxStringLength(5);
this.fieldPutStart.setEnableBackgroundDrawing(false);
- this.fieldPutEnd = new GuiTextField(3004, this.fontRendererObj, guiLeft+135, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0), 27, 8);
- this.fieldPutEnd.setMaxStringLength(4);
+ this.fieldPutEnd = new GuiTextField(3004, this.fontRendererObj, this.guiLeft+135, this.guiTop+80+(this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8);
+ this.fieldPutEnd.setMaxStringLength(5);
this.fieldPutEnd.setEnableBackgroundDrawing(false);
- SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft+155, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), ">");
- SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft+90, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), "<");
+ SmallerButton buttonSidePutP = new SmallerButton(0, this.guiLeft+155, this.guiTop+43+(this.isAdvanced ? OFFSET_ADVANCED : 0), ">");
+ SmallerButton buttonSidePutM = new SmallerButton(1, this.guiLeft+90, this.guiTop+43+(this.isAdvanced ? OFFSET_ADVANCED : 0), "<");
- SmallerButton buttonSidePullP = new SmallerButton(2, guiLeft+70, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), ">");
- SmallerButton buttonSidePullM = new SmallerButton(3, guiLeft+5, guiTop+43+(isAdvanced ? OFFSET_ADVANCED : 0), "<");
+ SmallerButton buttonSidePullP = new SmallerButton(2, this.guiLeft+70, this.guiTop+43+(this.isAdvanced ? OFFSET_ADVANCED : 0), ">");
+ SmallerButton buttonSidePullM = new SmallerButton(3, this.guiLeft+5, this.guiTop+43+(this.isAdvanced ? OFFSET_ADVANCED : 0), "<");
- whitelistPull = new SmallerButton(TileEntityInputter.WHITELIST_PULL_BUTTON_ID, guiLeft+3, guiTop+16, "");
- whitelistPut = new SmallerButton(TileEntityInputter.WHITELIST_PUT_BUTTON_ID, guiLeft+157, guiTop+16, "");
+ this.whitelistPull = new SmallerButton(TileEntityInputter.WHITELIST_PULL_BUTTON_ID, this.guiLeft+3, this.guiTop+16, "");
+ this.whitelistPut = new SmallerButton(TileEntityInputter.WHITELIST_PUT_BUTTON_ID, this.guiLeft+157, this.guiTop+16, "");
this.buttonList.add(buttonSidePutP);
this.buttonList.add(buttonSidePullP);
this.buttonList.add(buttonSidePutM);
this.buttonList.add(buttonSidePullM);
if(this.isAdvanced){
- this.buttonList.add(whitelistPut);
- this.buttonList.add(whitelistPull);
+ this.buttonList.add(this.whitelistPut);
+ this.buttonList.add(this.whitelistPull);
}
- this.buttonList.add(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, guiLeft+84, guiTop+80+(isAdvanced ? OFFSET_ADVANCED : 0)));
+ this.buttonList.add(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, this.guiLeft+84, this.guiTop+91+(this.isAdvanced ? OFFSET_ADVANCED : 0)));
}
@Override
- @SuppressWarnings("unchecked")
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
@@ -124,18 +122,18 @@ public class GuiInputter extends GuiContainer{
this.whitelistPut.displayString = this.tileInputter.isPutWhitelist ? "O" : "X";
if(this.isAdvanced){
- List infoList = this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.whitelistInfo"), 200);
- String text1 = this.tileInputter.isPullWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
- if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){
+ List infoList = this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.whitelistInfo"), 200);
+ String text1 = this.tileInputter.isPullWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist");
+ if(x >= this.guiLeft+3 && y >= this.guiTop+16 && x <= this.guiLeft+18 && y <= this.guiTop+31){
ArrayList list = new ArrayList();
- list.add(EnumChatFormatting.BOLD+text1);
+ list.add(TextFormatting.BOLD+text1);
list.addAll(infoList);
this.drawHoveringText(list, x, y);
}
- String text2 = this.tileInputter.isPutWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
- if(x >= guiLeft+157 && y >= guiTop+16 && x <= guiLeft+172 && y <= guiTop+31){
+ String text2 = this.tileInputter.isPutWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist");
+ if(x >= this.guiLeft+157 && y >= this.guiTop+16 && x <= this.guiLeft+172 && y <= this.guiTop+31){
ArrayList list = new ArrayList();
- list.add(EnumChatFormatting.BOLD+text2);
+ list.add(TextFormatting.BOLD+text2);
list.addAll(infoList);
this.drawHoveringText(list, x, y);
}
@@ -143,23 +141,23 @@ public class GuiInputter extends GuiContainer{
int newTopOffset = this.guiTop+(this.isAdvanced ? OFFSET_ADVANCED : 0);
//Info Mode on!
- if(x >= guiLeft+11 && y >= newTopOffset+65 && x <= guiLeft+11+31 && y <= newTopOffset+65+12){
- this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.1").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull")), 200), x, y);
+ if(x >= this.guiLeft+4 && y >= newTopOffset+65 && x <= this.guiLeft+4+38 && y <= newTopOffset+65+12){
+ this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.info.1").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID+".gui.pull")), 200), x, y);
}
- if(x >= guiLeft+96 && y >= newTopOffset+65 && x <= guiLeft+96+31 && y <= newTopOffset+65+12){
- this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.1").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put")), 200), x, y);
+ if(x >= this.guiLeft+89 && y >= newTopOffset+65 && x <= this.guiLeft+89+38 && y <= newTopOffset+65+12){
+ this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.info.1").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID+".gui.put")), 200), x, y);
}
- if(x >= guiLeft+48 && y >= newTopOffset+65 && x <= guiLeft+48+31 && y <= newTopOffset+65+12){
- this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.2").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull")), 200), x, y);
+ if(x >= this.guiLeft+48 && y >= newTopOffset+65 && x <= this.guiLeft+48+38 && y <= newTopOffset+65+12){
+ this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.info.2").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID+".gui.pull")), 200), x, y);
}
- if(x >= guiLeft+133 && y >= newTopOffset+65 && x <= guiLeft+133+31 && y <= newTopOffset+65+12){
- this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".inputter.info.2").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put")), 200), x, y);
+ if(x >= this.guiLeft+133 && y >= newTopOffset+65 && x <= this.guiLeft+133+38 && y <= newTopOffset+65+12){
+ this.drawHoveringText(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.info.2").replace("
", StringUtil.localize("info."+ModUtil.MOD_ID+".gui.put")), 200), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileInputter.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileInputter);
}
@Override
@@ -167,21 +165,21 @@ public class GuiInputter extends GuiContainer{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
- this.drawTexturedModalRect(this.guiLeft, this.guiTop+93+(isAdvanced ? OFFSET_ADVANCED : 0), 0, 0, 176, 86);
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop+97+(this.isAdvanced ? OFFSET_ADVANCED : 0), 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(this.isAdvanced ? resLocAdvanced : resLoc);
- this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93+(isAdvanced ? OFFSET_ADVANCED : 0));
+ this.mc.getTextureManager().bindTexture(this.isAdvanced ? RES_LOC_ADVANCED : RES_LOC);
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 97+(this.isAdvanced ? OFFSET_ADVANCED : 0));
- this.fontRendererObj.drawString(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.pull"), guiLeft+22+3, guiTop+32+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
- this.fontRendererObj.drawString(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.put"), guiLeft+107+3, guiTop+32+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ this.fontRendererObj.drawString("INBOUND", this.guiLeft+23+3, this.guiTop+32+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ this.fontRendererObj.drawString("OUTBOUND", this.guiLeft+104+3, this.guiTop+32+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
- this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft+24+1, guiTop+45+3+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
- this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft+109+1, guiTop+45+3+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ this.fontRendererObj.drawString(SIDES[this.tileInputter.sideToPull+1], this.guiLeft+24+1, this.guiTop+45+3+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ this.fontRendererObj.drawString(SIDES[this.tileInputter.sideToPut+1], this.guiLeft+109+1, this.guiTop+45+3+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
- this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPutStart), guiLeft+99, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
- this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPutEnd), guiLeft+136, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
- this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPullStart), guiLeft+14, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
- this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPullEnd), guiLeft+51, guiTop+67+(isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
+ this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPutStart), this.guiLeft+92, this.guiTop+67+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
+ this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPutEnd), this.guiLeft+136, this.guiTop+67+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
+ this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPullStart), this.guiLeft+7, this.guiTop+67+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
+ this.fontRendererObj.drawString(Integer.toString(this.tileInputter.slotToPullEnd), this.guiLeft+51, this.guiTop+67+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE);
this.fieldPutStart.drawTextBox();
this.fieldPutEnd.drawTextBox();
@@ -238,13 +236,21 @@ public class GuiInputter extends GuiContainer{
public void setVariable(GuiTextField field, int sendInt){
if(!field.getText().isEmpty()){
- this.sendPacket(parse(field.getText()), sendInt);
+ this.sendPacket(this.parse(field.getText()), sendInt);
field.setText("");
}
}
private void sendPacket(int text, int textID){
- PacketHandler.theNetwork.sendToServer(new PacketGuiNumber(x, y, z, world, text, textID, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.x);
+ compound.setInteger("Y", this.y);
+ compound.setInteger("Z", this.z);
+ compound.setInteger("WorldID", this.world.provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("NumberID", textID);
+ compound.setInteger("Number", text);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_NUMBER_TO_TILE_HANDLER));
}
private int parse(String theInt){
@@ -265,10 +271,18 @@ public class GuiInputter extends GuiContainer{
this.setVariable(this.fieldPullEnd, 3);
}
else{
- PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.x);
+ compound.setInteger("Y", this.y);
+ compound.setInteger("Z", this.z);
+ compound.setInteger("WorldID", this.world.provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
}
}
+ @SideOnly(Side.CLIENT)
public static class SmallerButton extends GuiButton{
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter");
@@ -280,7 +294,7 @@ public class GuiInputter extends GuiContainer{
@Override
public void drawButton(Minecraft mc, int x, int y){
if(this.visible){
- mc.getTextureManager().bindTexture(resLoc);
+ mc.getTextureManager().bindTexture(this.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
int k = this.getHoverState(this.hovered);
@@ -291,8 +305,8 @@ public class GuiInputter extends GuiContainer{
this.mouseDragged(mc, x, y);
int color = 14737632;
- if(packedFGColour != 0){
- color = packedFGColour;
+ if(this.packedFGColour != 0){
+ color = this.packedFGColour;
}
else if(!this.enabled){
color = 10526880;
@@ -306,6 +320,7 @@ public class GuiInputter extends GuiContainer{
}
}
+ @SideOnly(Side.CLIENT)
public static class TinyButton extends GuiButton{
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter");
@@ -317,7 +332,7 @@ public class GuiInputter extends GuiContainer{
@Override
public void drawButton(Minecraft mc, int x, int y){
if(this.visible){
- mc.getTextureManager().bindTexture(resLoc);
+ mc.getTextureManager().bindTexture(this.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
int k = this.getHoverState(this.hovered);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java
new file mode 100644
index 000000000..52d43326c
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java
@@ -0,0 +1,130 @@
+/*
+ * This file ("GuiLaserRelayItemWhitelist.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.inventory.gui;
+
+import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
+import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
+import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
+import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SideOnly(Side.CLIENT)
+public class GuiLaserRelayItemWhitelist extends GuiContainer{
+
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiLaserRelayItemWhitelist");
+ private final TileEntityLaserRelayItemWhitelist tile;
+
+ private SmallerButton whitelistLeft;
+ private SmallerButton whitelistRight;
+
+ public GuiLaserRelayItemWhitelist(InventoryPlayer inventory, TileEntityBase tile){
+ super(new ContainerLaserRelayItemWhitelist(inventory, tile));
+ this.tile = (TileEntityLaserRelayItemWhitelist)tile;
+ this.xSize = 176;
+ this.ySize = 93+86;
+ }
+
+ @Override
+ public void initGui(){
+ super.initGui();
+
+ this.whitelistLeft = new SmallerButton(0, this.guiLeft+3, this.guiTop+16, "");
+ this.whitelistRight = new SmallerButton(1, this.guiLeft+157, this.guiTop+16, "");
+ SmallerButton smartWhitelistLeft = new SmallerButton(2, this.guiLeft+3, this.guiTop+34, "S");
+ SmallerButton smartWhitelistRight = new SmallerButton(3, this.guiLeft+157, this.guiTop+34, "S");
+
+ this.buttonList.add(this.whitelistLeft);
+ this.buttonList.add(this.whitelistRight);
+ this.buttonList.add(smartWhitelistLeft);
+ this.buttonList.add(smartWhitelistRight);
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button){
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.tile.getPos().getX());
+ compound.setInteger("Y", this.tile.getPos().getY());
+ compound.setInteger("Z", this.tile.getPos().getZ());
+ compound.setInteger("WorldID", this.tile.getWorld().provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
+ }
+
+ @Override
+ public void drawScreen(int x, int y, float f){
+ super.drawScreen(x, y, f);
+
+ this.whitelistLeft.displayString = this.tile.isLeftWhitelist ? "O" : "X";
+ this.whitelistRight.displayString = this.tile.isRightWhitelist ? "O" : "X";
+
+ List infoList = this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.whitelistInfo"), 200);
+ String text1 = this.tile.isLeftWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist");
+ if(x >= this.guiLeft+3 && y >= this.guiTop+16 && x <= this.guiLeft+18 && y <= this.guiTop+31){
+ ArrayList list = new ArrayList();
+ list.add(TextFormatting.BOLD+text1);
+ list.addAll(infoList);
+ this.drawHoveringText(list, x, y);
+ }
+ String text2 = this.tile.isRightWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist");
+ if(x >= this.guiLeft+157 && y >= this.guiTop+16 && x <= this.guiLeft+172 && y <= this.guiTop+31){
+ ArrayList list = new ArrayList();
+ list.add(TextFormatting.BOLD+text2);
+ list.addAll(infoList);
+ this.drawHoveringText(list, x, y);
+ }
+ if(((x >= this.guiLeft+3 && x <= this.guiLeft+3+15) || (x >= this.guiLeft+157 && x <= this.guiLeft+157+15)) && y <= this.guiTop+34+15 && y >= this.guiTop+34){
+ List list = new ArrayList();
+ list.add(TextFormatting.BOLD+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.smart"));
+ list.addAll(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.smartInfo"), 200));
+ this.drawHoveringText(list, x, y);
+ }
+ }
+
+ @Override
+ public void drawGuiContainerForegroundLayer(int x, int y){
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tile);
+
+ String s1 = "INBOUND";
+ String s2 = "OUTBOUND";
+ this.fontRendererObj.drawString(s1, 46-this.fontRendererObj.getStringWidth(s1)/2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ this.fontRendererObj.drawString(s2, 131-this.fontRendererObj.getStringWidth(s2)/2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ }
+
+ @Override
+ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+
+ this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
+
+ this.mc.getTextureManager().bindTexture(RES_LOC);
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java
index f3ab98257..026bc51a6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java
@@ -1,18 +1,18 @@
/*
- * This file ("GuiMiner.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiMiner.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiButton;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@@ -22,6 +22,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -29,8 +30,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiMiner extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
- private TileEntityMiner miner;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiBreaker");
+ private final TileEntityMiner miner;
public GuiMiner(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerMiner(inventory, tile));
@@ -39,26 +40,20 @@ public class GuiMiner extends GuiContainer{
this.ySize = 93+86;
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
- GuiButton buttonMode = new GuiButton(0, guiLeft+xSize/2-51, guiTop+75, 50, 20, "Mode");
+ GuiButton buttonMode = new GuiButton(0, this.guiLeft+this.xSize/2-51, this.guiTop+75, 50, 20, "Mode");
this.buttonList.add(buttonMode);
- GuiButton buttonReset = new GuiButton(1, guiLeft+xSize/2+1, guiTop+75, 50, 20, "Reset");
+ GuiButton buttonReset = new GuiButton(1, this.guiLeft+this.xSize/2+1, this.guiTop+75, 50, 20, "Reset");
this.buttonList.add(buttonReset);
}
- @Override
- public void drawScreen(int x, int y, float f){
- super.drawScreen(x, y, f);
- }
-
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.miner.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.miner);
}
@Override
@@ -68,15 +63,22 @@ public class GuiMiner extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
String mining = this.miner.onlyMineOres ? "Only Mining Ores" : "Mining Everything";
- this.fontRendererObj.drawString(mining, this.guiLeft+this.xSize/2-fontRendererObj.getStringWidth(mining)/2, guiTop+8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
+ this.fontRendererObj.drawString(mining, this.guiLeft+this.xSize/2-this.fontRendererObj.getStringWidth(mining)/2, this.guiTop+8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
}
@Override
public void actionPerformed(GuiButton button){
- PacketHandler.theNetwork.sendToServer(new PacketGuiButton(miner.getPos().getX(), miner.getPos().getY(), miner.getPos().getZ(), miner.getWorld(), button.id, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.miner.getPos().getX());
+ compound.setInteger("Y", this.miner.getPos().getY());
+ compound.setInteger("Z", this.miner.getPos().getZ());
+ compound.setInteger("WorldID", this.miner.getWorld().provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java
index 93dee8c80..0a6cf6942 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiOilGenerator.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiOilGenerator.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -27,8 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiOilGenerator extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOilGenerator");
- private TileEntityOilGenerator generator;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiOilGenerator");
+ private final TileEntityOilGenerator generator;
public GuiOilGenerator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerOilGenerator(inventory, tile));
@@ -41,18 +41,18 @@ public class GuiOilGenerator extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.generator.storage.getEnergyStored()+"/"+this.generator.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
+ if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
String text2 = StringUtil.getFluidInfo(this.generator.tank);
- if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){
+ if(x >= this.guiLeft+117 && y >= this.guiTop+6 && x <= this.guiLeft+132 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.generator);
}
@Override
@@ -62,22 +62,22 @@ public class GuiOilGenerator extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.generator.storage.getEnergyStored() > 0){
int i = this.generator.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
}
if(this.generator.tank.getFluidAmount() > 0){
int i = this.generator.getTankScaled(83);
- drawTexturedModalRect(this.guiLeft+117, this.guiTop+89-i, 192, 0, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+117, this.guiTop+89-i, 192, 0, 16, i);
}
if(this.generator.currentBurnTime > 0){
int i = this.generator.getBurningScaled(13);
- this.drawTexturedModalRect(guiLeft+72, guiTop+44+12-i, 176, 96-i, 14, i);
+ this.drawTexturedModalRect(this.guiLeft+72, this.guiTop+44+12-i, 176, 96-i, 14, i);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java
index 58b2a48ef..95016976e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiPhantomPlacer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiPhantomPlacer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -24,8 +24,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiPhantomPlacer extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
- private TileEntityPhantomPlacer placer;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiBreaker");
+ private final TileEntityPhantomPlacer placer;
public GuiPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerPhantomPlacer(inventory, tile));
@@ -34,14 +34,9 @@ public class GuiPhantomPlacer extends GuiContainer{
this.ySize = 93+86;
}
- @Override
- public void drawScreen(int x, int y, float f){
- super.drawScreen(x, y, f);
- }
-
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.placer.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.placer);
}
@Override
@@ -51,7 +46,7 @@ public class GuiPhantomPlacer extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java
index feb847d8a..25ab78282 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java
@@ -1,18 +1,18 @@
/*
- * This file ("GuiRangedCollector.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiRangedCollector.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiButton;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@@ -23,6 +23,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -33,16 +34,14 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiRangedCollector extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiRangedCollector");
- private TileEntityRangedCollector collector;
-
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiRangedCollector");
+ private final TileEntityRangedCollector collector;
+ private final int x;
+ private final int y;
+ private final int z;
+ private final World world;
private GuiInputter.SmallerButton whitelistButton;
- private int x;
- private int y;
- private int z;
- private World world;
-
public GuiRangedCollector(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerRangedCollector(inventory, tile));
this.collector = (TileEntityRangedCollector)tile;
@@ -54,31 +53,29 @@ public class GuiRangedCollector extends GuiContainer{
this.world = world;
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
- this.whitelistButton = new GuiInputter.SmallerButton(0, guiLeft+3, guiTop+16, "");
+ this.whitelistButton = new GuiInputter.SmallerButton(0, this.guiLeft+3, this.guiTop+16, "");
this.buttonList.add(this.whitelistButton);
}
@Override
- @SuppressWarnings("unchecked")
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
this.whitelistButton.displayString = this.collector.isWhitelist ? "O" : "X";
- String text1 = this.collector.isWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
- if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){
+ String text1 = this.collector.isWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist");
+ if(x >= this.guiLeft+3 && y >= this.guiTop+16 && x <= this.guiLeft+18 && y <= this.guiTop+31){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.collector.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.collector);
}
@Override
@@ -88,12 +85,19 @@ public class GuiRangedCollector extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+86, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 86);
}
@Override
public void actionPerformed(GuiButton button){
- PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.x);
+ compound.setInteger("Y", this.y);
+ compound.setInteger("Z", this.z);
+ compound.setInteger("WorldID", this.world.provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java
index 6af9383b3..530df742b 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java
@@ -1,11 +1,11 @@
/*
- * This file ("GuiRepairer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiRepairer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
@@ -26,8 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiRepairer extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiRepairer");
- private TileEntityItemRepairer tileRepairer;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiRepairer");
+ private final TileEntityItemRepairer tileRepairer;
public GuiRepairer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerRepairer(inventory, tile));
@@ -40,14 +40,14 @@ public class GuiRepairer extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text = this.tileRepairer.storage.getEnergyStored()+"/"+this.tileRepairer.storage.getMaxEnergyStored()+" RF";
- if(x >= guiLeft+28 && y >= guiTop+6 && x <= guiLeft+43 && y <= guiTop+88){
+ if(x >= this.guiLeft+28 && y >= this.guiTop+6 && x <= this.guiLeft+43 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text), x, y);
}
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileRepairer.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileRepairer);
}
@Override
@@ -57,12 +57,12 @@ public class GuiRepairer extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileRepairer.storage.getEnergyStored() > 0){
int i = this.tileRepairer.getEnergyScaled(83);
- drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
+ this.drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
}
if(TileEntityItemRepairer.canBeRepaired(this.tileRepairer.slots[TileEntityItemRepairer.SLOT_INPUT])){
int i = this.tileRepairer.getItemDamageToScale(22);
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java
index 3ec364c7b..5238f6ea4 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java
@@ -1,18 +1,18 @@
/*
- * This file ("GuiSmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerSmileyCloud;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiString;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@@ -22,8 +22,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -34,17 +35,15 @@ import java.io.IOException;
@SideOnly(Side.CLIENT)
public class GuiSmileyCloud extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiSmileyCloud");
-
- private int x;
- private int y;
- private int z;
- private World world;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiSmileyCloud");
+ private final int x;
+ private final int y;
+ private final int z;
+ private final World world;
+ private final TileEntitySmileyCloud cloud;
private GuiTextField nameField;
- private TileEntitySmileyCloud cloud;
-
public GuiSmileyCloud(TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerSmileyCloud());
this.cloud = (TileEntitySmileyCloud)tile;
@@ -56,35 +55,28 @@ public class GuiSmileyCloud extends GuiContainer{
this.ySize = 20;
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
- this.nameField = new GuiTextField(4000, this.fontRendererObj, guiLeft+5, guiTop+6, 114, 8);
+ this.nameField = new GuiTextField(4000, this.fontRendererObj, this.guiLeft+5, this.guiTop+6, 114, 8);
this.nameField.setMaxStringLength(20);
this.nameField.setEnableBackgroundDrawing(false);
this.nameField.setFocused(true);
}
- @Override
- @SuppressWarnings("unchecked")
- public void drawScreen(int x, int y, float f){
- super.drawScreen(x, y, f);
- }
-
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- String name = cloud.name == null || cloud.name.isEmpty() ? "" : EnumChatFormatting.GOLD+cloud.name+EnumChatFormatting.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.the")+" ";
- String localizedName = name+StringUtil.localize("container."+ModUtil.MOD_ID_LOWER+".cloud.name");
- this.fontRendererObj.drawString(localizedName, xSize/2-this.fontRendererObj.getStringWidth(localizedName)/2, -10, StringUtil.DECIMAL_COLOR_WHITE);
+ String name = this.cloud.name == null || this.cloud.name.isEmpty() ? "" : TextFormatting.GOLD+this.cloud.name+TextFormatting.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.the")+" ";
+ String localizedName = name+StringUtil.localize("container."+ModUtil.MOD_ID+".cloud.name");
+ this.fontRendererObj.drawString(localizedName, this.xSize/2-this.fontRendererObj.getStringWidth(localizedName)/2, -10, StringUtil.DECIMAL_COLOR_WHITE);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
this.nameField.drawTextBox();
@@ -123,6 +115,14 @@ public class GuiSmileyCloud extends GuiContainer{
}
private void sendPacket(String text, int textID){
- PacketHandler.theNetwork.sendToServer(new PacketGuiString(x, y, z, world, text, textID, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.x);
+ compound.setInteger("Y", this.y);
+ compound.setInteger("Z", this.z);
+ compound.setInteger("WorldID", this.world.provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("TextID", textID);
+ compound.setString("Text", text);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java
index ef38f3511..089ffc6f1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java
@@ -1,18 +1,18 @@
/*
- * This file ("GuiXPSolidifier.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("GuiXPSolidifier.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
+import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
-import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiButton;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@@ -22,6 +22,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -30,12 +31,12 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiXPSolidifier extends GuiContainer{
- private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiXPSolidifier");
- private TileEntityXPSolidifier solidifier;
- private int x;
- private int y;
- private int z;
- private World world;
+ private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiXPSolidifier");
+ private final TileEntityXPSolidifier solidifier;
+ private final int x;
+ private final int y;
+ private final int z;
+ private final World world;
public GuiXPSolidifier(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerXPSolidifier(inventory, tile));
@@ -48,20 +49,19 @@ public class GuiXPSolidifier extends GuiContainer{
this.world = world;
}
- @SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
- GuiButton buttonOne = new GuiInputter.SmallerButton(0, guiLeft+62, guiTop+44, "1");
- GuiButton buttonFive = new GuiInputter.SmallerButton(1, guiLeft+80, guiTop+44, "5");
- GuiButton buttonTen = new GuiInputter.SmallerButton(2, guiLeft+99, guiTop+44, "10");
- GuiButton buttonTwenty = new GuiInputter.SmallerButton(3, guiLeft+62, guiTop+61, "20");
- GuiButton buttonThirty = new GuiInputter.SmallerButton(4, guiLeft+80, guiTop+61, "30");
- GuiButton buttonForty = new GuiInputter.SmallerButton(5, guiLeft+99, guiTop+61, "40");
- GuiButton buttonFifty = new GuiInputter.SmallerButton(6, guiLeft+62, guiTop+78, "50");
- GuiButton buttonSixtyFour = new GuiInputter.SmallerButton(7, guiLeft+80, guiTop+78, "64");
- GuiButton buttonAll = new GuiInputter.SmallerButton(8, guiLeft+99, guiTop+78, "All");
+ GuiButton buttonOne = new GuiInputter.SmallerButton(0, this.guiLeft+62, this.guiTop+44, "1");
+ GuiButton buttonFive = new GuiInputter.SmallerButton(1, this.guiLeft+80, this.guiTop+44, "5");
+ GuiButton buttonTen = new GuiInputter.SmallerButton(2, this.guiLeft+99, this.guiTop+44, "10");
+ GuiButton buttonTwenty = new GuiInputter.SmallerButton(3, this.guiLeft+62, this.guiTop+61, "20");
+ GuiButton buttonThirty = new GuiInputter.SmallerButton(4, this.guiLeft+80, this.guiTop+61, "30");
+ GuiButton buttonForty = new GuiInputter.SmallerButton(5, this.guiLeft+99, this.guiTop+61, "40");
+ GuiButton buttonFifty = new GuiInputter.SmallerButton(6, this.guiLeft+62, this.guiTop+78, "50");
+ GuiButton buttonSixtyFour = new GuiInputter.SmallerButton(7, this.guiLeft+80, this.guiTop+78, "64");
+ GuiButton buttonAll = new GuiInputter.SmallerButton(8, this.guiLeft+99, this.guiTop+78, "All");
this.buttonList.add(buttonOne);
this.buttonList.add(buttonFive);
@@ -74,14 +74,9 @@ public class GuiXPSolidifier extends GuiContainer{
this.buttonList.add(buttonAll);
}
- @Override
- public void drawScreen(int x, int y, float f){
- super.drawScreen(x, y, f);
- }
-
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
- AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.solidifier.getName());
+ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.solidifier);
}
@Override
@@ -91,15 +86,23 @@ public class GuiXPSolidifier extends GuiContainer{
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
- this.mc.getTextureManager().bindTexture(resLoc);
+ this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
- this.drawCenteredString(this.fontRendererObj, Integer.toString(this.solidifier.amount), guiLeft+88, guiTop+30, StringUtil.DECIMAL_COLOR_WHITE);
+ this.drawCenteredString(this.fontRendererObj, Integer.toString(this.solidifier.amount), this.guiLeft+88, this.guiTop+30, StringUtil.DECIMAL_COLOR_WHITE);
}
@Override
public void actionPerformed(GuiButton button){
- PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
+ NBTTagCompound compound = new NBTTagCompound();
+ compound.setInteger("X", this.x);
+ compound.setInteger("Y", this.y);
+ compound.setInteger("Z", this.z);
+ compound.setInteger("WorldID", this.world.provider.getDimension());
+ compound.setInteger("PlayerID", Minecraft.getMinecraft().thePlayer.getEntityId());
+ compound.setInteger("ButtonID", button.id);
+ PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));
+
this.solidifier.onButtonPressed(button.id, Minecraft.getMinecraft().thePlayer);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java
index 77042179f..d79532795 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java
@@ -1,11 +1,11 @@
/*
- * This file ("SlotFilter.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("SlotFilter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.slot;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java
index 91e13df92..d4e95e199 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java
@@ -1,11 +1,11 @@
/*
- * This file ("SlotImmovable.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("SlotImmovable.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.slot;
@@ -31,6 +31,7 @@ public class SlotImmovable extends Slot{
}
+
@Override
public ItemStack decrStackSize(int i){
return null;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java
index 98b004186..1cd4ed9ca 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java
@@ -1,11 +1,11 @@
/*
- * This file ("SlotOutput.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("SlotOutput.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.inventory.slot;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitForeignPaxels.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitForeignPaxels.java
index 281ca1ec4..6bb6368b2 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitForeignPaxels.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitForeignPaxels.java
@@ -1,11 +1,11 @@
/*
- * This file ("InitForeignPaxels.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitForeignPaxels.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -14,10 +14,9 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.ToolCrafting;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
-import de.ellpeck.actuallyadditions.mod.items.base.ItemAllToolAA;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.Util;
+import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemTool;
@@ -25,12 +24,14 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapelessOreRecipe;
-public class InitForeignPaxels{
+public final class InitForeignPaxels{
public static final int[] MT_COLORS = new int[]{4166, 2248890, 8882649, 12410135, 11451392, 3684412};
public static final String[] MT_NAMES = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"};
public static final int[] TF_COLORS = new int[]{13332762, 5407943, 5407895, 5394789, 12960613, 12960653, 12410135, 2999795, 10143162};
public static final int[] SO_COLORS = new int[]{9409450, 2040021, 5714944, 526344, 545032};
+ public static final Item[] TF_PAXELS = new Item[9];
+ public static final Item[] SO_PAXELS = new Item[5];
//MekanismTools
private static final String MEKANISM_TOOLS = "MekanismTools";
private static final String[] MT_REPAIR_NAMES = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"};
@@ -41,9 +42,7 @@ public class InitForeignPaxels{
private static final String SIMPLE_ORES = "simpleores";
private static final String[] SO_NAMES = new String[]{"tin", "mythril", "copper", "onyx", "adamantium"};
private static final String[] SO_REPAIR_NAMES = new String[]{"ingotTin", "ingotMythril", "ingotCopper", "gemOnyx", "ingotAdamantium"};
- public static Item[] tfPaxels = new Item[9];
- public static Item[] soPaxels = new Item[5];
- private static Item[] mtPaxels = new Item[6];
+ private static final Item[] MT_PAXELS = new Item[6];
public static void init(){
//SimpleOres
@@ -51,7 +50,7 @@ public class InitForeignPaxels{
if(Loader.isModLoaded(SIMPLE_ORES)){
ModUtil.LOGGER.info("Initializing "+SIMPLE_ORES+" AIOTs...");
- for(int i = 0; i < soPaxels.length; i++){
+ for(int i = 0; i < SO_PAXELS.length; i++){
Item axe = ItemUtil.getItemFromName(SIMPLE_ORES+":"+SO_NAMES[i]+"_axe");
Item pickaxe = ItemUtil.getItemFromName(SIMPLE_ORES+":"+SO_NAMES[i]+"_pickaxe");
Item hoe = ItemUtil.getItemFromName(SIMPLE_ORES+":"+SO_NAMES[i]+"_hoe");
@@ -60,11 +59,11 @@ public class InitForeignPaxels{
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
Item.ToolMaterial material = ((ItemTool)axe).getToolMaterial();
- soPaxels[i] = new ItemAllToolAA(material, SO_REPAIR_NAMES[i], "paxelSO"+SO_NAMES[i], EnumRarity.RARE, SO_COLORS[i]);
+ SO_PAXELS[i] = new ItemAllToolAA(material, SO_REPAIR_NAMES[i], "paxelSO"+SO_NAMES[i], EnumRarity.RARE, SO_COLORS[i]);
if(ConfigCrafting.PAXELS.isEnabled()){
- GameRegistry.addRecipe(new ShapelessOreRecipe(soPaxels[i], axe, pickaxe, hoe, sword, shovel));
- ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ GameRegistry.addRecipe(new ShapelessOreRecipe(SO_PAXELS[i], axe, pickaxe, hoe, sword, shovel));
+ ToolCrafting.RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
}
}
}
@@ -79,7 +78,7 @@ public class InitForeignPaxels{
if(Loader.isModLoaded(MEKANISM_TOOLS)){
ModUtil.LOGGER.info("Initializing "+MEKANISM_TOOLS+" AIOTs...");
- for(int i = 0; i < mtPaxels.length; i++){
+ for(int i = 0; i < MT_PAXELS.length; i++){
Item axe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Axe");
Item pickaxe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Pickaxe");
Item hoe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Hoe");
@@ -88,11 +87,11 @@ public class InitForeignPaxels{
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
Item.ToolMaterial material = ((ItemTool)axe).getToolMaterial();
- mtPaxels[i] = new ItemAllToolAA(material, MT_REPAIR_NAMES[i], "paxelMT"+MT_NAMES[i], EnumRarity.RARE, MT_COLORS[i]);
+ MT_PAXELS[i] = new ItemAllToolAA(material, MT_REPAIR_NAMES[i], "paxelMT"+MT_NAMES[i], EnumRarity.RARE, MT_COLORS[i]);
if(ConfigCrafting.PAXELS.isEnabled()){
- GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel));
- ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ GameRegistry.addRecipe(new ShapelessOreRecipe(MT_PAXELS[i], axe, pickaxe, hoe, sword, shovel));
+ ToolCrafting.RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
}
}
}
@@ -107,7 +106,7 @@ public class InitForeignPaxels{
if(Loader.isModLoaded(THERMAL_FOUNDATION)){
ModUtil.LOGGER.info("Initializing "+THERMAL_FOUNDATION+" AIOTs...");
- for(int i = 0; i < tfPaxels.length; i++){
+ for(int i = 0; i < TF_PAXELS.length; i++){
Item axe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.axe"+TF_NAMES[i]);
Item pickaxe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.pickaxe"+TF_NAMES[i]);
Item hoe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.hoe"+TF_NAMES[i]);
@@ -116,11 +115,11 @@ public class InitForeignPaxels{
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
Item.ToolMaterial material = ((ItemTool)axe).getToolMaterial();
- tfPaxels[i] = new ItemAllToolAA(material, "ingot"+TF_NAMES[i], "paxelTF"+TF_NAMES[i], EnumRarity.RARE, TF_COLORS[i]);
+ TF_PAXELS[i] = new ItemAllToolAA(material, "ingot"+TF_NAMES[i], "paxelTF"+TF_NAMES[i], EnumRarity.RARE, TF_COLORS[i]);
if(ConfigCrafting.PAXELS.isEnabled()){
- GameRegistry.addRecipe(new ShapelessOreRecipe(tfPaxels[i], axe, pickaxe, hoe, sword, shovel));
- ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe());
+ GameRegistry.addRecipe(new ShapelessOreRecipe(TF_PAXELS[i], axe, pickaxe, hoe, sword, shovel));
+ ToolCrafting.RECIPES_PAXELS.add(RecipeUtil.lastIRecipe());
}
}
}
@@ -132,19 +131,19 @@ public class InitForeignPaxels{
}
public static void addToCreativeTab(){
- for(Item item : tfPaxels){
+ for(Item item : TF_PAXELS){
if(item != null){
- CreativeTab.instance.add(item);
+ CreativeTab.INSTANCE.add(item);
}
}
- for(Item item : mtPaxels){
+ for(Item item : MT_PAXELS){
if(item != null){
- CreativeTab.instance.add(item);
+ CreativeTab.INSTANCE.add(item);
}
}
- for(Item item : soPaxels){
+ for(Item item : SO_PAXELS){
if(item != null){
- CreativeTab.instance.add(item);
+ CreativeTab.INSTANCE.add(item);
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java
index 6ccded60d..6ed36ad59 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java
@@ -1,36 +1,36 @@
/*
- * This file ("InitItems.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("InitItems.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
+import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
-import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.base.*;
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
-import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials;
-import de.ellpeck.actuallyadditions.mod.util.CompatUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
+import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
+import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraft.potion.PotionEffect;
-public class InitItems{
+public final class InitItems{
public static Item itemBooklet;
@@ -89,8 +89,6 @@ public class InitItems{
public static Item itemCoffeeSeed;
public static Item itemResonantRice;
- public static Item itemBucketOil;
- public static Item itemBucketCanolaOil;
public static Item itemPhantomConnector;
@@ -133,6 +131,8 @@ public class InitItems{
public static Item itemChestToCrateUpgrade;
public static Item itemCrateKeeper;
+ public static Item itemSpawnerChanger;
+
public static Item itemLaserWrench;
public static Item itemCrystal;
public static Item itemColorLens;
@@ -205,14 +205,20 @@ public class InitItems{
public static Item itemBootsCrystalWhite;
public static Item itemPaxelCrystalWhite;
+ public static Item itemWaterBowl;
+ public static Item itemFilter;
+
public static void init(){
ModUtil.LOGGER.info("Initializing Items...");
+ itemFilter = new ItemFilter("itemFilter");
+ itemWaterBowl = new ItemWaterBowl("itemWaterBowl");
+ itemSpawnerChanger = new ItemSpawnerChanger("itemSpawnerChanger");
itemMisc = new ItemMisc("itemMisc");
- itemCrateKeeper = new ItemGeneric("itemCrateKeeper");
- itemColorLens = new ItemLens("itemColorLens", Lenses.LENS_COLOR);
- itemExplosionLens = new ItemLens("itemExplosionLens", Lenses.LENS_DETONATION);
- itemDamageLens = new ItemLens("itemDamageLens", Lenses.LENS_DEATH);
+ itemCrateKeeper = new ItemGeneric("itemCrateKeeper").setMaxStackSize(1);
+ itemColorLens = new ItemLens("itemColorLens", ActuallyAdditionsAPI.lensColor);
+ itemExplosionLens = new ItemLens("itemExplosionLens", ActuallyAdditionsAPI.lensDetonation);
+ itemDamageLens = new ItemLens("itemDamageLens", ActuallyAdditionsAPI.lensDeath);
itemCrystal = new ItemCrystal("itemCrystal");
itemLaserWrench = new ItemLaserWrench("itemLaserWrench");
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade");
@@ -220,18 +226,18 @@ public class InitItems{
itemGrowthRing = new ItemGrowthRing("itemGrowthRing");
itemMagnetRing = new ItemMagnetRing("itemSuctionRing");
itemWaterRemovalRing = new ItemWaterRemovalRing("itemWaterRemovalRing");
- itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.emerald), "armorEmerald");
- itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.emerald), "armorEmerald");
- itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.emerald), "armorEmerald");
- itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.emerald), "armorEmerald");
- itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.obsidian), "armorObsidian");
- itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.obsidian), "armorObsidian");
- itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.obsidian), "armorObsidian");
- itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.obsidian), "armorObsidian");
- itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz");
- itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz");
- itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz");
- itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz");
+ itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.EMERALD));
+ itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.EMERALD));
+ itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.EMERALD));
+ itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.EMERALD));
+ itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.OBSIDIAN));
+ itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.OBSIDIAN));
+ itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.OBSIDIAN));
+ itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.OBSIDIAN));
+ itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
+ itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
+ itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
+ itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
itemTeleStaff = new ItemTeleStaff("itemTeleStaff");
itemWingsOfTheBats = new ItemWingsOfTheBats("itemWingsOfTheBats");
itemDrill = new ItemDrill("itemDrill");
@@ -249,10 +255,6 @@ public class InitItems{
itemDrillUpgradeThreeByThree = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE, "itemDrillUpgradeThreeByThree");
itemDrillUpgradeFiveByFive = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE, "itemDrillUpgradeFiveByFive");
itemDrillUpgradeBlockPlacing = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER, "itemDrillUpgradeBlockPlacing");
- itemBucketOil = new ItemBucketAA(InitFluids.blockOil, "itemBucketOil");
- FluidContainerRegistry.registerFluidContainer(InitFluids.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET);
- itemBucketCanolaOil = new ItemBucketAA(InitFluids.blockCanolaOil, "itemBucketCanolaOil");
- FluidContainerRegistry.registerFluidContainer(InitFluids.fluidCanolaOil, new ItemStack(itemBucketCanolaOil), FluidContainerRegistry.EMPTY_BUCKET);
itemFertilizer = new ItemFertilizer("itemFertilizer");
itemCoffee = new ItemCoffee("itemCoffee");
itemPhantomConnector = new ItemPhantomConnector("itemPhantomConnector");
@@ -270,35 +272,35 @@ public class InitItems{
itemHairyBall = new ItemHairyBall("itemHairyBall");
itemCoffeeBean = new ItemCoffeeBean("itemCoffeeBeans");
itemRiceSeed = new ItemSeed("itemRiceSeed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal());
- CompatUtil.registerMFRSeed(itemRiceSeed);
- itemCanolaSeed = new ItemSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal());
- CompatUtil.registerMFRSeed(itemCanolaSeed);
- itemFlaxSeed = new ItemSeed("itemFlaxSeed", "seedFlax", InitBlocks.blockFlax, Items.string, 0);
- CompatUtil.registerMFRSeed(itemFlaxSeed);
+ CompatUtil.registerMFRSeed(itemRiceSeed, InitBlocks.blockRice);
+ itemCanolaSeed = new ItemFoodSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal(), 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F);
+ CompatUtil.registerMFRSeed(itemCanolaSeed, InitBlocks.blockCanola);
+ itemFlaxSeed = new ItemSeed("itemFlaxSeed", "seedFlax", InitBlocks.blockFlax, Items.STRING, 0);
+ CompatUtil.registerMFRSeed(itemFlaxSeed, InitBlocks.blockFlax);
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", "seedCoffeeBeans", InitBlocks.blockCoffee, itemCoffeeBean, 0);
- CompatUtil.registerMFRSeed(itemCoffeeSeed);
- itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.EPIC);
- itemAxeEmerald = new ItemAxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.EPIC);
- itemShovelEmerald = new ItemShovelAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.EPIC);
- itemSwordEmerald = new ItemSwordAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemSwordEmerald", EnumRarity.EPIC);
- itemHoeEmerald = new ItemHoeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemHoeEmerald", EnumRarity.EPIC);
- itemPickaxeObsidian = new ItemPickaxeAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemPickaxeObsidian", EnumRarity.UNCOMMON);
- itemAxeObsidian = new ItemAxeAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemAxeObsidian", EnumRarity.UNCOMMON);
- itemShovelObsidian = new ItemShovelAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemShovelObsidian", EnumRarity.UNCOMMON);
- itemSwordObsidian = new ItemSwordAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemSwordObsidian", EnumRarity.UNCOMMON);
- itemHoeObsidian = new ItemHoeAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemHoeObsidian", EnumRarity.UNCOMMON);
+ CompatUtil.registerMFRSeed(itemCoffeeSeed, InitBlocks.blockCoffee);
+ itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemPickaxeEmerald", EnumRarity.EPIC);
+ itemAxeEmerald = new ItemAxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemAxeEmerald", EnumRarity.EPIC);
+ itemShovelEmerald = new ItemShovelAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemShovelEmerald", EnumRarity.EPIC);
+ itemSwordEmerald = new ItemSwordAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemSwordEmerald", EnumRarity.EPIC);
+ itemHoeEmerald = new ItemHoeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "itemHoeEmerald", EnumRarity.EPIC);
+ itemPickaxeObsidian = new ItemPickaxeAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.OBSIDIAN), "itemPickaxeObsidian", EnumRarity.UNCOMMON);
+ itemAxeObsidian = new ItemAxeAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.OBSIDIAN), "itemAxeObsidian", EnumRarity.UNCOMMON);
+ itemShovelObsidian = new ItemShovelAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.OBSIDIAN), "itemShovelObsidian", EnumRarity.UNCOMMON);
+ itemSwordObsidian = new ItemSwordAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.OBSIDIAN), "itemSwordObsidian", EnumRarity.UNCOMMON);
+ itemHoeObsidian = new ItemHoeAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.OBSIDIAN), "itemHoeObsidian", EnumRarity.UNCOMMON);
itemPickaxeQuartz = new ItemPickaxeAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "itemPickaxeQuartz", EnumRarity.RARE);
itemAxeQuartz = new ItemAxeAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "itemAxeQuartz", EnumRarity.RARE);
itemShovelQuartz = new ItemShovelAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "itemShovelQuartz", EnumRarity.RARE);
itemSwordQuartz = new ItemSwordAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "itemSwordQuartz", EnumRarity.RARE);
itemHoeQuartz = new ItemHoeAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "itemHoeQuartz", EnumRarity.RARE);
woodenPaxel = new ItemAllToolAA(Item.ToolMaterial.WOOD, "plankWood", "woodenPaxel", EnumRarity.UNCOMMON, 5192733);
- stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, new ItemStack(Blocks.cobblestone), "stonePaxel", EnumRarity.UNCOMMON, 7040621);
- ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, new ItemStack(Items.iron_ingot), "ironPaxel", EnumRarity.RARE, 10920613);
- goldPaxel = new ItemAllToolAA(Item.ToolMaterial.GOLD, new ItemStack(Items.gold_ingot), "goldPaxel", EnumRarity.RARE, 16770048);
- diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.EMERALD, new ItemStack(Items.diamond), "diamondPaxel", EnumRarity.EPIC, 3250376);
- emeraldPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.EPIC, 7723338);
- obsidianPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.EPIC, 4166);
+ stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, new ItemStack(Blocks.COBBLESTONE), "stonePaxel", EnumRarity.UNCOMMON, 7040621);
+ ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, new ItemStack(Items.IRON_INGOT), "ironPaxel", EnumRarity.RARE, 10920613);
+ goldPaxel = new ItemAllToolAA(Item.ToolMaterial.GOLD, new ItemStack(Items.GOLD_INGOT), "goldPaxel", EnumRarity.RARE, 16770048);
+ diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.DIAMOND, new ItemStack(Items.DIAMOND), "diamondPaxel", EnumRarity.EPIC, 3250376);
+ emeraldPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "emeraldPaxel", EnumRarity.EPIC, 7723338);
+ obsidianPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.OBSIDIAN), "obsidianPaxel", EnumRarity.EPIC, 4166);
quartzPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "quartzPaxel", EnumRarity.RARE, 1710103);
itemPickaxeCrystalRed = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemPickaxeCrystalRed", Util.CRYSTAL_RED_RARITY);
@@ -306,10 +308,10 @@ public class InitItems{
itemShovelCrystalRed = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemShovelCrystalRed", Util.CRYSTAL_RED_RARITY);
itemSwordCrystalRed = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemSwordCrystalRed", Util.CRYSTAL_RED_RARITY);
itemHoeCrystalRed = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemHoeCrystalRed", Util.CRYSTAL_RED_RARITY);
- itemHelmCrystalRed = new ItemArmorAA("itemHelmCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY);
- itemChestCrystalRed = new ItemArmorAA("itemChestCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY);
- itemPantsCrystalRed = new ItemArmorAA("itemPantsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY);
- itemBootsCrystalRed = new ItemArmorAA("itemBootsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY);
+ itemHelmCrystalRed = new ItemArmorAA("itemHelmCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
+ itemChestCrystalRed = new ItemArmorAA("itemChestCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
+ itemPantsCrystalRed = new ItemArmorAA("itemPantsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
+ itemBootsCrystalRed = new ItemArmorAA("itemBootsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
itemPaxelCrystalRed = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemPaxelCrystalRed", Util.CRYSTAL_RED_RARITY, 16711689);
itemPickaxeCrystalBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPickaxeCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
@@ -317,10 +319,10 @@ public class InitItems{
itemShovelCrystalBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemShovelCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
itemSwordCrystalBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemSwordCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
itemHoeCrystalBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemHoeCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
- itemHelmCrystalBlue = new ItemArmorAA("itemHelmCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
- itemChestCrystalBlue = new ItemArmorAA("itemChestCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
- itemPantsCrystalBlue = new ItemArmorAA("itemPantsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
- itemBootsCrystalBlue = new ItemArmorAA("itemBootsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
+ itemHelmCrystalBlue = new ItemArmorAA("itemHelmCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
+ itemChestCrystalBlue = new ItemArmorAA("itemChestCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
+ itemPantsCrystalBlue = new ItemArmorAA("itemPantsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
+ itemBootsCrystalBlue = new ItemArmorAA("itemBootsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
itemPaxelCrystalBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPaxelCrystalBlue", Util.CRYSTAL_BLUE_RARITY, 3014911);
itemPickaxeCrystalLightBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPickaxeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
@@ -328,10 +330,10 @@ public class InitItems{
itemShovelCrystalLightBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemShovelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemSwordCrystalLightBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemSwordCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemHoeCrystalLightBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemHoeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
- itemHelmCrystalLightBlue = new ItemArmorAA("itemHelmCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
- itemChestCrystalLightBlue = new ItemArmorAA("itemChestCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
- itemPantsCrystalLightBlue = new ItemArmorAA("itemPantsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
- itemBootsCrystalLightBlue = new ItemArmorAA("itemBootsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
+ itemHelmCrystalLightBlue = new ItemArmorAA("itemHelmCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
+ itemChestCrystalLightBlue = new ItemArmorAA("itemChestCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
+ itemPantsCrystalLightBlue = new ItemArmorAA("itemPantsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
+ itemBootsCrystalLightBlue = new ItemArmorAA("itemBootsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemPaxelCrystalLightBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPaxelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY, 4093108);
itemPickaxeCrystalBlack = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPickaxeCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
@@ -339,10 +341,10 @@ public class InitItems{
itemShovelCrystalBlack = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemShovelCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
itemSwordCrystalBlack = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemSwordCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
itemHoeCrystalBlack = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemHoeCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
- itemHelmCrystalBlack = new ItemArmorAA("itemHelmCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
- itemChestCrystalBlack = new ItemArmorAA("itemChestCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
- itemPantsCrystalBlack = new ItemArmorAA("itemPantsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
- itemBootsCrystalBlack = new ItemArmorAA("itemBootsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
+ itemHelmCrystalBlack = new ItemArmorAA("itemHelmCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
+ itemChestCrystalBlack = new ItemArmorAA("itemChestCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
+ itemPantsCrystalBlack = new ItemArmorAA("itemPantsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
+ itemBootsCrystalBlack = new ItemArmorAA("itemBootsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
itemPaxelCrystalBlack = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPaxelCrystalBlack", Util.CRYSTAL_BLACK_RARITY, 2631982);
itemPickaxeCrystalGreen = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPickaxeCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
@@ -350,10 +352,10 @@ public class InitItems{
itemShovelCrystalGreen = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemShovelCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
itemSwordCrystalGreen = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemSwordCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
itemHoeCrystalGreen = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemHoeCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
- itemHelmCrystalGreen = new ItemArmorAA("itemHelmCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
- itemChestCrystalGreen = new ItemArmorAA("itemChestCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
- itemPantsCrystalGreen = new ItemArmorAA("itemPantsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
- itemBootsCrystalGreen = new ItemArmorAA("itemBootsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
+ itemHelmCrystalGreen = new ItemArmorAA("itemHelmCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
+ itemChestCrystalGreen = new ItemArmorAA("itemChestCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
+ itemPantsCrystalGreen = new ItemArmorAA("itemPantsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
+ itemBootsCrystalGreen = new ItemArmorAA("itemBootsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
itemPaxelCrystalGreen = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPaxelCrystalGreen", Util.CRYSTAL_GREEN_RARITY, 46848);
itemPickaxeCrystalWhite = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPickaxeCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
@@ -361,10 +363,10 @@ public class InitItems{
itemShovelCrystalWhite = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemShovelCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
itemSwordCrystalWhite = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemSwordCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
itemHoeCrystalWhite = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemHoeCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
- itemHelmCrystalWhite = new ItemArmorAA("itemHelmCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
- itemChestCrystalWhite = new ItemArmorAA("itemChestCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
- itemPantsCrystalWhite = new ItemArmorAA("itemPantsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
- itemBootsCrystalWhite = new ItemArmorAA("itemBootsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
+ itemHelmCrystalWhite = new ItemArmorAA("itemHelmCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
+ itemChestCrystalWhite = new ItemArmorAA("itemChestCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
+ itemPantsCrystalWhite = new ItemArmorAA("itemPantsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
+ itemBootsCrystalWhite = new ItemArmorAA("itemBootsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
itemPaxelCrystalWhite = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPaxelCrystalWhite", Util.CRYSTAL_WHITE_RARITY, 14606302);
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java
new file mode 100644
index 000000000..a18f918e8
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java
@@ -0,0 +1,112 @@
+/*
+ * This file ("ItemAllToolAA.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.items;
+
+import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
+import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
+import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
+import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.client.renderer.color.IItemColor;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{
+
+ public final int color;
+
+ public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){
+ super(4.0F, -2F, toolMat, repairItem, unlocalizedName, rarity, new HashSet());
+ this.color = color;
+
+ this.setMaxDamage(this.getMaxDamage()*4);
+ }
+
+ public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){
+ super(4.0F, -2F, toolMat, repairItem, unlocalizedName, rarity, new HashSet());
+ this.color = color;
+
+ this.setMaxDamage(this.getMaxDamage()*4);
+ }
+
+ @Override
+ protected void registerRendering(){
+ ResourceLocation resLoc = new ResourceLocation(ModUtil.MOD_ID, "itemPaxel");
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), resLoc, "inventory");
+ }
+
+
+ @Override
+ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
+ return Items.IRON_HOE.onItemUse(stack, playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ);
+ }
+
+ @Override
+ public boolean canHarvestBlock(IBlockState state, ItemStack stack){
+
+ return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getMaterial(state).isToolNotRequired() || (state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN ? this.toolMaterial.getHarvestLevel() >= 3 : (state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE ? (state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK ? (state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE ? (state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? (state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? (state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE ? (state.getBlock().getMaterial(state) == Material.ROCK || (state.getBlock().getMaterial(state) == Material.IRON || state.getBlock().getMaterial(state) == Material.ANVIL)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
+ }
+
+ private boolean hasExtraWhitelist(Block block){
+ String name = block.getRegistryName().toString();
+ if(name != null){
+ for(String list : ConfigStringListValues.PAXEL_EXTRA_MINING_WHITELIST.getValue()){
+ if(list.equals(name)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ public Set getToolClasses(ItemStack stack){
+ HashSet hashSet = new HashSet();
+ hashSet.add("pickaxe");
+ hashSet.add("axe");
+ hashSet.add("shovel");
+ return hashSet;
+ }
+
+ @Override
+ public float getStrVsBlock(ItemStack stack, IBlockState state){
+ return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.efficiencyOnProperMaterial : 1.0F;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public IItemColor getColor(){
+ return new IItemColor(){
+ @Override
+ public int getColorFromItemstack(ItemStack stack, int pass){
+ return pass > 0 ? ItemAllToolAA.this.color : 0xFFFFFF;
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java
new file mode 100644
index 000000000..0c31cf28a
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java
@@ -0,0 +1,42 @@
+/*
+ * This file ("ItemAxeAA.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.items;
+
+import com.google.common.collect.Sets;
+import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import java.util.Set;
+
+public class ItemAxeAA extends ItemToolAA{
+
+ private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);
+
+ public ItemAxeAA(Item.ToolMaterial material, String repairItem, String unlocalizedName, EnumRarity rarity){
+ super(6.0F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
+ }
+
+ public ItemAxeAA(Item.ToolMaterial material, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
+ super(6.0F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
+ }
+
+ @Override
+ public float getStrVsBlock(ItemStack stack, IBlockState state){
+ Material material = state.getMaterial();
+ return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java
index 7baf5e9d5..a1f0168e1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemBattery.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemBattery.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -21,6 +21,7 @@ public class ItemBattery extends ItemEnergy{
this.setMaxStackSize(1);
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java
index f805811d6..9f7ad587e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java
@@ -1,40 +1,43 @@
/*
- * This file ("ItemBooklet.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemBooklet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
-import de.ellpeck.actuallyadditions.api.internal.EntrySet;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
+import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
-import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -52,76 +55,76 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
this.setMaxDamage(0);
}
- @Override
- public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){
- if(player.isSneaking()){
- Block block = PosUtil.getBlock(pos, world);
- ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(pos, world));
- if(blockStack != null){
- BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
- if(page != null){
- if(world.isRemote){
- forcedEntry = new EntrySet(page, page.getChapter(), page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1);
- }
- this.onItemRightClick(stack, world, player);
- return true;
- }
- }
- }
- return false;
- }
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
+ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ){
+ if(player.isSneaking()){
+ IBlockState state = world.getBlockState(pos);
+ Block block = state.getBlock();
+ ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state));
+ BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
+ if(page != null){
+ if(world.isRemote){
+ forcedEntry = new EntrySet(page, page.getChapter(), page.getChapter().getEntry(), ActuallyAdditionsAPI.BOOKLET_ENTRIES.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1);
+ }
+ this.onItemRightClick(stack, world, player, hand);
+ return EnumActionResult.SUCCESS;
+ }
+ }
+ return EnumActionResult.FAIL;
+ }
+
+
+ @Override
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote){
- player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach);
+ player.addStat(TheAchievements.OPEN_BOOKLET.chieve);
}
- return stack;
+ return new ActionResult(EnumActionResult.SUCCESS, stack);
}
- @SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
- list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getBaseName()+".desc"));
+ list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID+"."+this.getBaseName()+".desc"));
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
@Override
- public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
+ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
if(posHit != null){
- Block block = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld);
- if(block != null && !block.isAir(minecraft.theWorld, posHit.getBlockPos())){
- ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(posHit.getBlockPos(), minecraft.theWorld));
- if(blockStack != null){
- int height = resolution.getScaledHeight()/5*3;
- if(player.isSneaking()){
- BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
- if(page != null){
- String strg1 = page.getChapter().getLocalizedName();
- String strg2 = "Page "+page.getID();
- String strg3 = "Right-Click to open...";
+ IBlockState state = minecraft.theWorld.getBlockState(posHit.getBlockPos());
+ Block block = state.getBlock();
+ if(block != null && !block.isAir(minecraft.theWorld.getBlockState(posHit.getBlockPos()), minecraft.theWorld, posHit.getBlockPos())){
+ ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state));
+ int height = resolution.getScaledHeight()/5*3;
+ if(player.isSneaking()){
+ BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
+ if(page != null){
+ String strg1 = page.getChapter().getLocalizedName();
+ String strg2 = "Page "+page.getID();
+ String strg3 = "Right-Click to open...";
- AssetUtil.renderStackToGui(page.getChapter().getDisplayItemStack() != null ? page.getChapter().getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2-10, height+41, 1F);
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg1, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg1)/2, height+20, StringUtil.DECIMAL_COLOR_WHITE);
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg2, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg2)/2, height+30, StringUtil.DECIMAL_COLOR_WHITE);
- minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
- }
- else{
- String strg = EnumChatFormatting.DARK_RED+"No Info available! Sorry :(";
- minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
- }
+ AssetUtil.renderStackToGui(page.getChapter().getDisplayItemStack() != null ? page.getChapter().getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2-10, height+41, 1F);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg1, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg1)/2, height+20, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg2, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg2)/2, height+30, StringUtil.DECIMAL_COLOR_WHITE);
+ minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
}
else{
- String strg = EnumChatFormatting.DARK_GREEN+""+EnumChatFormatting.ITALIC+"Sneak!";
+ String strg = TextFormatting.DARK_RED+"No Info available! Sorry :(";
minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
}
}
+ else{
+ String strg = TextFormatting.DARK_GREEN+""+TextFormatting.ITALIC+"Sneak!";
+ minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
+ }
}
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java
index 41ee8bbe8..027cdfade 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java
@@ -1,20 +1,19 @@
/*
- * This file ("ItemChestToCrateUpgrade.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemChestToCrateUpgrade.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
-import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.entity.player.EntityPlayer;
@@ -22,8 +21,10 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemChestToCrateUpgrade extends ItemBase{
@@ -32,11 +33,12 @@ public class ItemChestToCrateUpgrade extends ItemBase{
super(name);
}
+
@Override
- public boolean onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumFacing facing, float par8, float par9, float par10){
+ public EnumActionResult onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){
if(player.isSneaking()){
TileEntity tileHit = world.getTileEntity(pos);
- Block block = PosUtil.getBlock(pos, world);
+ Block block = world.getBlockState(pos).getBlock();
if(block instanceof BlockChest && tileHit instanceof TileEntityChest){
if(!world.isRemote){
TileEntityChest chest = (TileEntityChest)tileHit;
@@ -52,10 +54,10 @@ public class ItemChestToCrateUpgrade extends ItemBase{
}
//Set New Block
- if(!ConfigValues.lessBlockBreakingEffects){
- world.playAuxSFX(2001, pos, Block.getStateId(world.getBlockState(pos)));
+ if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
+ world.playEvent(2001, pos, Block.getStateId(world.getBlockState(pos)));
}
- PosUtil.setBlock(pos, world, InitBlocks.blockGiantChest, 0, 2);
+ world.setBlockState(pos, InitBlocks.blockGiantChest.getDefaultState(), 2);
//Copy Items into new Chest
TileEntity newTileHit = world.getTileEntity(pos);
@@ -74,13 +76,14 @@ public class ItemChestToCrateUpgrade extends ItemBase{
heldStack.stackSize--;
}
}
- return true;
+ return EnumActionResult.SUCCESS;
}
}
- return super.onItemUse(heldStack, player, world, pos, facing, par8, par9, par10);
+ return super.onItemUse(heldStack, player, world, pos, hand, facing, par8, par9, par10);
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java
index 492f9f6d1..5cb1db173 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java
@@ -1,31 +1,31 @@
/*
- * This file ("ItemCoffee.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemCoffee.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
-import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing;
-import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
+import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
+import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StringUtils;
import net.minecraft.world.World;
@@ -45,7 +45,7 @@ public class ItemCoffee extends ItemFoodBase{
}
public static void initIngredients(){
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(new ItemStack(Items.milk_bucket)));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new MilkIngredient(new ItemStack(Items.MILK_BUCKET)));
//Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?)
if(Loader.isModLoaded("harvestcraft")){
Item item = ItemUtil.getItemFromName("harvestcraft:soymilkItem");
@@ -54,17 +54,17 @@ public class ItemCoffee extends ItemFoodBase{
}
}
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)}, 4));
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 20, 0)}, 2));
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 10, 0)}, 2));
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 30, 0)}, 2));
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 5, 0)}, 3));
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)}, 4));
- ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 2));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.SUGAR), new PotionEffect[]{new PotionEffect(MobEffects.SPEED, 30, 0)}, 4));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.MAGMA_CREAM), new PotionEffect[]{new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0)}, 2));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.FISH, 1, 3), new PotionEffect[]{new PotionEffect(MobEffects.WATER_BREATHING, 10, 0)}, 2));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.GOLDEN_CARROT), new PotionEffect[]{new PotionEffect(MobEffects.NIGHT_VISION, 30, 0)}, 2));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.GHAST_TEAR), new PotionEffect[]{new PotionEffect(MobEffects.REGENERATION, 5, 0)}, 3));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.BLAZE_POWDER), new PotionEffect[]{new PotionEffect(MobEffects.STRENGTH, 15, 0)}, 4));
+ ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.FERMENTED_SPIDER_EYE), new PotionEffect[]{new PotionEffect(MobEffects.INVISIBILITY, 25, 0)}, 2));
}
public static CoffeeIngredient getIngredientFromStack(ItemStack stack){
- for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.coffeeMachineIngredients){
+ for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
if(ingredient.ingredient.copy().isItemEqual(stack)){
return ingredient;
}
@@ -72,17 +72,17 @@ public class ItemCoffee extends ItemFoodBase{
return null;
}
- public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){
- PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
+ public static void applyPotionEffectsFromStack(ItemStack stack, EntityLivingBase player){
+ PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){
- player.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()*20, effect.getAmplifier()));
+ player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration()*20, effect.getAmplifier()));
}
}
}
@Override
- public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){
+ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){
ItemStack theStack = stack.copy();
super.onItemUseFinish(stack, world, player);
applyPotionEffectsFromStack(stack, player);
@@ -95,6 +95,7 @@ public class ItemCoffee extends ItemFoodBase{
}
}
+
@Override
public EnumAction getItemUseAction(ItemStack stack){
return EnumAction.DRINK;
@@ -110,10 +111,9 @@ public class ItemCoffee extends ItemFoodBase{
return true;
}
- @SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
- PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
+ PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
if(effects != null){
for(PotionEffect effect : effects){
list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20));
@@ -124,6 +124,7 @@ public class ItemCoffee extends ItemFoodBase{
}
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
@@ -137,18 +138,18 @@ public class ItemCoffee extends ItemFoodBase{
@Override
public boolean effect(ItemStack stack){
- PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
+ PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack);
ArrayList effectsNew = new ArrayList();
if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){
if(effect.getAmplifier() > 0){
- effectsNew.add(new PotionEffect(effect.getPotionID(), effect.getDuration()+120, effect.getAmplifier()-1));
+ effectsNew.add(new PotionEffect(effect.getPotion(), effect.getDuration()+120, effect.getAmplifier()-1));
}
}
stack.setTagCompound(new NBTTagCompound());
if(effectsNew.size() > 0){
this.effects = effectsNew.toArray(new PotionEffect[effectsNew.size()]);
- CoffeeBrewing.addEffectToStack(stack, this);
+ ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
}
}
this.effects = null;
@@ -157,7 +158,7 @@ public class ItemCoffee extends ItemFoodBase{
@Override
public String getExtraText(){
- return StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.extra.milk");
+ return StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.extra.milk");
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffeeBean.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffeeBean.java
index 9e65ea4f8..3da5de4d6 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffeeBean.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffeeBean.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemCoffeeBean.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemCoffeeBean.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -21,6 +21,7 @@ public class ItemCoffeeBean extends ItemFoodBase{
this.setMaxDamage(0);
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java
index 5fd23d1d7..c83422dd3 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemCrafterOnAStick.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemCrafterOnAStick.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -16,6 +16,9 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
public class ItemCrafterOnAStick extends ItemBase{
@@ -25,14 +28,16 @@ public class ItemCrafterOnAStick extends ItemBase{
this.setMaxStackSize(1);
}
+
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
}
- return stack;
+ return new ActionResult(EnumActionResult.SUCCESS, stack);
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java
index 3640fd7e9..d14a9e45c 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemCrystal.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemCrystal.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.BlockCrystal;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
@@ -38,32 +37,31 @@ public class ItemCrystal extends ItemBase{
return damage;
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+BlockCrystal.allCrystals[stack.getItemDamage()].name;
+ return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.COMMON : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? EnumRarity.COMMON : BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].rarity;
}
- @SuppressWarnings("all")
+ @Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < BlockCrystal.allCrystals.length; j++){
+ for(int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[BlockCrystal.allCrystals.length];
- for(int i = 0; i < BlockCrystal.allCrystals.length; i++){
- String name = this.getBaseName()+BlockCrystal.allCrystals[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ for(int i = 0; i < BlockCrystal.ALL_CRYSTALS.length; i++){
+ String name = this.getRegistryName()+BlockCrystal.ALL_CRYSTALS[i].name;
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(name), "inventory");
}
- ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java
index 6421dda39..bf9deedff 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemDrill.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemDrill.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -14,18 +14,18 @@ import cofh.api.energy.IEnergyContainerItem;
import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
-import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
+import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
+import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
@@ -33,12 +33,16 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
+import net.minecraft.init.Enchantments;
+import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.*;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.fml.relauncher.Side;
@@ -48,11 +52,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-@SuppressWarnings("unchecked")
public class ItemDrill extends ItemEnergy{
private static final int ENERGY_USE = 100;
- private static final int HARVEST_LEVEL = 4;
+ public static final int HARVEST_LEVEL = 4;
public ItemDrill(String name){
super(500000, 5000, name);
@@ -69,9 +72,36 @@ public class ItemDrill extends ItemEnergy{
this.setHarvestLevel("pickaxe", HARVEST_LEVEL);
}
+ /**
+ * Gets all of the Slots from NBT
+ *
+ * @param stack The Drill
+ */
+ public static void loadSlotsFromNBT(ItemStack[] slots, ItemStack stack){
+ NBTTagCompound compound = stack.getTagCompound();
+ if(compound != null){
+ TileEntityInventoryBase.loadSlots(slots, compound);
+ }
+ }
+
+ /**
+ * Writes all of the Slots to NBT
+ *
+ * @param slots The Slots
+ * @param stack The Drill
+ */
+ public static void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){
+ NBTTagCompound compound = stack.getTagCompound();
+ if(compound == null){
+ compound = new NBTTagCompound();
+ }
+ TileEntityInventoryBase.saveSlots(slots, compound);
+ stack.setTagCompound(compound);
+ }
+
@Override
//Places Blocks if the Placing Upgrade is installed
- public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){
+ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER);
if(upgrade != null){
int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade);
@@ -83,28 +113,28 @@ public class ItemDrill extends ItemEnergy{
//tryPlaceItemIntoWorld could throw an Exception
try{
//Places the Block into the World
- if(equip.onItemUse(player, world, pos, side, hitX, hitY, hitZ)){
+ if(equip.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ) != EnumActionResult.FAIL){
if(!player.capabilities.isCreativeMode){
player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy());
}
//Synchronizes the Client
player.inventoryContainer.detectAndSendChanges();
- return true;
+ return EnumActionResult.SUCCESS;
}
}
//Notify the Player and log the Exception
catch(Exception e){
- player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!"));
- ModUtil.LOGGER.error("Player "+player.getName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.getDimensionId()+" threw an Exception! Don't let that happen again!");
+ player.addChatComponentMessage(new TextComponentString("Ouch! That really hurt! You must have done something wrong, don't do that again please!"));
+ ModUtil.LOGGER.error("Player "+player.getName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.getDimension()+" threw an Exception! Don't let that happen again!");
}
}
else{
- return true;
+ return EnumActionResult.SUCCESS;
}
}
}
}
- return false;
+ return EnumActionResult.FAIL;
}
/**
@@ -120,7 +150,8 @@ public class ItemDrill extends ItemEnergy{
return null;
}
- ItemStack[] slots = this.getSlotsFromNBT(stack);
+ ItemStack[] slots = new ItemStack[ContainerDrill.SLOT_AMOUNT];
+ loadSlotsFromNBT(slots, stack);
if(slots != null && slots.length > 0){
for(ItemStack slotStack : slots){
if(slotStack != null && slotStack.getItem() instanceof ItemDrillUpgrade){
@@ -133,40 +164,12 @@ public class ItemDrill extends ItemEnergy{
return null;
}
- /**
- * Gets all of the Slots from NBT
- *
- * @param stack The Drill
- * @return All of the Slots
- */
- public ItemStack[] getSlotsFromNBT(ItemStack stack){
- NBTTagCompound compound = stack.getTagCompound();
- if(compound == null){
- return null;
- }
-
- int slotAmount = compound.getInteger("SlotAmount");
- ItemStack[] slots = new ItemStack[slotAmount];
-
- if(slots.length > 0){
- NBTTagList tagList = compound.getTagList("Items", 10);
- for(int i = 0; i < tagList.tagCount(); i++){
- NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
- byte slotIndex = tagCompound.getByte("Slot");
- if(slotIndex >= 0 && slotIndex < slots.length){
- slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
- }
- }
- }
- return slots;
- }
-
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
- if(!world.isRemote && player.isSneaking() && stack == player.getCurrentEquippedItem()){
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
+ if(!world.isRemote && player.isSneaking()){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
}
- return stack;
+ return new ActionResult(EnumActionResult.PASS, stack);
}
@Override
@@ -186,7 +189,8 @@ public class ItemDrill extends ItemEnergy{
//Checks for Energy Containers in the Upgrade Slots and charges the Drill from them
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
- ItemStack[] slots = this.getSlotsFromNBT(stack);
+ ItemStack[] slots = new ItemStack[ContainerDrill.SLOT_AMOUNT];
+ loadSlotsFromNBT(slots, stack);
if(slots != null && slots.length > 0){
for(ItemStack slotStack : slots){
if(slotStack != null && slotStack.getItem() instanceof IEnergyContainerItem){
@@ -211,14 +215,19 @@ public class ItemDrill extends ItemEnergy{
}
@Override
- public Multimap getAttributeModifiers(ItemStack stack){
- Multimap map = super.getAttributeModifiers(stack);
- map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0));
+ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
+ Multimap map = super.getAttributeModifiers(slot, stack);
+
+ if(slot == EntityEquipmentSlot.MAINHAND){
+ map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0));
+ map.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool Modifier", -2.5F, 0));
+ }
+
return map;
}
@Override
- public float getDigSpeed(ItemStack stack, IBlockState state){
+ public float getStrVsBlock(ItemStack stack, IBlockState state){
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.1F;
}
@@ -229,11 +238,11 @@ public class ItemDrill extends ItemEnergy{
if(this.getEnergyStored(stack) >= use){
//Enchants the Drill depending on the Upgrades it has
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){
- ItemUtil.addEnchantment(stack, Enchantment.silkTouch, 1);
+ ItemUtil.addEnchantment(stack, Enchantments.SILK_TOUCH, 1);
}
else{
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){
- ItemUtil.addEnchantment(stack, Enchantment.fortune, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1);
+ ItemUtil.addEnchantment(stack, Enchantments.FORTUNE, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1);
}
}
@@ -251,16 +260,17 @@ public class ItemDrill extends ItemEnergy{
}
//Removes Enchantments added above
- ItemUtil.removeEnchantment(stack, Enchantment.silkTouch);
- ItemUtil.removeEnchantment(stack, Enchantment.fortune);
+ ItemUtil.removeEnchantment(stack, Enchantments.SILK_TOUCH);
+ ItemUtil.removeEnchantment(stack, Enchantments.FORTUNE);
}
return toReturn;
}
@Override
- public boolean canHarvestBlock(Block block, ItemStack stack){
+ public boolean canHarvestBlock(IBlockState state, ItemStack stack){
int harvestLevel = this.getHarvestLevel(stack, "");
- return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? harvestLevel >= 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2))));
+ Block block = state.getBlock();
+ return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial(state).isToolNotRequired() || (block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? harvestLevel >= 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (block.getMaterial(state) == Material.ROCK || (block.getMaterial(state) == Material.IRON || block.getMaterial(state) == Material.ANVIL)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2))));
}
@Override
@@ -333,17 +343,13 @@ public class ItemDrill extends ItemEnergy{
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[16];
for(int i = 0; i < 16; i++){
- String name = this.getBaseName()+TheColoredLampColors.values()[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ String name = this.getRegistryName()+TheColoredLampColors.values()[i].name;
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(name), "inventory");
}
- ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
@Override
- @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list){
for(int i = 0; i < 16; i++){
@@ -382,35 +388,13 @@ public class ItemDrill extends ItemEnergy{
efficiency += 8.0F;
}
}
- return efficiency;
- }
-
- /**
- * Writes all of the Slots to NBT
- *
- * @param slots The Slots
- * @param stack The Drill
- */
- public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){
- NBTTagCompound compound = stack.getTagCompound();
- if(compound == null){
- compound = new NBTTagCompound();
- }
-
- if(slots != null && slots.length > 0){
- compound.setInteger("SlotAmount", slots.length);
- NBTTagList tagList = new NBTTagList();
- for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
- if(slots[currentIndex] != null){
- NBTTagCompound tagCompound = new NBTTagCompound();
- tagCompound.setByte("Slot", (byte)currentIndex);
- slots[currentIndex].writeToNBT(tagCompound);
- tagList.appendTag(tagCompound);
- }
+ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){
+ efficiency *= 0.5F;
+ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){
+ efficiency *= 0.35F;
}
- compound.setTag("Items", tagList);
}
- stack.setTagCompound(compound);
+ return efficiency;
}
/**
@@ -428,7 +412,7 @@ public class ItemDrill extends ItemEnergy{
int zRange = 0;
//Block hit
- MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player);
+ RayTraceResult pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player);
if(pos == null){
return false;
}
@@ -445,7 +429,8 @@ public class ItemDrill extends ItemEnergy{
}
//Not defined later because main Block is getting broken below
- float mainHardness = PosUtil.getBlock(aPos, world).getBlockHardness(world, aPos);
+ IBlockState state = world.getBlockState(aPos);
+ float mainHardness = state.getBlockHardness(world, aPos);
//Break Middle Block first
int use = this.getEnergyUsePerBlock(stack);
@@ -467,7 +452,8 @@ public class ItemDrill extends ItemEnergy{
if(this.getEnergyStored(stack) >= use){
//Only break Blocks around that are (about) as hard or softer
BlockPos thePos = new BlockPos(xPos, yPos, zPos);
- if(PosUtil.getBlock(thePos, world).getBlockHardness(world, thePos) <= mainHardness+5.0F){
+ IBlockState theState = world.getBlockState(thePos);
+ if(theState.getBlockHardness(world, thePos) <= mainHardness+5.0F){
this.tryHarvestBlock(world, thePos, true, stack, player, use);
}
}
@@ -494,9 +480,10 @@ public class ItemDrill extends ItemEnergy{
* @param use The Energy that should be extracted per Block
*/
private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){
- Block block = PosUtil.getBlock(pos, world);
- float hardness = block.getBlockHardness(world, pos);
- boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(block, stack)) && (!isExtra || this.getDigSpeed(stack, world.getBlockState(pos)) > 1.0F);
+ IBlockState state = world.getBlockState(pos);
+ Block block = state.getBlock();
+ float hardness = block.getBlockHardness(state, world, pos);
+ boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F);
if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){
this.extractEnergy(stack, use, false);
//Break the Block
@@ -506,9 +493,9 @@ public class ItemDrill extends ItemEnergy{
}
private boolean hasExtraWhitelist(Block block){
- String name = block.getRegistryName();
+ String name = block.getRegistryName().toString();
if(name != null){
- for(String list : ConfigValues.drillExtraminingWhitelist){
+ for(String list : ConfigStringListValues.DRILL_EXTRA_MINING_WHITELIST.getValue()){
if(list.equals(name)){
return true;
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java
index 54088ca7b..9be78d3b0 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemDrillUpgrade.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemDrillUpgrade.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -14,11 +14,14 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
public class ItemDrillUpgrade extends ItemBase{
- public UpgradeType type;
+ public final UpgradeType type;
public ItemDrillUpgrade(UpgradeType type, String unlocName){
super(unlocName);
@@ -34,12 +37,14 @@ public class ItemDrillUpgrade extends ItemBase{
return -1;
}
+
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote && this.type == UpgradeType.PLACER){
this.setSlotToPlaceFrom(stack, player.inventory.currentItem);
+ return new ActionResult(EnumActionResult.SUCCESS, stack);
}
- return stack;
+ return new ActionResult(EnumActionResult.FAIL, stack);
}
public void setSlotToPlaceFrom(ItemStack stack, int slot){
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java
index 1ba612d18..0d40df918 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemDust.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemDust.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -13,21 +13,21 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
-public class ItemDust extends ItemBase{
+public class ItemDust extends ItemBase implements IColorProvidingItem{
- public static final TheDusts[] allDusts = TheDusts.values();
+ public static final TheDusts[] ALL_DUSTS = TheDusts.values();
public ItemDust(String name){
super(name);
@@ -39,34 +39,41 @@ public class ItemDust extends ItemBase{
return damage;
}
- @Override
- public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= allDusts.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allDusts[stack.getItemDamage()].name;
- }
@Override
- @SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass){
- return stack.getItemDamage() >= allDusts.length ? 0 : allDusts[stack.getItemDamage()].color;
+ public String getUnlocalizedName(ItemStack stack){
+ return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_DUSTS[stack.getItemDamage()].name;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= allDusts.length ? EnumRarity.COMMON : allDusts[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= ALL_DUSTS.length ? EnumRarity.COMMON : ALL_DUSTS[stack.getItemDamage()].rarity;
}
- @SuppressWarnings("all")
+ @Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allDusts.length; j++){
+ for(int j = 0; j < ALL_DUSTS.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
protected void registerRendering(){
- for(int i = 0; i < allDusts.length; i++){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ for(int i = 0; i < ALL_DUSTS.length; i++){
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), "inventory");
}
}
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public IItemColor getColor(){
+ return new IItemColor(){
+ @Override
+ public int getColorFromItemstack(ItemStack stack, int pass){
+ return stack.getItemDamage() >= ALL_DUSTS.length ? 0xFFFFFF : ALL_DUSTS[stack.getItemDamage()].color;
+ }
+ };
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java
index 0a43ead28..f95a4ff15 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java
@@ -1,41 +1,49 @@
/*
- * This file ("ItemFertilizer.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemFertilizer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
+import de.ellpeck.actuallyadditions.mod.misc.DispenserHandlerFertilize;
+import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemFertilizer extends ItemBase{
public ItemFertilizer(String name){
super(name);
+
+ BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, new DispenserHandlerFertilize());
}
+
@Override
- public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float par8, float par9, float par10){
+ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10){
if(ItemDye.applyBonemeal(stack, world, pos, player)){
if(!world.isRemote){
- world.playAuxSFX(2005, pos, 0);
+ world.playEvent(2005, pos, 0);
}
- return true;
+ return EnumActionResult.SUCCESS;
}
- return super.onItemUse(stack, player, world, pos, side, par8, par9, par10);
+ return super.onItemUse(stack, player, world, pos, hand, side, par8, par9, par10);
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java
new file mode 100644
index 000000000..6a5343bc5
--- /dev/null
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java
@@ -0,0 +1,59 @@
+/*
+ * This file ("ItemFilter.java") is part of the Actually Additions mod for Minecraft.
+ * It is created and owned by Ellpeck and distributed
+ * under the Actually Additions License to be found at
+ * http://ellpeck.de/actaddlicense
+ * View the source code at https://github.com/Ellpeck/ActuallyAdditions
+ *
+ * © 2015-2016 Ellpeck
+ */
+
+package de.ellpeck.actuallyadditions.mod.items;
+
+import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
+import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
+import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
+import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.EnumHand;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+public class ItemFilter extends ItemBase{
+
+ public ItemFilter(String name){
+ super(name);
+ this.setMaxStackSize(1);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack stack){
+ return EnumRarity.UNCOMMON;
+ }
+
+ @Override
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
+ if(!world.isRemote){
+ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FILTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
+ }
+ return new ActionResult(EnumActionResult.PASS, stack);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced){
+ ItemStack[] slots = new ItemStack[ContainerFilter.SLOT_AMOUNT];
+ ItemDrill.loadSlotsFromNBT(slots, stack);
+ if(slots != null && slots.length > 0){
+ for(ItemStack slot : slots){
+ if(slot != null && slot.getItem() != null){
+ tooltip.add(slot.getItem().getItemStackDisplayName(slot));
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java
index 43448210e..a6542daa1 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemFoods.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemFoods.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -13,16 +13,16 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -31,7 +31,7 @@ import java.util.List;
public class ItemFoods extends ItemFoodBase{
- public static final TheFoods[] allFoods = TheFoods.values();
+ public static final TheFoods[] ALL_FOODS = TheFoods.values();
public ItemFoods(String name){
super(0, 0.0F, false, name);
@@ -41,11 +41,11 @@ public class ItemFoods extends ItemFoodBase{
}
@Override
- public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){
+ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){
ItemStack stackToReturn = super.onItemUseFinish(stack, world, player);
- ItemStack returnItem = stack.getItemDamage() >= allFoods.length ? null : allFoods[stack.getItemDamage()].returnItem;
- if(returnItem != null){
- if(!player.inventory.addItemStackToInventory(returnItem.copy())){
+ ItemStack returnItem = stack.getItemDamage() >= ALL_FOODS.length ? null : ALL_FOODS[stack.getItemDamage()].returnItem;
+ if(returnItem != null && player instanceof EntityPlayer){
+ if(!((EntityPlayer)player).inventory.addItemStackToInventory(returnItem.copy())){
if(!world.isRemote){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy());
entityItem.setPickupDelay(0);
@@ -58,22 +58,22 @@ public class ItemFoods extends ItemFoodBase{
@Override
public int getMaxItemUseDuration(ItemStack stack){
- return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].useDuration;
+ return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].useDuration;
}
@Override
public EnumAction getItemUseAction(ItemStack stack){
- return stack.getItemDamage() >= allFoods.length ? EnumAction.EAT : (allFoods[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT);
+ return stack.getItemDamage() >= ALL_FOODS.length ? EnumAction.EAT : (ALL_FOODS[stack.getItemDamage()].getsDrunken ? EnumAction.DRINK : EnumAction.EAT);
}
@Override
public int getHealAmount(ItemStack stack){
- return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].healAmount;
+ return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].healAmount;
}
@Override
public float getSaturationModifier(ItemStack stack){
- return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].saturation;
+ return stack.getItemDamage() >= ALL_FOODS.length ? 0 : ALL_FOODS[stack.getItemDamage()].saturation;
}
@Override
@@ -81,32 +81,31 @@ public class ItemFoods extends ItemFoodBase{
return damage;
}
+
@Override
public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= allFoods.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allFoods[stack.getItemDamage()].name;
+ return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_FOODS[stack.getItemDamage()].name;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= allFoods.length ? EnumRarity.COMMON : allFoods[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= ALL_FOODS.length ? EnumRarity.COMMON : ALL_FOODS[stack.getItemDamage()].rarity;
}
- @SuppressWarnings("all")
+ @Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allFoods.length; j++){
+ for(int j = 0; j < ALL_FOODS.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
protected void registerRendering(){
- ResourceLocation[] resLocs = new ResourceLocation[allFoods.length];
- for(int i = 0; i < allFoods.length; i++){
- String name = this.getBaseName()+allFoods[i].name;
- resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name);
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name));
+ for(int i = 0; i < ALL_FOODS.length; i++){
+ String name = this.getRegistryName()+ALL_FOODS[i].name;
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ModelResourceLocation(name), "inventory");
}
- ActuallyAdditions.proxy.addRenderVariant(this, resLocs);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java
index 3b1c5e464..86238564e 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemGeneric.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemGeneric.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -21,6 +21,7 @@ public class ItemGeneric extends ItemBase{
this.setMaxDamage(0);
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.UNCOMMON;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java
index f4b1922a1..9f96b6507 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java
@@ -1,32 +1,32 @@
/*
- * This file ("ItemGrowthRing.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemGrowthRing.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass;
import net.minecraft.block.IGrowable;
+import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.MathHelper;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import java.util.ArrayList;
+import java.util.List;
public class ItemGrowthRing extends ItemEnergy{
@@ -41,19 +41,14 @@ public class ItemGrowthRing extends ItemEnergy{
}
EntityPlayer player = (EntityPlayer)entity;
- ItemStack equipped = player.getCurrentEquippedItem();
+ ItemStack equipped = player.getHeldItemMainhand();
int energyUse = 300;
if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){
- ArrayList blocks = new ArrayList();
-
- if(stack.getTagCompound() == null){
- stack.setTagCompound(new NBTTagCompound());
- }
- int waitTime = stack.getTagCompound().getInteger("WaitTime");
+ List blocks = new ArrayList();
//Adding all possible Blocks
- if(waitTime >= 30){
+ if(player.worldObj.getTotalWorldTime()%30 == 0){
int range = 3;
for(int x = -range; x < range+1; x++){
for(int z = -range; z < range+1; z++){
@@ -62,7 +57,7 @@ public class ItemGrowthRing extends ItemEnergy{
int theY = MathHelper.floor_double(player.posY+y);
int theZ = MathHelper.floor_double(player.posZ+z);
BlockPos posInQuestion = new BlockPos(theX, theY, theZ);
- Block theBlock = PosUtil.getBlock(posInQuestion, world);
+ Block theBlock = world.getBlockState(posInQuestion).getBlock();
if((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof BlockGrass)){
blocks.add(posInQuestion);
}
@@ -76,12 +71,15 @@ public class ItemGrowthRing extends ItemEnergy{
if(this.getEnergyStored(stack) >= energyUse){
BlockPos pos = blocks.get(Util.RANDOM.nextInt(blocks.size()));
- int metaBefore = PosUtil.getMetadata(pos, world);
- PosUtil.getBlock(pos, world).updateTick(world, pos, world.getBlockState(pos), Util.RANDOM);
+ IBlockState state = world.getBlockState(pos);
+ Block block = state.getBlock();
+ int metaBefore = block.getMetaFromState(state);
+ block.updateTick(world, pos, world.getBlockState(pos), Util.RANDOM);
//Show Particles if Metadata changed
- if(PosUtil.getMetadata(pos, world) != metaBefore){
- world.playAuxSFX(2005, pos, 0);
+ IBlockState newState = world.getBlockState(pos);
+ if(newState.getBlock().getMetaFromState(newState) != metaBefore){
+ world.playEvent(2005, pos, 0);
}
if(!player.capabilities.isCreativeMode){
@@ -93,15 +91,11 @@ public class ItemGrowthRing extends ItemEnergy{
}
}
}
-
- stack.getTagCompound().setInteger("WaitTime", 0);
- }
- else{
- stack.getTagCompound().setInteger("WaitTime", waitTime+1);
}
}
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java
index 0d4785dc2..c7598f0dd 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java
@@ -1,34 +1,60 @@
/*
- * This file ("ItemHairyBall.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemHairyBall.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
-import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.WeightedRandom;
+import net.minecraft.util.*;
import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.LivingEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.UUID;
public class ItemHairyBall extends ItemBase{
public ItemHairyBall(String name){
super(name);
+
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @SubscribeEvent
+ public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event){
+ //Ocelots dropping Hair Balls
+ if(event.getEntityLiving() != null){
+ if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote){
+ if((event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed()) || (event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){
+ if(ConfigBoolValues.DO_CAT_DROPS.isEnabled()){
+ if(Util.RANDOM.nextInt(5000)+1 == 1){
+ EntityItem item = new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX+0.5, event.getEntityLiving().posY+0.5, event.getEntityLiving().posZ+0.5, new ItemStack(InitItems.itemHairyBall));
+ event.getEntityLiving().worldObj.spawnEntityInWorld(item);
+ }
+ }
+ }
+ }
+ }
}
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote){
ItemStack returnItem = this.getRandomReturnItem();
if(!player.inventory.addItemStackToInventory(returnItem)){
@@ -37,15 +63,17 @@ public class ItemHairyBall extends ItemBase{
player.worldObj.spawnEntityInWorld(entityItem);
}
stack.stackSize--;
- world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
+
+ world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
}
- return stack;
+ return new ActionResult(EnumActionResult.SUCCESS, stack);
}
public ItemStack getRandomReturnItem(){
- return ((BallOfFurReturn)WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.ballOfFurReturnItems)).returnItem.copy();
+ return WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.BALL_OF_FUR_RETURN_ITEMS).returnItem.copy();
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java
index f64c2eea5..5dfd93ffe 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemJams.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemJams.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -13,26 +13,28 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
-import de.ellpeck.actuallyadditions.mod.util.ModUtil;
+import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
+import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
-import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
-public class ItemJams extends ItemFoodBase{
+public class ItemJams extends ItemFoodBase implements IColorProvidingItem{
- public static final TheJams[] allJams = TheJams.values();
+ public static final TheJams[] ALL_JAMS = TheJams.values();
public ItemJams(String name){
super(0, 0.0F, false, name);
@@ -46,43 +48,39 @@ public class ItemJams extends ItemFoodBase{
return damage;
}
- @Override
- public String getUnlocalizedName(ItemStack stack){
- return stack.getItemDamage() >= allJams.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allJams[stack.getItemDamage()].name;
- }
@Override
- @SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass){
- return pass > 0 ? (stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].color) : super.getColorFromItemStack(stack, pass);
+ public String getUnlocalizedName(ItemStack stack){
+ return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_JAMS[stack.getItemDamage()].name;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
- return stack.getItemDamage() >= allJams.length ? EnumRarity.COMMON : allJams[stack.getItemDamage()].rarity;
+ return stack.getItemDamage() >= ALL_JAMS.length ? EnumRarity.COMMON : ALL_JAMS[stack.getItemDamage()].rarity;
}
- @SuppressWarnings("all")
+ @Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
- for(int j = 0; j < allJams.length; j++){
+ for(int j = 0; j < ALL_JAMS.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
- public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){
+ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){
ItemStack stackToReturn = super.onItemUseFinish(stack, world, player);
- if(!world.isRemote && stack.getItemDamage() < allJams.length){
- PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200);
+ if(player instanceof EntityPlayer && !world.isRemote && stack.getItemDamage() < ALL_JAMS.length){
+ PotionEffect firstEffectToGet = new PotionEffect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].firstEffectToGet), 200);
player.addPotionEffect(firstEffectToGet);
- PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600);
+ PotionEffect secondEffectToGet = new PotionEffect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].secondEffectToGet), 600);
player.addPotionEffect(secondEffectToGet);
- ItemStack returnItem = new ItemStack(Items.glass_bottle);
- if(!player.inventory.addItemStackToInventory(returnItem.copy())){
+ ItemStack returnItem = new ItemStack(Items.GLASS_BOTTLE);
+ if(!((EntityPlayer)player).inventory.addItemStackToInventory(returnItem.copy())){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy());
entityItem.setPickupDelay(0);
player.worldObj.spawnEntityInWorld(entityItem);
@@ -93,18 +91,29 @@ public class ItemJams extends ItemFoodBase{
@Override
public int getHealAmount(ItemStack stack){
- return stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].healAmount;
+ return stack.getItemDamage() >= ALL_JAMS.length ? 0 : ALL_JAMS[stack.getItemDamage()].healAmount;
}
@Override
public float getSaturationModifier(ItemStack stack){
- return stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].saturation;
+ return stack.getItemDamage() >= ALL_JAMS.length ? 0 : ALL_JAMS[stack.getItemDamage()].saturation;
}
@Override
protected void registerRendering(){
- for(int i = 0; i < allJams.length; i++){
- ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
+ for(int i = 0; i < ALL_JAMS.length; i++){
+ ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), "inventory");
}
}
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IItemColor getColor(){
+ return new IItemColor(){
+ @Override
+ public int getColorFromItemstack(ItemStack stack, int pass){
+ return pass > 0 ? (stack.getItemDamage() >= ALL_JAMS.length ? 0xFFFFFF : ALL_JAMS[stack.getItemDamage()].color) : 0xFFFFFF;
+ }
+ };
+ }
}
\ No newline at end of file
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java
index ecaad022b..2becdff1a 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemKnife.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemKnife.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -14,6 +14,7 @@ import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
+import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
@@ -32,19 +33,23 @@ public class ItemKnife extends ItemBase{
return true;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
- @SuppressWarnings("unchecked")
+
@Override
- public Multimap getAttributeModifiers(ItemStack stack){
- Multimap map = super.getAttributeModifiers(stack);
- map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Knife Modifier", 3, 0));
+ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
+ Multimap map = super.getAttributeModifiers(slot, stack);
+ if(slot == EntityEquipmentSlot.MAINHAND){
+ map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Knife Modifier", 3, 0));
+ }
return map;
}
+
@Override
public ItemStack getContainerItem(ItemStack stack){
ItemStack theStack = stack.copy();
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java
index 18f914a88..a2318f1d7 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java
@@ -1,29 +1,37 @@
/*
- * This file ("ItemLaserWrench.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemLaserWrench.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
+import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler;
+import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
+import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.text.TextComponentString;
+import net.minecraft.util.text.TextComponentTranslation;
+import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -38,32 +46,59 @@ public class ItemLaserWrench extends ItemBase{
}
@Override
- public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing par7, float par8, float par9, float par10){
- if(!world.isRemote){
- TileEntity tile = world.getTileEntity(pos);
- if(tile instanceof TileEntityLaserRelay){
+ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10){
+ TileEntity tile = world.getTileEntity(pos);
+ if(tile instanceof TileEntityLaserRelay){
+ if(!world.isRemote){
if(ItemPhantomConnector.getStoredPosition(stack) == null){
ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world);
- player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.stored.desc")));
+ player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".laser.stored.desc"));
}
else{
BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack);
- if(ItemPhantomConnector.getStoredWorld(stack) == world && world.getTileEntity(savedPos) instanceof TileEntityLaserRelay && LaserRelayConnectionHandler.getInstance().addConnection(savedPos, pos)){
- ItemPhantomConnector.clearStorage(stack);
+ if(savedPos != null){
+ TileEntity savedTile = world.getTileEntity(savedPos);
+ if(ItemPhantomConnector.getStoredWorld(stack) == world && savedTile instanceof TileEntityLaserRelay && ((TileEntityLaserRelay)savedTile).isItem == ((TileEntityLaserRelay)tile).isItem && LaserRelayConnectionHandler.addConnection(savedPos, pos, world)){
+ ItemPhantomConnector.clearStorage(stack);
- ((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate();
- ((TileEntityLaserRelay)world.getTileEntity(pos)).sendUpdate();
+ ((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate();
+ ((TileEntityLaserRelay)world.getTileEntity(pos)).sendUpdate();
- player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.connected.desc")));
- }
- else{
- player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.cantConnect.desc")));
- ItemPhantomConnector.clearStorage(stack);
+ player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".laser.connected.desc"));
+ }
+ else{
+ player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".laser.cantConnect.desc"));
+ ItemPhantomConnector.clearStorage(stack);
+ }
}
}
}
+ return EnumActionResult.SUCCESS;
}
- return false;
+ return EnumActionResult.FAIL;
+ }
+
+ @Override
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
+ if(!world.isRemote && player.isSneaking()){
+ PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(player);
+
+ int currMode = save.theCompound.getInteger("LaserWrenchMode");
+ if(currMode+1 >= WrenchMode.values().length){
+ currMode = 0;
+ }
+ else{
+ currMode++;
+ }
+ save.theCompound.setInteger("LaserWrenchMode", currMode);
+
+ if(player instanceof EntityPlayerMP){
+ PacketHandler.theNetwork.sendTo(new PacketServerToClient(save.theCompound, PacketHandler.PLAYER_DATA_TO_CLIENT_HANDLER), (EntityPlayerMP)player);
+ }
+
+ player.addChatComponentMessage(new TextComponentString("Mode changed to "+WrenchMode.values()[currMode].name+"!"));
+ }
+ return new ActionResult(EnumActionResult.SUCCESS, stack);
}
@Override
@@ -79,16 +114,15 @@ public class ItemLaserWrench extends ItemBase{
}
@Override
- @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
BlockPos coords = ItemPhantomConnector.getStoredPosition(stack);
if(coords != null){
- list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
+ list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".boundTo.desc")+":");
list.add("X: "+coords.getX());
list.add("Y: "+coords.getY());
list.add("Z: "+coords.getZ());
- list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
+ list.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".clearStorage.desc"));
}
}
@@ -96,4 +130,16 @@ public class ItemLaserWrench extends ItemBase{
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC;
}
+
+ public enum WrenchMode{
+ ALWAYS_PARTICLES("always show particles"),
+ NO_PARTICLES("never show particles"),
+ HOLDING_PARTICLES("show particles when holding a Laser Wrench");
+
+ public final String name;
+
+ WrenchMode(String name){
+ this.name = name;
+ }
+ }
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java
index 82ac810a9..46c506985 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java
@@ -1,33 +1,40 @@
/*
- * This file ("ItemLeafBlower.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemLeafBlower.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
-import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
+import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem;
+import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
-import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.MathHelper;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.SoundCategory;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Collections;
-public class ItemLeafBlower extends ItemBase{
+public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{
private final boolean isAdvanced;
@@ -37,12 +44,14 @@ public class ItemLeafBlower extends ItemBase{
this.setMaxStackSize(1);
}
+
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
- player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
- return stack;
+ public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
+ player.setActiveHand(hand);
+ return new ActionResult(EnumActionResult.SUCCESS, stack);
}
+
@Override
public EnumAction getItemUseAction(ItemStack stack){
return EnumAction.BOW;
@@ -54,23 +63,30 @@ public class ItemLeafBlower extends ItemBase{
return Integer.MAX_VALUE;
}
+
@Override
public EnumRarity getRarity(ItemStack stack){
return this.isAdvanced ? EnumRarity.EPIC : EnumRarity.RARE;
}
@Override
- public void onUsingTick(ItemStack stack, EntityPlayer player, int time){
- if(!player.worldObj.isRemote){
- if(time <= getMaxItemUseDuration(stack) && (this.isAdvanced || time%3 == 0)){
+ public void onUsingTick(ItemStack stack, EntityLivingBase player, int time){
+ this.doUpdate(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), time, stack);
+ }
+
+ private boolean doUpdate(World world, int x, int y, int z, int time, ItemStack stack){
+ if(!world.isRemote){
+ if(time <= this.getMaxItemUseDuration(stack) && (this.isAdvanced || time%3 == 0)){
//Breaks the Blocks
- this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
+ boolean broke = this.breakStuff(world, x, y, z);
//Plays a Minecart sounds (It really sounds like a Leaf Blower!)
- if(!ConfigValues.lessSound){
- player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F);
+ if(!ConfigBoolValues.LESS_SOUND.isEnabled()){
+ world.playSound(null, x, y, z, SoundEvents.ENTITY_MINECART_RIDING, SoundCategory.PLAYERS, 0.3F, 0.001F);
}
+ return broke;
}
}
+ return false;
}
/**
@@ -81,7 +97,7 @@ public class ItemLeafBlower extends ItemBase{
* @param y The Y Position of the Player
* @param z The Z Position of the Player
*/
- public void breakStuff(World world, int x, int y, int z){
+ public boolean breakStuff(World world, int x, int y, int z){
ArrayList breakPositions = new ArrayList();
int rangeSides = 5;
@@ -91,8 +107,8 @@ public class ItemLeafBlower extends ItemBase{
for(int reachY = (this.isAdvanced ? -rangeSides : -rangeUp); reachY < (this.isAdvanced ? rangeSides : rangeUp)+1; reachY++){
//The current Block to break
BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ);
- Block block = PosUtil.getBlock(pos, world);
- if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world, pos)))){
+ Block block = world.getBlockState(pos).getBlock();
+ if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world.getBlockState(pos), world, pos)))){
breakPositions.add(pos);
}
}
@@ -103,15 +119,15 @@ public class ItemLeafBlower extends ItemBase{
Collections.shuffle(breakPositions);
BlockPos theCoord = breakPositions.get(0);
- Block theBlock = PosUtil.getBlock(theCoord, world);
+ Block theBlock = world.getBlockState(theCoord).getBlock();
ArrayList drops = new ArrayList();
//Gets all of the Drops the Block should have
drops.addAll(theBlock.getDrops(world, theCoord, world.getBlockState(theCoord), 0));
//Plays the Breaking Sound
- if(!ConfigValues.lessBlockBreakingEffects){
- world.playAuxSFX(2001, theCoord, Block.getStateId(world.getBlockState(theCoord)));
+ if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){
+ world.playEvent(2001, theCoord, Block.getStateId(world.getBlockState(theCoord)));
}
//Deletes the Block
@@ -121,6 +137,18 @@ public class ItemLeafBlower extends ItemBase{
//Drops the Items into the World
world.spawnEntityInWorld(new EntityItem(world, theCoord.getX()+0.5, theCoord.getY()+0.5, theCoord.getZ()+0.5, theDrop));
}
+ return true;
}
+ return false;
+ }
+
+ @Override
+ public boolean update(ItemStack stack, TileEntity tile, int elapsedTicks){
+ return this.doUpdate(tile.getWorld(), tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(), elapsedTicks, stack);
+ }
+
+ @Override
+ public int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks){
+ return 60;
}
}
diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java
index 0f4422e89..777b035d8 100644
--- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java
+++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java
@@ -1,11 +1,11 @@
/*
- * This file ("ItemMagnetRing.java") is part of the Actually Additions Mod for Minecraft.
+ * This file ("ItemMagnetRing.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
- * http://ellpeck.de/actaddlicense/
+ * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
- * © 2016 Ellpeck
+ * © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
@@ -16,8 +16,8 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.Vec3;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import java.util.ArrayList;
@@ -28,20 +28,19 @@ public class ItemMagnetRing extends ItemEnergy{
super(3000000, 5000, name);
}
- @SuppressWarnings("unchecked")
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
int energyUse = 10;
if(!entity.isSneaking()){
//Get all the Items in the area
int range = 5;
- ArrayList