mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Format so style is finally consistent.
This commit is contained in:
parent
95a25dbfc4
commit
274c53a014
387 changed files with 7603 additions and 8941 deletions
|
@ -39,10 +39,10 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
public final class ActuallyAdditionsAPI{
|
public final class ActuallyAdditionsAPI {
|
||||||
|
|
||||||
public static final String MOD_ID = "actuallyadditions";
|
public static final String MOD_ID = "actuallyadditions";
|
||||||
public static final String API_ID = MOD_ID+"api";
|
public static final String API_ID = MOD_ID + "api";
|
||||||
public static final String API_VERSION = "34";
|
public static final String API_VERSION = "34";
|
||||||
|
|
||||||
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
||||||
|
@ -116,7 +116,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param oreName The ore's name
|
* @param oreName The ore's name
|
||||||
* @param weight The ore's weight
|
* @param weight The ore's weight
|
||||||
*/
|
*/
|
||||||
public static void addMiningLensStoneOre(String oreName, int weight){
|
public static void addMiningLensStoneOre(String oreName, int weight) {
|
||||||
STONE_ORES.add(new WeightedOre(oreName, weight));
|
STONE_ORES.add(new WeightedOre(oreName, weight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param oreName The ore's name
|
* @param oreName The ore's name
|
||||||
* @param weight The ore's weight
|
* @param weight The ore's weight
|
||||||
*/
|
*/
|
||||||
public static void addMiningLensNetherOre(String oreName, int weight){
|
public static void addMiningLensNetherOre(String oreName, int weight) {
|
||||||
NETHERRACK_ORES.add(new WeightedOre(oreName, weight));
|
NETHERRACK_ORES.add(new WeightedOre(oreName, weight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @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){
|
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
||||||
CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.fromStacks(input), outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.fromStacks(input), outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||||
*/
|
*/
|
||||||
public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
|
public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
||||||
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,13 +166,13 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param outputTwoAmounts The amount of the second output, will be equal for all entries in the list
|
* @param outputTwoAmounts The amount of the second output, will be equal for all entries in the list
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
||||||
*/
|
*/
|
||||||
public static boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance){
|
public static boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
|
||||||
return methodHandler.addCrusherRecipes(inputs, outputOnes, outputOneAmounts, outputTwos, outputTwoAmounts, outputTwoChance);
|
return methodHandler.addCrusherRecipes(inputs, outputOnes, outputOneAmounts, outputTwos, outputTwoAmounts, outputTwoChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Same thing as above, but with ItemStack outputs.
|
//Same thing as above, but with ItemStack outputs.
|
||||||
@Deprecated //Use Ingredient
|
@Deprecated //Use Ingredient
|
||||||
public static boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance){
|
public static boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) {
|
||||||
return methodHandler.addCrusherRecipes(inputs, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance);
|
return methodHandler.addCrusherRecipes(inputs, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param fluidName The name of the fluid to be consumed
|
* @param fluidName The name of the fluid to be consumed
|
||||||
* @param genAmount The amount of energy generated per operation
|
* @param genAmount The amount of energy generated per operation
|
||||||
*/
|
*/
|
||||||
public static void addOilGenRecipe(String fluidName, int genAmount){
|
public static void addOilGenRecipe(String fluidName, int genAmount) {
|
||||||
addOilGenRecipe(fluidName, genAmount, 100);
|
addOilGenRecipe(fluidName, genAmount, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param fluidName The name of the fluid to be consumed
|
* @param fluidName The name of the fluid to be consumed
|
||||||
* @param genAmount The amount of energy generated per operation
|
* @param genAmount The amount of energy generated per operation
|
||||||
*/
|
*/
|
||||||
public static void addOilGenRecipe(String fluidName, int genAmount, int genTime){
|
public static void addOilGenRecipe(String fluidName, int genAmount, int genTime) {
|
||||||
OIL_GENERATOR_RECIPES.add(new OilGenRecipe(fluidName, genAmount, genTime));
|
OIL_GENERATOR_RECIPES.add(new OilGenRecipe(fluidName, genAmount, genTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param outputDisplay The block to display when there is output in the compost
|
* @param outputDisplay The block to display when there is output in the compost
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
|
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
||||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param output The itemstack to be output from the compost once conversion finishes
|
* @param output The itemstack to be output from the compost once conversion finishes
|
||||||
* @param outputDisplay The state to display when there is output in the compost
|
* @param outputDisplay The state to display when there is output in the compost
|
||||||
*/
|
*/
|
||||||
public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay){
|
public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) {
|
||||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param stack The ItemStack to be returned
|
* @param stack The ItemStack to be returned
|
||||||
* @param chance The chance (this is from WeightedRandom.Item)
|
* @param chance The chance (this is from WeightedRandom.Item)
|
||||||
*/
|
*/
|
||||||
public static void addBallOfFurReturnItem(ItemStack stack, int chance){
|
public static void addBallOfFurReturnItem(ItemStack stack, int chance) {
|
||||||
BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
|
BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,16 +239,16 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param minAmount The minimum stacksize of the returned stack
|
* @param minAmount The minimum stacksize of the returned stack
|
||||||
* @param maxAmount The maximum stacksize of the returned stack
|
* @param maxAmount The maximum stacksize of the returned stack
|
||||||
*/
|
*/
|
||||||
public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount){
|
public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount) {
|
||||||
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor){
|
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor){
|
public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,12 +263,12 @@ public final class ActuallyAdditionsAPI{
|
||||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type) {
|
||||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse) {
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,11 +282,11 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
* @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!
|
* 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 addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type){
|
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type) {
|
||||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse) {
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
* @param item The item (or block's item) to add
|
* @param item The item (or block's item) to add
|
||||||
* @param changer The change mechanism
|
* @param changer The change mechanism
|
||||||
*/
|
*/
|
||||||
public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer){
|
public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer) {
|
||||||
RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
|
RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
*
|
*
|
||||||
* @param ingredient The ingredient to add
|
* @param ingredient The ingredient to add
|
||||||
*/
|
*/
|
||||||
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient){
|
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient) {
|
||||||
COFFEE_MACHINE_INGREDIENTS.add(ingredient);
|
COFFEE_MACHINE_INGREDIENTS.add(ingredient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
*
|
*
|
||||||
* @param entry The entry to add
|
* @param entry The entry to add
|
||||||
*/
|
*/
|
||||||
public static void addBookletEntry(IBookletEntry entry){
|
public static void addBookletEntry(IBookletEntry entry) {
|
||||||
BOOKLET_ENTRIES.add(entry);
|
BOOKLET_ENTRIES.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public final class ActuallyAdditionsAPI{
|
||||||
*
|
*
|
||||||
* @param behavior The behavior to add
|
* @param behavior The behavior to add
|
||||||
*/
|
*/
|
||||||
public static void addFarmerBehavior(IFarmerBehavior behavior){
|
public static void addFarmerBehavior(IFarmerBehavior behavior) {
|
||||||
FARMER_BEHAVIORS.add(behavior);
|
FARMER_BEHAVIORS.add(behavior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public interface IBookletChapter{
|
public interface IBookletChapter {
|
||||||
|
|
||||||
IBookletPage[] getAllPages();
|
IBookletPage[] getAllPages();
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
public interface IBookletEntry {
|
||||||
|
|
||||||
public interface IBookletEntry{
|
|
||||||
|
|
||||||
List<IBookletChapter> getAllChapters();
|
List<IBookletChapter> getAllChapters();
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -17,9 +19,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
public interface IBookletPage {
|
||||||
|
|
||||||
public interface IBookletPage{
|
|
||||||
|
|
||||||
void getItemStacksForPage(List<ItemStack> list);
|
void getItemStacksForPage(List<ItemStack> list);
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet.internal;
|
package de.ellpeck.actuallyadditions.api.booklet.internal;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.List;
|
public abstract class GuiBookletBase extends GuiScreen {
|
||||||
|
|
||||||
public abstract class GuiBookletBase extends GuiScreen{
|
|
||||||
|
|
||||||
public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale);
|
public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.util.EnumFacing;
|
||||||
* This is not supposed to be implemented.
|
* This is not supposed to be implemented.
|
||||||
* Can be cast to TileEntity.
|
* Can be cast to TileEntity.
|
||||||
*/
|
*/
|
||||||
public interface IAtomicReconstructor extends IEnergyTile{
|
public interface IAtomicReconstructor extends IEnergyTile {
|
||||||
|
|
||||||
Lens getLens();
|
Lens getLens();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.world.World;
|
||||||
* This is not supposed to be implemented.
|
* This is not supposed to be implemented.
|
||||||
* Can be cast to TileEntity.
|
* Can be cast to TileEntity.
|
||||||
*/
|
*/
|
||||||
public interface IEnergyTile{
|
public interface IEnergyTile {
|
||||||
|
|
||||||
BlockPos getPosition();
|
BlockPos getPosition();
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,18 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.internal;
|
package de.ellpeck.actuallyadditions.api.internal;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a helper interface for IFarmerBehavior.
|
* This is a helper interface for IFarmerBehavior.
|
||||||
* <p>
|
* <p>
|
||||||
* This is not supposed to be implemented.
|
* This is not supposed to be implemented.
|
||||||
* Can be cast to TileEntity.
|
* Can be cast to TileEntity.
|
||||||
*/
|
*/
|
||||||
public interface IFarmer extends IEnergyTile{
|
public interface IFarmer extends IEnergyTile {
|
||||||
|
|
||||||
EnumFacing getOrientation();
|
EnumFacing getOrientation();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
* Use ActuallyAdditionsAPI.methodHandler for calling
|
* Use ActuallyAdditionsAPI.methodHandler for calling
|
||||||
* This is not supposed to be implemented.
|
* This is not supposed to be implemented.
|
||||||
*/
|
*/
|
||||||
public interface IMethodHandler{
|
public interface IMethodHandler {
|
||||||
|
|
||||||
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ public interface IMethodHandler{
|
||||||
boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
||||||
|
|
||||||
boolean invokeReconstructor(IAtomicReconstructor tile);
|
boolean invokeReconstructor(IAtomicReconstructor tile);
|
||||||
|
|
||||||
boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance);
|
boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance);
|
||||||
|
|
||||||
@Deprecated //Use Ingredient input on AA API class
|
@Deprecated //Use Ingredient input on AA API class
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.laser;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public interface IConnectionPair{
|
public interface IConnectionPair {
|
||||||
|
|
||||||
void writeToNBT(NBTTagCompound compound);
|
void writeToNBT(NBTTagCompound compound);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.world.World;
|
||||||
* The network system is built in a way that doesn't need the individual
|
* The network system is built in a way that doesn't need the individual
|
||||||
* positions to be Laser Relays, it relies only on BlockPos
|
* positions to be Laser Relays, it relies only on BlockPos
|
||||||
*/
|
*/
|
||||||
public interface ILaserRelayConnectionHandler{
|
public interface ILaserRelayConnectionHandler {
|
||||||
|
|
||||||
ConcurrentSet<IConnectionPair> getConnectionsFor(BlockPos relay, World world);
|
ConcurrentSet<IConnectionPair> getConnectionsFor(BlockPos relay, World world);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.laser;
|
package de.ellpeck.actuallyadditions.api.laser;
|
||||||
|
|
||||||
public enum LaserType{
|
public enum LaserType {
|
||||||
ENERGY, ITEM, FLUID
|
ENERGY,
|
||||||
|
ITEM,
|
||||||
|
FLUID
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,22 +12,20 @@ package de.ellpeck.actuallyadditions.api.laser;
|
||||||
|
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
|
|
||||||
public class Network{
|
public class Network {
|
||||||
|
|
||||||
public final ConcurrentSet<IConnectionPair> connections = new ConcurrentSet<>();
|
public final ConcurrentSet<IConnectionPair> connections = new ConcurrentSet<>();
|
||||||
public int changeAmount;
|
public int changeAmount;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString() {
|
||||||
return this.connections.toString();
|
return this.connections.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj){
|
public boolean equals(Object obj) {
|
||||||
if(obj instanceof Network){
|
if (obj instanceof Network) {
|
||||||
if(this.connections.equals(((Network)obj).connections)){
|
if (this.connections.equals(((Network) obj).connections)) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return super.equals(obj);
|
return super.equals(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.lens;
|
||||||
/**
|
/**
|
||||||
* This is the base class for a Reconstructor Lens Item
|
* This is the base class for a Reconstructor Lens Item
|
||||||
*/
|
*/
|
||||||
public interface ILensItem{
|
public interface ILensItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the lens type that belongs to this lens item
|
* Returns the lens type that belongs to this lens item
|
||||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
/**
|
/**
|
||||||
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
|
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
|
||||||
*/
|
*/
|
||||||
public abstract class Lens{
|
public abstract class Lens {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes the lens type's behavior on a block
|
* Invokes the lens type's behavior on a block
|
||||||
|
@ -42,7 +42,7 @@ public abstract class Lens{
|
||||||
/**
|
/**
|
||||||
* @return If the lens can be invoked at the current time
|
* @return If the lens can be invoked at the current time
|
||||||
*/
|
*/
|
||||||
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot){
|
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.lens;
|
package de.ellpeck.actuallyadditions.api.lens;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -23,20 +22,20 @@ import net.minecraft.util.math.BlockPos;
|
||||||
* If you want to make a new type of conversion, just use your type in the recipe
|
* 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.
|
* If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion.
|
||||||
*/
|
*/
|
||||||
public class LensConversion extends Lens{
|
public class LensConversion extends Lens {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
||||||
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
|
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] getColor(){
|
public float[] getColor() {
|
||||||
return new float[]{27F/255F, 109F/255F, 1F};
|
return new float[] { 27F / 255F, 109F / 255F, 1F };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDistance(){
|
public int getDistance() {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.misc;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public interface IDisplayStandItem{
|
public interface IDisplayStandItem {
|
||||||
|
|
||||||
boolean update(ItemStack stack, TileEntity tile, int elapsedTicks);
|
boolean update(ItemStack stack, TileEntity tile, int elapsedTicks);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.misc;
|
package de.ellpeck.actuallyadditions.api.misc;
|
||||||
|
|
||||||
public interface IGoggles{
|
public interface IGoggles {
|
||||||
|
|
||||||
boolean displaySpectralMobs();
|
boolean displaySpectralMobs();
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@ package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.WeightedRandom;
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
|
||||||
public class BallOfFurReturn extends WeightedRandom.Item{
|
public class BallOfFurReturn extends WeightedRandom.Item {
|
||||||
|
|
||||||
public final ItemStack returnItem;
|
public final ItemStack returnItem;
|
||||||
|
|
||||||
public BallOfFurReturn(ItemStack returnItem, int chance){
|
public BallOfFurReturn(ItemStack returnItem, int chance) {
|
||||||
super(chance);
|
super(chance);
|
||||||
this.returnItem = returnItem;
|
this.returnItem = returnItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
public class CompostRecipe{
|
public class CompostRecipe {
|
||||||
|
|
||||||
protected final Ingredient input;
|
protected final Ingredient input;
|
||||||
protected final ItemStack output;
|
protected final ItemStack output;
|
||||||
|
@ -27,7 +27,7 @@ public class CompostRecipe{
|
||||||
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay){
|
public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.inputDisplay = inputDisplay;
|
this.inputDisplay = inputDisplay;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
* <p>
|
* <p>
|
||||||
* See ColorLensChangerByDyeMeta for reference.
|
* See ColorLensChangerByDyeMeta for reference.
|
||||||
*/
|
*/
|
||||||
public interface IColorLensChanger{
|
public interface IColorLensChanger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the given item.
|
* Modifies the given item.
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
public class OilGenRecipe{
|
public class OilGenRecipe {
|
||||||
|
|
||||||
public final String fluidName;
|
public final String fluidName;
|
||||||
public final int genAmount;
|
public final int genAmount;
|
||||||
|
@ -22,7 +22,7 @@ public class OilGenRecipe{
|
||||||
* @param genAmount The power generated, in CF/t
|
* @param genAmount The power generated, in CF/t
|
||||||
* @param genTime The length the fluid burns for, in seconds
|
* @param genTime The length the fluid burns for, in seconds
|
||||||
*/
|
*/
|
||||||
public OilGenRecipe(String fluidName, int genAmount, int genTime){
|
public OilGenRecipe(String fluidName, int genAmount, int genTime) {
|
||||||
this.fluidName = fluidName;
|
this.fluidName = fluidName;
|
||||||
this.genAmount = genAmount;
|
this.genAmount = genAmount;
|
||||||
this.genTime = genTime;
|
this.genTime = genTime;
|
||||||
|
|
|
@ -13,13 +13,13 @@ package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.WeightedRandom;
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
|
||||||
public class TreasureChestLoot extends WeightedRandom.Item{
|
public class TreasureChestLoot extends WeightedRandom.Item {
|
||||||
|
|
||||||
public final ItemStack returnItem;
|
public final ItemStack returnItem;
|
||||||
public final int minAmount;
|
public final int minAmount;
|
||||||
public final int maxAmount;
|
public final int maxAmount;
|
||||||
|
|
||||||
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount){
|
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount) {
|
||||||
super(chance);
|
super(chance);
|
||||||
this.returnItem = returnItem;
|
this.returnItem = returnItem;
|
||||||
this.minAmount = minAmount;
|
this.minAmount = minAmount;
|
||||||
|
|
|
@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.api.recipe;
|
||||||
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
|
||||||
public class WeightedOre extends WeightedRandom.Item{
|
public class WeightedOre extends WeightedRandom.Item {
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
||||||
public WeightedOre(String name, int weight){
|
public WeightedOre(String name, int weight) {
|
||||||
super(weight);
|
super(weight);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
/**
|
/**
|
||||||
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector
|
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector
|
||||||
*/
|
*/
|
||||||
public interface IPhantomTile{
|
public interface IPhantomTile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return If the Phantom Tile is currently bound to anything
|
* @return If the Phantom Tile is currently bound to anything
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.ActualCompostModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.ActualCompostModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.CompostModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.CompostModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||||
|
@ -17,17 +20,14 @@ import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
public class ClientRegistryHandler {
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ClientRegistryHandler{
|
|
||||||
|
|
||||||
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
||||||
*/
|
*/
|
||||||
private static void registerCustomFluidBlockRenderer(Fluid fluid){
|
private static void registerCustomFluidBlockRenderer(Fluid fluid) {
|
||||||
Block block = fluid.getBlock();
|
Block block = fluid.getBlock();
|
||||||
Item item = Item.getItemFromBlock(block);
|
Item item = Item.getItemFromBlock(block);
|
||||||
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
||||||
|
@ -37,14 +37,14 @@ public class ClientRegistryHandler{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onModelRegistry(ModelRegistryEvent event){
|
public void onModelRegistry(ModelRegistryEvent event) {
|
||||||
for(Block block : RegistryHandler.BLOCKS_TO_REGISTER){
|
for (Block block : RegistryHandler.BLOCKS_TO_REGISTER) {
|
||||||
if(block instanceof IHasModel){
|
if (block instanceof IHasModel) {
|
||||||
((IHasModel)block).registerRendering();
|
((IHasModel) block).registerRendering();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){
|
for (Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()) {
|
||||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
|
import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
|
||||||
|
@ -15,11 +18,8 @@ import net.minecraftforge.event.RegistryEvent.Register;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
//Class to wrap around the trainwreck that is the new registry system
|
//Class to wrap around the trainwreck that is the new registry system
|
||||||
public class RegistryHandler{
|
public class RegistryHandler {
|
||||||
|
|
||||||
public static final List<Block> BLOCKS_TO_REGISTER = new ArrayList<>();
|
public static final List<Block> BLOCKS_TO_REGISTER = new ArrayList<>();
|
||||||
public static final List<Item> ITEMS_TO_REGISTER = new ArrayList<>();
|
public static final List<Item> ITEMS_TO_REGISTER = new ArrayList<>();
|
||||||
|
@ -27,19 +27,19 @@ public class RegistryHandler{
|
||||||
public static final List<IRecipe> RECIPES_TO_REGISTER = new ArrayList<>();
|
public static final List<IRecipe> RECIPES_TO_REGISTER = new ArrayList<>();
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBlockRegistry(Register<Block> event){
|
public void onBlockRegistry(Register<Block> event) {
|
||||||
InitBlocks.init();
|
InitBlocks.init();
|
||||||
|
|
||||||
for(Block block : BLOCKS_TO_REGISTER){
|
for (Block block : BLOCKS_TO_REGISTER) {
|
||||||
event.getRegistry().register(block);
|
event.getRegistry().register(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onItemRegistry(Register<Item> event){
|
public void onItemRegistry(Register<Item> event) {
|
||||||
InitItems.init();
|
InitItems.init();
|
||||||
|
|
||||||
for(Item item : ITEMS_TO_REGISTER){
|
for (Item item : ITEMS_TO_REGISTER) {
|
||||||
event.getRegistry().register(item);
|
event.getRegistry().register(item);
|
||||||
}
|
}
|
||||||
ITEMS_TO_REGISTER.clear();
|
ITEMS_TO_REGISTER.clear();
|
||||||
|
@ -49,28 +49,28 @@ public class RegistryHandler{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onVillagerRegistry(Register<VillagerProfession> event){
|
public void onVillagerRegistry(Register<VillagerProfession> event) {
|
||||||
InitVillager.init();
|
InitVillager.init();
|
||||||
|
|
||||||
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.jamProfession);
|
if (ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.jamProfession);
|
||||||
if(ConfigBoolValues.ENGINEER_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.engineerProfession);
|
if (ConfigBoolValues.ENGINEER_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.engineerProfession);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onCraftingRegistry(Register<IRecipe> event){
|
public void onCraftingRegistry(Register<IRecipe> event) {
|
||||||
InitCrafting.init();
|
InitCrafting.init();
|
||||||
|
|
||||||
for(IRecipe recipe : RECIPES_TO_REGISTER){
|
for (IRecipe recipe : RECIPES_TO_REGISTER) {
|
||||||
event.getRegistry().register(recipe);
|
event.getRegistry().register(recipe);
|
||||||
}
|
}
|
||||||
RECIPES_TO_REGISTER.clear();
|
RECIPES_TO_REGISTER.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onSoundRegistry(Register<SoundEvent> event){
|
public void onSoundRegistry(Register<SoundEvent> event) {
|
||||||
SoundHandler.init();
|
SoundHandler.init();
|
||||||
|
|
||||||
for(SoundEvent sound : SOUNDS_TO_REGISTER){
|
for (SoundEvent sound : SOUNDS_TO_REGISTER) {
|
||||||
event.getRegistry().register(sound);
|
event.getRegistry().register(sound);
|
||||||
}
|
}
|
||||||
SOUNDS_TO_REGISTER.clear();
|
SOUNDS_TO_REGISTER.clear();
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
@ -47,14 +49,12 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{
|
|
||||||
|
|
||||||
public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
|
public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
|
||||||
public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
|
public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
|
||||||
|
|
||||||
public BlockAtomicReconstructor(String name){
|
public BlockAtomicReconstructor(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(10F);
|
this.setHardness(10F);
|
||||||
|
@ -63,36 +63,33 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
ItemStack heldItem = player.getHeldItem(hand);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos);
|
||||||
if(!world.isRemote){
|
if (reconstructor != null) {
|
||||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(pos);
|
if (StackUtil.isValid(heldItem)) {
|
||||||
if(reconstructor != null){
|
|
||||||
if(StackUtil.isValid(heldItem)){
|
|
||||||
Item item = heldItem.getItem();
|
Item item = heldItem.getItem();
|
||||||
if(item instanceof ILensItem && !StackUtil.isValid(reconstructor.inv.getStackInSlot(0))){
|
if (item instanceof ILensItem && !StackUtil.isValid(reconstructor.inv.getStackInSlot(0))) {
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.setCount(1);
|
toPut.setCount(1);
|
||||||
reconstructor.inv.setStackInSlot(0, toPut);
|
reconstructor.inv.setStackInSlot(0, toPut);
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
}
|
}
|
||||||
//Shush, don't tell anyone!
|
//Shush, don't tell anyone!
|
||||||
else if(ConfigIntValues.ELEVEN.getValue() == 11 && item == Items.RECORD_11){
|
else if (ConfigIntValues.ELEVEN.getValue() == 11 && item == Items.RECORD_11) {
|
||||||
reconstructor.counter++;
|
reconstructor.counter++;
|
||||||
reconstructor.markDirty();
|
reconstructor.markDirty();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
ItemStack slot = reconstructor.inv.getStackInSlot(0);
|
ItemStack slot = reconstructor.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(slot)){
|
if (StackUtil.isValid(slot)) {
|
||||||
player.setHeldItem(hand, slot.copy());
|
player.setHeldItem(hand, slot.copy());
|
||||||
reconstructor.inv.setStackInSlot(0, StackUtil.getEmpty());
|
reconstructor.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||||
}
|
}
|
||||||
|
@ -102,43 +99,41 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int i){
|
public TileEntity createNewTileEntity(World world, int i) {
|
||||||
return new TileEntityAtomicReconstructor();
|
return new TileEntityAtomicReconstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile instanceof TileEntityAtomicReconstructor){
|
if (tile instanceof TileEntityAtomicReconstructor) {
|
||||||
ItemStack slot = ((TileEntityAtomicReconstructor)tile).inv.getStackInSlot(0);
|
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
||||||
String strg;
|
String strg;
|
||||||
if(!StackUtil.isValid(slot)){
|
if (!StackUtil.isValid(slot)) {
|
||||||
strg = StringUtil.localize("info."+ActuallyAdditions.MODID+".noLens");
|
strg = StringUtil.localize("info." + ActuallyAdditions.MODID + ".noLens");
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
strg = slot.getItem().getItemStackDisplayName(slot);
|
strg = slot.getItem().getItemStackDisplayName(slot);
|
||||||
|
|
||||||
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-19, 1F);
|
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth() / 2 + 15, resolution.getScaledHeight() / 2 - 19, 1F);
|
||||||
}
|
}
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-15, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg, resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2 - 15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -146,77 +141,76 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
private long lastSysTime;
|
private long lastSysTime;
|
||||||
private int toPick1;
|
private int toPick1;
|
||||||
private int toPick2;
|
private int toPick2;
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.setHasSubtypes(false);
|
this.setHasSubtypes(false);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
public String getTranslationKey(ItemStack stack) {
|
||||||
return this.getTranslationKey();
|
return this.getTranslationKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(int damage){
|
public int getMetadata(int damage) {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag advanced){
|
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||||
long sysTime = System.currentTimeMillis();
|
long sysTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if(this.lastSysTime+3000 < sysTime){
|
if (this.lastSysTime + 3000 < sysTime) {
|
||||||
this.lastSysTime = sysTime;
|
this.lastSysTime = sysTime;
|
||||||
if(world != null){
|
if (world != null) {
|
||||||
this.toPick1 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_1)+1;
|
this.toPick1 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_1) + 1;
|
||||||
this.toPick2 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_2)+1;
|
this.toPick2 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_2) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String base = "tile."+ActuallyAdditions.MODID+"."+((BlockAtomicReconstructor)this.block).getBaseName()+".info.";
|
String base = "tile." + ActuallyAdditions.MODID + "." + ((BlockAtomicReconstructor) this.block).getBaseName() + ".info.";
|
||||||
tooltip.add(StringUtil.localize(base+"1."+this.toPick1)+" "+StringUtil.localize(base+"2."+this.toPick2));
|
tooltip.add(StringUtil.localize(base + "1." + this.toPick1) + " " + StringUtil.localize(base + "2." + this.toPick2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride(IBlockState state){
|
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos){
|
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos) {
|
||||||
TileEntity t = world.getTileEntity(pos);
|
TileEntity t = world.getTileEntity(pos);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (t instanceof TileEntityAtomicReconstructor) {
|
if (t instanceof TileEntityAtomicReconstructor) {
|
||||||
|
|
|
@ -28,9 +28,9 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockBatteryBox extends BlockContainerBase{
|
public class BlockBatteryBox extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockBatteryBox(String name){
|
public BlockBatteryBox(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -39,32 +39,31 @@ public class BlockBatteryBox extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta){
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityBatteryBox();
|
return new TileEntityBatteryBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBatteryBox){
|
if (tile instanceof TileEntityBatteryBox) {
|
||||||
TileEntityBatteryBox box = (TileEntityBatteryBox)tile;
|
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
if(StackUtil.isValid(stack)){
|
if (StackUtil.isValid(stack)) {
|
||||||
if(stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))){
|
if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) {
|
||||||
box.inv.setStackInSlot(0, stack.copy());
|
box.inv.setStackInSlot(0, stack.copy());
|
||||||
player.setHeldItem(hand, StackUtil.getEmpty());
|
player.setHeldItem(hand, StackUtil.getEmpty());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
ItemStack inSlot = box.inv.getStackInSlot(0);
|
ItemStack inSlot = box.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(inSlot)){
|
if (StackUtil.isValid(inSlot)) {
|
||||||
player.setHeldItem(hand, inSlot.copy());
|
player.setHeldItem(hand, inSlot.copy());
|
||||||
box.inv.setStackInSlot(0, StackUtil.getEmpty());
|
box.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||||
return true;
|
return true;
|
||||||
|
@ -75,12 +74,12 @@ public class BlockBatteryBox extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockBioReactor extends BlockContainerBase{
|
public class BlockBioReactor extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockBioReactor(String name){
|
public BlockBioReactor(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -38,14 +38,14 @@ public class BlockBioReactor extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta){
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
return new TileEntityBioReactor();
|
return new TileEntityBioReactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
if(world.getTileEntity(pos) instanceof TileEntityBioReactor){
|
if (world.getTileEntity(pos) instanceof TileEntityBioReactor) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class BlockBioReactor extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||||
|
|
||||||
public class BlockBlackLotus extends BlockBushBase{
|
public class BlockBlackLotus extends BlockBushBase {
|
||||||
|
|
||||||
public BlockBlackLotus(String name){
|
public BlockBlackLotus(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -33,11 +32,11 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockBreaker extends BlockContainerBase{
|
public class BlockBreaker extends BlockContainerBase {
|
||||||
|
|
||||||
private final boolean isPlacer;
|
private final boolean isPlacer;
|
||||||
|
|
||||||
public BlockBreaker(boolean isPlacer, String name){
|
public BlockBreaker(boolean isPlacer, String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.isPlacer = isPlacer;
|
this.isPlacer = isPlacer;
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -46,20 +45,17 @@ public class BlockBreaker extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
|
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos);
|
||||||
if(!world.isRemote){
|
if (breaker != null) {
|
||||||
TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(pos);
|
|
||||||
if(breaker != null){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -68,12 +64,12 @@ public class BlockBreaker extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.UNCOMMON;
|
return EnumRarity.UNCOMMON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -81,27 +77,27 @@ public class BlockBreaker extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockCanolaPress extends BlockContainerBase{
|
public class BlockCanolaPress extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockCanolaPress(String name){
|
public BlockCanolaPress(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -37,26 +37,26 @@ public class BlockCanolaPress extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityCanolaPress();
|
return new TileEntityCanolaPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos);
|
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
|
||||||
if(press != null){
|
if (press != null) {
|
||||||
if(!this.tryUseItemOnTank(player, hand, press.tank)){
|
if (!this.tryUseItemOnTank(player, hand, press.tank)) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class BlockCanolaPress extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
@ -25,17 +26,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.Mirror;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockCoalGenerator extends BlockContainerBase {
|
||||||
|
|
||||||
public class BlockCoalGenerator extends BlockContainerBase{
|
public BlockCoalGenerator(String name) {
|
||||||
|
|
||||||
public BlockCoalGenerator(String name){
|
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -45,38 +48,38 @@ public class BlockCoalGenerator extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityCoalGenerator();
|
return new TileEntityCoalGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityCoalGenerator){
|
if (tile instanceof TileEntityCoalGenerator) {
|
||||||
if(((TileEntityCoalGenerator)tile).currentBurnTime > 0){
|
if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) {
|
||||||
for(int i = 0; i < 5; i++){
|
for (int i = 0; i < 5; i++) {
|
||||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(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
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(pos);
|
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
|
||||||
if(press != null){
|
if (press != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -85,39 +88,39 @@ public class BlockCoalGenerator extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockCoffeeMachine extends BlockContainerBase{
|
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 AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 1 - 0.0625 * 2, 1 - 0.0625);
|
||||||
|
|
||||||
public BlockCoffeeMachine(String name){
|
public BlockCoffeeMachine(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -47,26 +47,26 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos);
|
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
|
||||||
if(machine != null){
|
if (machine != null) {
|
||||||
if(!this.tryUseItemOnTank(player, hand, machine.tank)){
|
if (!this.tryUseItemOnTank(player, hand, machine.tank)) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,31 +75,30 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta){
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCoffeeMachine();
|
return new TileEntityCoffeeMachine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = MathHelper.floor(player.rotationYaw*4.0F/360.0F+0.5D) & 3;
|
int rotation = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if(rotation == 0){
|
if (rotation == 0) {
|
||||||
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 1){
|
if (rotation == 1) {
|
||||||
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 2){
|
if (rotation == 2) {
|
||||||
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
||||||
}
|
}
|
||||||
if(rotation == 3){
|
if (rotation == 3) {
|
||||||
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,27 +106,27 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
|
@ -38,15 +39,13 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockColoredLamp extends BlockBase {
|
||||||
|
|
||||||
public class BlockColoredLamp extends BlockBase{
|
|
||||||
|
|
||||||
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
||||||
public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
|
public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
|
||||||
public final boolean isOn;
|
public final boolean isOn;
|
||||||
|
|
||||||
public BlockColoredLamp(boolean isOn, String name){
|
public BlockColoredLamp(boolean isOn, String name) {
|
||||||
super(Material.REDSTONE_LIGHT, name);
|
super(Material.REDSTONE_LIGHT, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
|
@ -55,37 +54,37 @@ public class BlockColoredLamp extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state){
|
public int damageDropped(IBlockState state) {
|
||||||
return this.getMetaFromState(state);
|
return this.getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
//Turning On
|
//Turning On
|
||||||
if(hand == EnumHand.MAIN_HAND && stack.isEmpty()){
|
if (hand == EnumHand.MAIN_HAND && stack.isEmpty()) {
|
||||||
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
||||||
world.notifyLightSet(pos);
|
world.notifyLightSet(pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StackUtil.isValid(stack)){
|
if (StackUtil.isValid(stack)) {
|
||||||
//Changing Colors
|
//Changing Colors
|
||||||
int[] oreIDs = OreDictionary.getOreIDs(stack);
|
int[] oreIDs = OreDictionary.getOreIDs(stack);
|
||||||
if(oreIDs.length > 0){
|
if (oreIDs.length > 0) {
|
||||||
for(int oreID : oreIDs){
|
for (int oreID : oreIDs) {
|
||||||
String name = OreDictionary.getOreName(oreID);
|
String name = OreDictionary.getOreName(oreID);
|
||||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||||
if(color != null){
|
if (color != null) {
|
||||||
if(this.getMetaFromState(state) != color.ordinal()){
|
if (this.getMetaFromState(state) != color.ordinal()) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
world.setBlockState(pos, this.getStateFromMeta(color.ordinal()), 2);
|
world.setBlockState(pos, this.getStateFromMeta(color.ordinal()), 2);
|
||||||
if(!player.capabilities.isCreativeMode){
|
if (!player.capabilities.isCreativeMode) {
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,71 +99,67 @@ public class BlockColoredLamp extends BlockBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for(int j = 0; j < ALL_LAMP_TYPES.length; j++){
|
for (int j = 0; j < ALL_LAMP_TYPES.length; j++) {
|
||||||
list.add(new ItemStack(this, 1, j));
|
list.add(new ItemStack(this, 1, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return this.isOn ? 15 : 0;
|
return this.isOn ? 15 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
for(int i = 0; i < ALL_LAMP_TYPES.length; i++){
|
for (int i = 0; i < ALL_LAMP_TYPES.length; i++) {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName()+"="+ALL_LAMP_TYPES[i].regName);
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_LAMP_TYPES[i].regName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, TYPE);
|
return new BlockStateContainer(this, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.setHasSubtypes(true);
|
this.setHasSubtypes(true);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
if(stack.getItemDamage() >= ALL_LAMP_TYPES.length){
|
if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { return StringUtil.BUGGED_ITEM_NAME; }
|
||||||
return StringUtil.BUGGED_ITEM_NAME;
|
if (Util.isClient()) return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" : "");
|
||||||
}
|
|
||||||
if(Util.isClient()) return super.getItemStackDisplayName(stack)+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".onSuffix.desc")+")" : "");
|
|
||||||
else return super.getItemStackDisplayName(stack);
|
else return super.getItemStackDisplayName(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
public String getTranslationKey(ItemStack stack) {
|
||||||
return InitBlocks.blockColoredLamp.getTranslationKey()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName;
|
return InitBlocks.blockColoredLamp.getTranslationKey() + "_" + ALL_LAMP_TYPES[stack.getItemDamage()].regName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
|
import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
@ -37,15 +41,12 @@ import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
|
||||||
|
|
||||||
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem{
|
|
||||||
|
|
||||||
private final TheCrystals crystal;
|
private final TheCrystals crystal;
|
||||||
|
|
||||||
public BlockCrystalCluster(String name, TheCrystals crystal){
|
public BlockCrystalCluster(String name, TheCrystals crystal) {
|
||||||
super(Material.GLASS, name);
|
super(Material.GLASS, name);
|
||||||
this.crystal = crystal;
|
this.crystal = crystal;
|
||||||
|
|
||||||
|
@ -57,89 +58,89 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
||||||
return this.getStateFromMeta(side.ordinal());
|
return this.getStateFromMeta(side.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IBlockColor getBlockColor(){
|
public IBlockColor getBlockColor() {
|
||||||
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer(){
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.TRANSLUCENT;
|
return BlockRenderLayer.TRANSLUCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IItemColor getItemColor(){
|
public IItemColor getItemColor() {
|
||||||
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune){
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
return InitItems.itemCrystalShard;
|
return InitItems.itemCrystalShard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state){
|
public int damageDropped(IBlockState state) {
|
||||||
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return new ItemStack(this);
|
return new ItemStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random){
|
public int quantityDropped(Random random) {
|
||||||
return random.nextInt(5)+2;
|
return random.nextInt(5) + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -32,9 +31,9 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDirectionalBreaker extends BlockContainerBase{
|
public class BlockDirectionalBreaker extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockDirectionalBreaker(String name){
|
public BlockDirectionalBreaker(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -42,20 +41,17 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityDirectionalBreaker();
|
return new TileEntityDirectionalBreaker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker) world.getTileEntity(pos);
|
||||||
if(!world.isRemote){
|
if (breaker != null) {
|
||||||
TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker)world.getTileEntity(pos);
|
|
||||||
if(breaker != null){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DIRECTIONAL_BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DIRECTIONAL_BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,12 +60,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -77,27 +73,27 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class BlockDisplayStand extends BlockContainerBase {
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.setCount(1);
|
toPut.setCount(1);
|
||||||
stand.inv.setStackInSlot(0, toPut);
|
stand.inv.setStackInSlot(0, toPut);
|
||||||
if(!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
||||||
return true;
|
return true;
|
||||||
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
||||||
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||||
|
|
|
@ -31,9 +31,9 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockDropper extends BlockContainerBase{
|
public class BlockDropper extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockDropper(String name){
|
public BlockDropper(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -41,20 +41,17 @@ public class BlockDropper extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityDropper();
|
return new TileEntityDropper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos);
|
||||||
if(!world.isRemote){
|
if (dropper != null) {
|
||||||
TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(pos);
|
|
||||||
if(dropper != null){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DROPPER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DROPPER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -63,12 +60,12 @@ public class BlockDropper extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -76,27 +73,27 @@ public class BlockDropper extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockEmpowerer extends BlockContainerBase{
|
public class BlockEmpowerer extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockEmpowerer(String name){
|
public BlockEmpowerer(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -40,33 +40,32 @@ public class BlockEmpowerer extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta){
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
return new TileEntityEmpowerer();
|
return new TileEntityEmpowerer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
return BlockSlabs.AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
ItemStack heldItem = player.getHeldItem(hand);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityEmpowerer empowerer = (TileEntityEmpowerer)world.getTileEntity(pos);
|
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);
|
||||||
if(empowerer != null){
|
if (empowerer != null) {
|
||||||
ItemStack stackThere = empowerer.inv.getStackInSlot(0);
|
ItemStack stackThere = empowerer.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(heldItem)){
|
if (StackUtil.isValid(heldItem)) {
|
||||||
if(!StackUtil.isValid(stackThere) && TileEntityEmpowerer.isPossibleInput(heldItem)){
|
if (!StackUtil.isValid(stackThere) && TileEntityEmpowerer.isPossibleInput(heldItem)) {
|
||||||
ItemStack toPut = heldItem.copy();
|
ItemStack toPut = heldItem.copy();
|
||||||
toPut.setCount(1);
|
toPut.setCount(1);
|
||||||
empowerer.inv.setStackInSlot(0, toPut);
|
empowerer.inv.setStackInSlot(0, toPut);
|
||||||
if(!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
|
||||||
else if(ItemUtil.canBeStacked(heldItem, stackThere)){
|
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
||||||
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize()-heldItem.getCount());
|
if (maxTransfer > 0) {
|
||||||
if(maxTransfer > 0){
|
|
||||||
player.setHeldItem(hand, StackUtil.grow(heldItem, maxTransfer));
|
player.setHeldItem(hand, StackUtil.grow(heldItem, maxTransfer));
|
||||||
ItemStack newStackThere = stackThere.copy();
|
ItemStack newStackThere = stackThere.copy();
|
||||||
newStackThere = StackUtil.shrink(newStackThere, maxTransfer);
|
newStackThere = StackUtil.shrink(newStackThere, maxTransfer);
|
||||||
|
@ -74,9 +73,8 @@ public class BlockEmpowerer extends BlockContainerBase{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
if (StackUtil.isValid(stackThere)) {
|
||||||
if(StackUtil.isValid(stackThere)){
|
|
||||||
player.setHeldItem(hand, stackThere.copy());
|
player.setHeldItem(hand, stackThere.copy());
|
||||||
empowerer.inv.setStackInSlot(0, StackUtil.getEmpty());
|
empowerer.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||||
return true;
|
return true;
|
||||||
|
@ -84,19 +82,18 @@ public class BlockEmpowerer extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,11 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockEnergizer extends BlockContainerBase{
|
public class BlockEnergizer extends BlockContainerBase {
|
||||||
|
|
||||||
private final boolean isEnergizer;
|
private final boolean isEnergizer;
|
||||||
|
|
||||||
public BlockEnergizer(boolean isEnergizer, String name){
|
public BlockEnergizer(boolean isEnergizer, String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.isEnergizer = isEnergizer;
|
this.isEnergizer = isEnergizer;
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -40,24 +40,22 @@ public class BlockEnergizer extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
|
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
if(this.isEnergizer){
|
if (this.isEnergizer) {
|
||||||
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(pos);
|
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);
|
||||||
if(energizer != null){
|
if (energizer != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
TileEntityEnervator energizer = (TileEntityEnervator) world.getTileEntity(pos);
|
||||||
TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(pos);
|
if (energizer != null) {
|
||||||
if(energizer != null){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +65,7 @@ public class BlockEnergizer extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFarmer extends BlockContainerBase{
|
public class BlockFarmer extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockFarmer(String name){
|
public BlockFarmer(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -41,17 +41,16 @@ public class BlockFarmer extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFarmer();
|
return new TileEntityFarmer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityFarmer farmer = (TileEntityFarmer)world.getTileEntity(pos);
|
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
|
||||||
if(farmer != null){
|
if (farmer != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FARMER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FARMER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -60,39 +59,39 @@ public class BlockFarmer extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFeeder extends BlockContainerBase{
|
public class BlockFeeder extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockFeeder(String name){
|
public BlockFeeder(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
|
@ -36,17 +36,16 @@ public class BlockFeeder extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFeeder();
|
return new TileEntityFeeder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos);
|
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
|
||||||
if(feeder != null){
|
if (feeder != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -55,7 +54,7 @@ public class BlockFeeder extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.UNCOMMON;
|
return EnumRarity.UNCOMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFermentingBarrel extends BlockContainerBase{
|
public class BlockFermentingBarrel extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockFermentingBarrel(String name){
|
public BlockFermentingBarrel(String name) {
|
||||||
super(Material.WOOD, name);
|
super(Material.WOOD, name);
|
||||||
this.setHarvestLevel("axe", 0);
|
this.setHarvestLevel("axe", 0);
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
|
@ -37,26 +37,26 @@ public class BlockFermentingBarrel extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFermentingBarrel();
|
return new TileEntityFermentingBarrel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos);
|
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
|
||||||
if(press != null){
|
if (press != null) {
|
||||||
if(!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)){
|
if (!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class BlockFermentingBarrel extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -27,9 +26,9 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFireworkBox extends BlockContainerBase{
|
public class BlockFireworkBox extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockFireworkBox(String name){
|
public BlockFireworkBox(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -38,13 +37,12 @@ public class BlockFireworkBox extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (!world.isRemote) {
|
||||||
else if(!world.isRemote){
|
TileEntityFireworkBox grinder = (TileEntityFireworkBox) world.getTileEntity(pos);
|
||||||
TileEntityFireworkBox grinder = (TileEntityFireworkBox)world.getTileEntity(pos);
|
if (grinder != null) {
|
||||||
if(grinder != null){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FIREWORK_BOX.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FIREWORK_BOX.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,12 +50,12 @@ public class BlockFireworkBox extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFireworkBox();
|
return new TileEntityFireworkBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFishingNet extends BlockContainerBase{
|
public class BlockFishingNet extends BlockContainerBase {
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
|
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
|
||||||
|
|
||||||
public BlockFishingNet(String name){
|
public BlockFishingNet(String name) {
|
||||||
super(Material.WOOD, name);
|
super(Material.WOOD, name);
|
||||||
this.setHarvestLevel("axe", 0);
|
this.setHarvestLevel("axe", 0);
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
|
@ -36,28 +36,27 @@ public class BlockFishingNet extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFishingNet();
|
return new TileEntityFishingNet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -33,11 +32,11 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFluidCollector extends BlockContainerBase{
|
public class BlockFluidCollector extends BlockContainerBase {
|
||||||
|
|
||||||
private final boolean isPlacer;
|
private final boolean isPlacer;
|
||||||
|
|
||||||
public BlockFluidCollector(boolean isPlacer, String name){
|
public BlockFluidCollector(boolean isPlacer, String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.isPlacer = isPlacer;
|
this.isPlacer = isPlacer;
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -46,21 +45,18 @@ public class BlockFluidCollector extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos);
|
||||||
if(!world.isRemote){
|
if (collector != null) {
|
||||||
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(pos);
|
if (!this.tryUseItemOnTank(player, hand, collector.tank)) {
|
||||||
if(collector != null){
|
|
||||||
if(!this.tryUseItemOnTank(player, hand, collector.tank)){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,12 +66,12 @@ public class BlockFluidCollector extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
|
@ -83,27 +79,27 @@ public class BlockFluidCollector extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||||
|
@ -29,7 +32,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.Mirror;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -37,14 +44,11 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockFurnaceDouble extends BlockContainerBase {
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BlockFurnaceDouble extends BlockContainerBase{
|
|
||||||
|
|
||||||
public static final PropertyBool IS_ON = PropertyBool.create("on");
|
public static final PropertyBool IS_ON = PropertyBool.create("on");
|
||||||
|
|
||||||
public BlockFurnaceDouble(String name){
|
public BlockFurnaceDouble(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -53,27 +57,26 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFurnaceDouble();
|
return new TileEntityFurnaceDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if(state.getValue(IS_ON)){
|
if (state.getValue(IS_ON)) {
|
||||||
for(int i = 0; i < 5; i++){
|
for (int i = 0; i < 5; i++) {
|
||||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(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
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(pos);
|
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
|
||||||
if(furnace != null){
|
if (furnace != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -82,64 +85,64 @@ public class BlockFurnaceDouble extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return state.getValue(IS_ON) ? 12 : 0;
|
return state.getValue(IS_ON) ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.UNCOMMON;
|
return EnumRarity.UNCOMMON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
boolean isOn = meta >= 4;
|
boolean isOn = meta >= 4;
|
||||||
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta-4 : meta);
|
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta - 4 : meta);
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
return state.getValue(IS_ON) ? meta+4 : meta;
|
return state.getValue(IS_ON) ? meta + 4 : meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING, IS_ON);
|
return new BlockStateContainer(this, BlockHorizontal.FACING, IS_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced){
|
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||||
tooltip.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".previouslyDoubleFurnace"));
|
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".previouslyDoubleFurnace"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockFurnaceSolar extends BlockContainerBase{
|
public class BlockFurnaceSolar extends BlockContainerBase {
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6*0.0625, 1);
|
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6 * 0.0625, 1);
|
||||||
|
|
||||||
public BlockFurnaceSolar(String name){
|
public BlockFurnaceSolar(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -36,28 +36,27 @@ public class BlockFurnaceSolar extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityFurnaceSolar();
|
return new TileEntityFurnaceSolar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.UNCOMMON;
|
return EnumRarity.UNCOMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,13 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class BlockGeneric extends BlockBase{
|
public class BlockGeneric extends BlockBase {
|
||||||
|
|
||||||
public BlockGeneric(String name){
|
public BlockGeneric(String name) {
|
||||||
this(name, Material.ROCK, SoundType.STONE, 1.5F, 10.0F, "pickaxe", 0);
|
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){
|
public BlockGeneric(String name, Material material, SoundType sound, float hardness, float resistance, String harvestTool, int harvestLevel) {
|
||||||
super(material, name);
|
super(material, name);
|
||||||
this.setHarvestLevel(harvestTool, harvestLevel);
|
this.setHarvestLevel(harvestTool, harvestLevel);
|
||||||
this.setHardness(hardness);
|
this.setHardness(hardness);
|
||||||
|
@ -31,7 +31,7 @@ public class BlockGeneric extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.COMMON;
|
return EnumRarity.COMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
public class BlockGiantChest extends BlockContainerBase{
|
public class BlockGiantChest extends BlockContainerBase {
|
||||||
|
|
||||||
public final int type;
|
public final int type;
|
||||||
|
|
||||||
public BlockGiantChest(String name, int type){
|
public BlockGiantChest(String name, int type) {
|
||||||
super(Material.WOOD, name);
|
super(Material.WOOD, name);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ public class BlockGiantChest extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
switch(this.type){
|
switch (this.type) {
|
||||||
case 1:
|
case 1:
|
||||||
return new TileEntityGiantChestMedium();
|
return new TileEntityGiantChestMedium();
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -73,20 +73,20 @@ public class BlockGiantChest extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos);
|
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
|
||||||
if(chest != null){
|
if (chest != null) {
|
||||||
chest.fillWithLoot(player);
|
chest.fillWithLoot(player);
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
@ -96,21 +96,21 @@ public class BlockGiantChest extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||||
if(stack.getTagCompound() != null){
|
if (stack.getTagCompound() != null) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityGiantChest){
|
if (tile instanceof TileEntityGiantChest) {
|
||||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
||||||
IItemHandlerModifiable inv = ((TileEntityGiantChest)tile).inv;
|
IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
|
||||||
|
|
||||||
for(int i = 0; i < list.tagCount(); i++){
|
for (int i = 0; i < list.tagCount(); i++) {
|
||||||
NBTTagCompound compound = list.getCompoundTagAt(i);
|
NBTTagCompound compound = list.getCompoundTagAt(i);
|
||||||
if(compound != null && compound.hasKey("id")){
|
if (compound != null && compound.hasKey("id")) {
|
||||||
inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
|
inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,31 +120,30 @@ public class BlockGiantChest extends BlockContainerBase{
|
||||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
super.getDrops(drops, world, pos, state, fortune);
|
super.getDrops(drops, world, pos, state, fortune);
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityGiantChest){
|
if (tile instanceof TileEntityGiantChest) {
|
||||||
ItemStackHandlerAA slots = ((TileEntityGiantChest)tile).inv;
|
ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
|
||||||
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
||||||
if(place >= 0){
|
if (place >= 0) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
for(int i = 0; i < slots.getSlots(); i++){
|
for (int i = 0; i < slots.getSlots(); i++) {
|
||||||
//Destroy the keeper
|
//Destroy the keeper
|
||||||
if(i != place){
|
if (i != place) {
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
if(StackUtil.isValid(slots.getStackInSlot(i))){
|
if (StackUtil.isValid(slots.getStackInSlot(i))) {
|
||||||
slots.getStackInSlot(i).writeToNBT(compound);
|
slots.getStackInSlot(i).writeToNBT(compound);
|
||||||
}
|
}
|
||||||
list.appendTag(compound);
|
list.appendTag(compound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list.tagCount() > 0){
|
if (list.tagCount() > 0) {
|
||||||
ItemStack stackInQuestion = drops.get(0);
|
ItemStack stackInQuestion = drops.get(0);
|
||||||
if(StackUtil.isValid(stackInQuestion)){
|
if (StackUtil.isValid(stackInQuestion)) {
|
||||||
if(stackInQuestion.getTagCompound() == null){
|
if (stackInQuestion.getTagCompound() == null) {
|
||||||
stackInQuestion.setTagCompound(new NBTTagCompound());
|
stackInQuestion.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
stackInQuestion.getTagCompound().setTag("Items", list);
|
stackInQuestion.getTagCompound().setTag("Items", list);
|
||||||
|
@ -161,29 +160,28 @@ public class BlockGiantChest extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced){
|
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||||
int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest)this.block).type : -1;
|
int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1;
|
||||||
if(type == 2){
|
if (type == 2) {
|
||||||
tooltip.add(TextFormatting.ITALIC+StringUtil.localize("container."+ActuallyAdditions.MODID+".giantChestLarge.desc"));
|
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
|
||||||
}
|
} else if (type == 0) {
|
||||||
else if(type == 0){
|
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChest.desc"));
|
||||||
tooltip.add(TextFormatting.ITALIC+StringUtil.localize("container."+ActuallyAdditions.MODID+".giantChest.desc"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getNBTShareTag(ItemStack stack){
|
public NBTTagCompound getNBTShareTag(ItemStack stack) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -32,13 +34,11 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockGrinder extends BlockContainerBase {
|
||||||
|
|
||||||
public class BlockGrinder extends BlockContainerBase{
|
|
||||||
|
|
||||||
private final boolean isDouble;
|
private final boolean isDouble;
|
||||||
|
|
||||||
public BlockGrinder(boolean isDouble, String name){
|
public BlockGrinder(boolean isDouble, String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.isDouble = isDouble;
|
this.isDouble = isDouble;
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -49,28 +49,28 @@ public class BlockGrinder extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
|
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if(state.getValue(BlockFurnaceDouble.IS_ON)){
|
if (state.getValue(BlockFurnaceDouble.IS_ON)) {
|
||||||
for(int i = 0; i < 5; i++){
|
for (int i = 0; i < 5; i++) {
|
||||||
double xRand = rand.nextDouble()/0.75D-0.5D;
|
double xRand = rand.nextDouble() / 0.75D - 0.5D;
|
||||||
double zRand = rand.nextDouble()/0.75D-0.5D;
|
double zRand = rand.nextDouble() / 0.75D - 0.5D;
|
||||||
world.spawnParticle(EnumParticleTypes.CRIT, (double)pos.getX()+0.4F, (double)pos.getY()+0.8F, (double)pos.getZ()+0.4F, xRand, 0.5D, zRand);
|
world.spawnParticle(EnumParticleTypes.CRIT, (double) pos.getX() + 0.4F, (double) pos.getY() + 0.8F, (double) pos.getZ() + 0.4F, xRand, 0.5D, zRand);
|
||||||
}
|
}
|
||||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(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
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(pos);
|
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
|
||||||
if(grinder != null){
|
if (grinder != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,34 +79,33 @@ public class BlockGrinder extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state){
|
public int damageDropped(IBlockState state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
boolean isOn = meta == 1;
|
boolean isOn = meta == 1;
|
||||||
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0;
|
return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockFurnaceDouble.IS_ON);
|
return new BlockStateContainer(this, BlockFurnaceDouble.IS_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockHeatCollector extends BlockContainerBase{
|
public class BlockHeatCollector extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockHeatCollector(String name){
|
public BlockHeatCollector(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(2.5F);
|
this.setHardness(2.5F);
|
||||||
|
@ -29,14 +29,13 @@ public class BlockHeatCollector extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityHeatCollector();
|
return new TileEntityHeatCollector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.UNCOMMON;
|
return EnumRarity.UNCOMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
@ -32,15 +33,13 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockInputter extends BlockContainerBase {
|
||||||
|
|
||||||
public class BlockInputter extends BlockContainerBase{
|
|
||||||
|
|
||||||
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
||||||
|
|
||||||
public final boolean isAdvanced;
|
public final boolean isAdvanced;
|
||||||
|
|
||||||
public BlockInputter(boolean isAdvanced, String name){
|
public BlockInputter(boolean isAdvanced, String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -50,17 +49,16 @@ public class BlockInputter extends BlockContainerBase{
|
||||||
this.isAdvanced = isAdvanced;
|
this.isAdvanced = isAdvanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
|
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(pos);
|
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
|
||||||
if(inputter != null){
|
if (inputter != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -69,52 +67,49 @@ public class BlockInputter extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
private final Random rand = new Random();
|
private final Random rand = new Random();
|
||||||
private long lastSysTime;
|
private long lastSysTime;
|
||||||
private int toPick;
|
private int toPick;
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.setHasSubtypes(false);
|
this.setHasSubtypes(false);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
public String getTranslationKey(ItemStack stack) {
|
||||||
return this.getTranslationKey();
|
return this.getTranslationKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(int damage){
|
public int getMetadata(int damage) {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
if(Util.isClient()) {
|
if (Util.isClient()) {
|
||||||
long sysTime = System.currentTimeMillis();
|
long sysTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if(this.lastSysTime+5000 < sysTime){
|
if (this.lastSysTime + 5000 < sysTime) {
|
||||||
this.lastSysTime = sysTime;
|
this.lastSysTime = sysTime;
|
||||||
this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS)+1;
|
this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return StringUtil.localize(this.getTranslationKey()+".name")+" ("+StringUtil.localize("tile."+ActuallyAdditions.MODID+".block_inputter.add."+this.toPick+".name")+")";
|
return StringUtil.localize(this.getTranslationKey() + ".name") + " (" + StringUtil.localize("tile." + ActuallyAdditions.MODID + ".block_inputter.add." + this.toPick + ".name") + ")";
|
||||||
}
|
} else return super.getItemStackDisplayName(stack);
|
||||||
else return super.getItemStackDisplayName(stack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -28,9 +27,9 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockItemRepairer extends BlockContainerBase{
|
public class BlockItemRepairer extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockItemRepairer(String name){
|
public BlockItemRepairer(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(20.0F);
|
this.setHardness(20.0F);
|
||||||
|
@ -39,17 +38,16 @@ public class BlockItemRepairer extends BlockContainerBase{
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityItemRepairer();
|
return new TileEntityItemRepairer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos);
|
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
|
||||||
if(repairer != null){
|
if (repairer != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -58,12 +56,12 @@ public class BlockItemRepairer extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
|
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockItemViewer extends BlockContainerBase{
|
public class BlockItemViewer extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockItemViewer(String name){
|
public BlockItemViewer(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -30,12 +30,12 @@ public class BlockItemViewer extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta){
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
return new TileEntityItemViewer();
|
return new TileEntityItemViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
|
||||||
import net.minecraft.block.properties.PropertyDirection;
|
import net.minecraft.block.properties.PropertyDirection;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
@ -28,10 +30,8 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
|
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
|
||||||
public class BlockItemViewerHopping extends BlockItemViewer{
|
public class BlockItemViewerHopping extends BlockItemViewer {
|
||||||
|
|
||||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.UP);
|
public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.UP);
|
||||||
|
|
||||||
|
@ -41,18 +41,18 @@ public class BlockItemViewerHopping extends BlockItemViewer{
|
||||||
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||||
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
||||||
|
|
||||||
public BlockItemViewerHopping(String name){
|
public BlockItemViewerHopping(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return FULL_BLOCK_AABB;
|
return FULL_BLOCK_AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool){
|
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
||||||
|
@ -61,64 +61,64 @@ public class BlockItemViewerHopping extends BlockItemViewer{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta){
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
return new TileEntityItemViewerHopping();
|
return new TileEntityItemViewerHopping();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
|
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||||
EnumFacing opp = facing.getOpposite();
|
EnumFacing opp = facing.getOpposite();
|
||||||
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override //was isFullyOpaque, not sure if correct change.
|
@Override //was isFullyOpaque, not sure if correct change.
|
||||||
public boolean isNormalCube(IBlockState state){
|
public boolean isNormalCube(IBlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
|
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer(){
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(FACING).getIndex();
|
return state.getValue(FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, FACING);
|
return new BlockStateContainer(this, FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||||
|
@ -28,12 +30,9 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class BlockLampPowerer extends BlockBase {
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockLampPowerer extends BlockBase{
|
public BlockLampPowerer(String name) {
|
||||||
|
|
||||||
public BlockLampPowerer(String name){
|
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -42,43 +41,42 @@ public class BlockLampPowerer extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos){
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||||
this.updateLamp(worldIn, pos);
|
this.updateLamp(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
|
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||||
this.updateLamp(world, pos);
|
this.updateLamp(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLamp(World world, BlockPos pos){
|
private void updateLamp(World world, BlockPos pos) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
||||||
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready){
|
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if(block instanceof BlockColoredLamp){
|
if (block instanceof BlockColoredLamp) {
|
||||||
boolean isOn = ((BlockColoredLamp) block).isOn;
|
boolean isOn = ((BlockColoredLamp) block).isOn;
|
||||||
if(powered){
|
if (powered) {
|
||||||
if(!isOn){
|
if (!isOn) {
|
||||||
world.setBlockState(pos, InitBlocks.blockColoredLampOn.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
world.setBlockState(pos, InitBlocks.blockColoredLampOn.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
if (isOn) {
|
||||||
if(isOn){
|
|
||||||
world.setBlockState(pos, InitBlocks.blockColoredLamp.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
world.setBlockState(pos, InitBlocks.blockColoredLamp.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,10 +85,10 @@ public class BlockLampPowerer extends BlockBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSurrounding(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready){
|
private void updateSurrounding(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
||||||
for(EnumFacing side : EnumFacing.values()){
|
for (EnumFacing side : EnumFacing.values()) {
|
||||||
BlockPos offset = pos.offset(side);
|
BlockPos offset = pos.offset(side);
|
||||||
if(!updatedAlready.contains(offset)){
|
if (!updatedAlready.contains(offset)) {
|
||||||
updatedAlready.add(pos);
|
updatedAlready.add(pos);
|
||||||
this.updateLampsAtPos(world, offset, powered, updatedAlready);
|
this.updateLampsAtPos(world, offset, powered, updatedAlready);
|
||||||
}
|
}
|
||||||
|
@ -98,32 +96,32 @@ public class BlockLampPowerer extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.BlockDirectional;
|
import net.minecraft.block.BlockDirectional;
|
||||||
|
@ -52,20 +58,20 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
//This took way too much fiddling around. I'm not good with numbers.
|
//This took way too much fiddling around. I'm not good with numbers.
|
||||||
private static final float F = 1/16F;
|
private static final float F = 1 / 16F;
|
||||||
private static final AxisAlignedBB AABB_UP = new AxisAlignedBB(2*F, 0, 2*F, 1-2*F, 10*F, 1-2*F);
|
private static final AxisAlignedBB AABB_UP = new AxisAlignedBB(2 * F, 0, 2 * F, 1 - 2 * F, 10 * F, 1 - 2 * F);
|
||||||
private static final AxisAlignedBB AABB_DOWN = new AxisAlignedBB(2*F, 6*F, 2*F, 1-2*F, 1, 1-2*F);
|
private static final AxisAlignedBB AABB_DOWN = new AxisAlignedBB(2 * F, 6 * F, 2 * F, 1 - 2 * F, 1, 1 - 2 * F);
|
||||||
private static final AxisAlignedBB AABB_NORTH = new AxisAlignedBB(2*F, 2*F, 6*F, 1-2*F, 1-2*F, 1);
|
private static final AxisAlignedBB AABB_NORTH = new AxisAlignedBB(2 * F, 2 * F, 6 * F, 1 - 2 * F, 1 - 2 * F, 1);
|
||||||
private static final AxisAlignedBB AABB_EAST = new AxisAlignedBB(0, 2*F, 2*F, 1-6*F, 1-2*F, 1-2*F);
|
private static final AxisAlignedBB AABB_EAST = new AxisAlignedBB(0, 2 * F, 2 * F, 1 - 6 * F, 1 - 2 * F, 1 - 2 * F);
|
||||||
private static final AxisAlignedBB AABB_SOUTH = new AxisAlignedBB(2*F, 2*F, 0, 1-2*F, 1-2*F, 1-6*F);
|
private static final AxisAlignedBB AABB_SOUTH = new AxisAlignedBB(2 * F, 2 * F, 0, 1 - 2 * F, 1 - 2 * F, 1 - 6 * F);
|
||||||
private static final AxisAlignedBB AABB_WEST = new AxisAlignedBB(6*F, 2*F, 2*F, 1, 1-2*F, 1-2*F);
|
private static final AxisAlignedBB AABB_WEST = new AxisAlignedBB(6 * F, 2 * F, 2 * F, 1, 1 - 2 * F, 1 - 2 * F);
|
||||||
|
|
||||||
private final Type type;
|
private final Type type;
|
||||||
|
|
||||||
public BlockLaserRelay(String name, Type type){
|
public BlockLaserRelay(String name, Type type) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -74,22 +80,22 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
if(this.type.ordinal() == 0){
|
if (this.type.ordinal() == 0) {
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event){
|
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
ItemStack stack = event.getItemStack();
|
ItemStack stack = event.getItemStack();
|
||||||
BlockPos pos = event.getPos();
|
BlockPos pos = event.getPos();
|
||||||
|
|
||||||
if(player != null && world != null && StackUtil.isValid(stack) && pos != null){
|
if (player != null && world != null && StackUtil.isValid(stack) && pos != null) {
|
||||||
IBlockState state = event.getWorld().getBlockState(pos);
|
IBlockState state = event.getWorld().getBlockState(pos);
|
||||||
if(state != null && state.getBlock() instanceof BlockLaserRelay){
|
if (state != null && state.getBlock() instanceof BlockLaserRelay) {
|
||||||
if(player.isSneaking()){
|
if (player.isSneaking()) {
|
||||||
event.setUseBlock(Event.Result.ALLOW);
|
event.setUseBlock(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,8 +103,8 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
switch(this.getMetaFromState(state)){
|
switch (this.getMetaFromState(state)) {
|
||||||
case 1:
|
case 1:
|
||||||
return AABB_UP;
|
return AABB_UP;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -115,67 +121,66 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
||||||
return this.getStateFromMeta(side.ordinal());
|
return this.getStateFromMeta(side.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
return state.getValue(BlockDirectional.FACING).getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
return new BlockStateContainer(this, BlockDirectional.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityLaserRelay){
|
if (tile instanceof TileEntityLaserRelay) {
|
||||||
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
TileEntityLaserRelay relay = (TileEntityLaserRelay) tile;
|
||||||
|
|
||||||
if(StackUtil.isValid(stack)){
|
if (StackUtil.isValid(stack)) {
|
||||||
if(stack.getItem() instanceof ItemLaserWrench){
|
if (stack.getItem() instanceof ItemLaserWrench) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (stack.getItem() == ConfigValues.itemCompassConfigurator) {
|
||||||
else if(stack.getItem() == ConfigValues.itemCompassConfigurator){
|
if (!world.isRemote) {
|
||||||
if(!world.isRemote){
|
|
||||||
relay.onCompassAction(player);
|
relay.onCompassAction(player);
|
||||||
|
|
||||||
Network network = relay.getNetwork();
|
Network network = relay.getNetwork();
|
||||||
if(network != null){
|
if (network != null) {
|
||||||
network.changeAmount++;
|
network.changeAmount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,12 +189,11 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (stack.getItem() instanceof ItemLaserRelayUpgrade) {
|
||||||
else if(stack.getItem() instanceof ItemLaserRelayUpgrade){
|
|
||||||
ItemStack inRelay = relay.inv.getStackInSlot(0);
|
ItemStack inRelay = relay.inv.getStackInSlot(0);
|
||||||
if(!StackUtil.isValid(inRelay)){
|
if (!StackUtil.isValid(inRelay)) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
if(!player.isCreative()){
|
if (!player.isCreative()) {
|
||||||
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,13 +207,13 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.isSneaking()){
|
if (player.isSneaking()) {
|
||||||
ItemStack inRelay = relay.inv.getStackInSlot(0).copy();
|
ItemStack inRelay = relay.inv.getStackInSlot(0).copy();
|
||||||
if(StackUtil.isValid(inRelay)){
|
if (StackUtil.isValid(inRelay)) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
relay.inv.setStackInSlot(0, StackUtil.getEmpty());
|
relay.inv.setStackInSlot(0, StackUtil.getEmpty());
|
||||||
|
|
||||||
if(!player.inventory.addItemStackToInventory(inRelay)){
|
if (!player.inventory.addItemStackToInventory(inRelay)) {
|
||||||
player.entityDropItem(inRelay, 0);
|
player.entityDropItem(inRelay, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,8 +221,8 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(relay instanceof TileEntityLaserRelayItemWhitelist){
|
if (relay instanceof TileEntityLaserRelayItemWhitelist) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.LASER_RELAY_ITEM_WHITELIST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.LASER_RELAY_ITEM_WHITELIST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -228,8 +232,8 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int i){
|
public TileEntity createNewTileEntity(World world, int i) {
|
||||||
switch(this.type){
|
switch (this.type) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
return new TileEntityLaserRelayItem();
|
return new TileEntityLaserRelayItem();
|
||||||
case ITEM_WHITELIST:
|
case ITEM_WHITELIST:
|
||||||
|
@ -247,28 +251,27 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
if(posHit != null && posHit.getBlockPos() != null && minecraft.world != null){
|
if (posHit != null && posHit.getBlockPos() != null && minecraft.world != null) {
|
||||||
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
||||||
if(wearing || StackUtil.isValid(stack)){
|
if (wearing || StackUtil.isValid(stack)) {
|
||||||
boolean compass = stack.getItem() == ConfigValues.itemCompassConfigurator;
|
boolean compass = stack.getItem() == ConfigValues.itemCompassConfigurator;
|
||||||
if(wearing || compass || stack.getItem() instanceof ItemLaserWrench){
|
if (wearing || compass || stack.getItem() instanceof ItemLaserWrench) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile instanceof TileEntityLaserRelay){
|
if (tile instanceof TileEntityLaserRelay) {
|
||||||
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
TileEntityLaserRelay relay = (TileEntityLaserRelay) tile;
|
||||||
|
|
||||||
String strg = relay.getExtraDisplayString();
|
String strg = relay.getExtraDisplayString();
|
||||||
minecraft.fontRenderer.drawStringWithShadow(strg, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(strg, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
|
|
||||||
String expl;
|
String expl;
|
||||||
if(compass){
|
if (compass) {
|
||||||
expl = relay.getCompassDisplayString();
|
expl = relay.getCompassDisplayString();
|
||||||
}
|
} else {
|
||||||
else{
|
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getTranslationKey() + ".name"));
|
||||||
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ActuallyAdditions.MODID+".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getTranslationKey()+".name"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringUtil.drawSplitString(minecraft.fontRenderer, expl, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);
|
StringUtil.drawSplitString(minecraft.fontRenderer, expl, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,7 +279,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
|
|
||||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
||||||
|
@ -287,7 +290,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
return BlockFaceShape.UNDEFINED;
|
return BlockFaceShape.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type{
|
public enum Type {
|
||||||
ENERGY_BASIC,
|
ENERGY_BASIC,
|
||||||
ENERGY_ADVANCED,
|
ENERGY_ADVANCED,
|
||||||
ENERGY_EXTREME,
|
ENERGY_EXTREME,
|
||||||
|
|
|
@ -27,9 +27,9 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay{
|
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
public BlockLavaFactoryController(String name){
|
public BlockLavaFactoryController(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(4.5F);
|
this.setHardness(4.5F);
|
||||||
|
@ -37,28 +37,26 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityLavaFactoryController();
|
return new TileEntityLavaFactoryController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(factory != null){
|
if (factory != null) {
|
||||||
int state = factory.isMultiblock();
|
int state = factory.isMultiblock();
|
||||||
if(state == TileEntityLavaFactoryController.NOT_MULTI){
|
if (state == TileEntityLavaFactoryController.NOT_MULTI) {
|
||||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".factory.notPart.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".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) {
|
||||||
else if(state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA){
|
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".factory.works.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockLeafGenerator extends BlockContainerBase{
|
public class BlockLeafGenerator extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockLeafGenerator(String name){
|
public BlockLeafGenerator(String name) {
|
||||||
super(Material.IRON, name);
|
super(Material.IRON, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(5.0F);
|
this.setHardness(5.0F);
|
||||||
|
@ -29,14 +29,13 @@ public class BlockLeafGenerator extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.METAL);
|
this.setSoundType(SoundType.METAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityLeafGenerator();
|
return new TileEntityLeafGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -33,9 +32,9 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
public BlockMiner(String name){
|
public BlockMiner(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(8F);
|
this.setHardness(8F);
|
||||||
|
@ -44,15 +43,15 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityMiner){
|
if (tile instanceof TileEntityMiner) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.MINER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.MINER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,24 +59,23 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int i){
|
public TileEntity createNewTileEntity(World world, int i) {
|
||||||
return new TileEntityMiner();
|
return new TileEntityMiner();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile instanceof TileEntityMiner){
|
if (tile instanceof TileEntityMiner) {
|
||||||
TileEntityMiner miner = (TileEntityMiner)tile;
|
TileEntityMiner miner = (TileEntityMiner) tile;
|
||||||
String info = miner.checkY == 0 ? "Done Mining!" : miner.checkY == -1 ? "Calculating positions..." : "Mining at "+(miner.getPos().getX()+miner.checkX)+", "+miner.checkY+", "+(miner.getPos().getZ()+miner.checkZ)+".";
|
String info = miner.checkY == 0 ? "Done Mining!" : miner.checkY == -1 ? "Calculating positions..." : "Mining at " + (miner.getPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getPos().getZ() + miner.checkZ) + ".";
|
||||||
minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-20, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,12 +25,12 @@ import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
|
|
||||||
public class BlockMisc extends BlockBase{
|
public class BlockMisc extends BlockBase {
|
||||||
|
|
||||||
public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
|
public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
|
||||||
public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
|
public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
|
||||||
|
|
||||||
public BlockMisc(String name){
|
public BlockMisc(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
this.setResistance(10.0F);
|
this.setResistance(10.0F);
|
||||||
|
@ -38,66 +38,65 @@ public class BlockMisc extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state){
|
public int damageDropped(IBlockState state) {
|
||||||
return this.getMetaFromState(state);
|
return this.getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for(int j = 0; j < ALL_MISC_BLOCKS.length; j++){
|
for (int j = 0; j < ALL_MISC_BLOCKS.length; j++) {
|
||||||
list.add(new ItemStack(this, 1, j));
|
list.add(new ItemStack(this, 1, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
for(int i = 0; i < ALL_MISC_BLOCKS.length; i++){
|
for (int i = 0; i < ALL_MISC_BLOCKS.length; i++) {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName()+"="+ALL_MISC_BLOCKS[i].name);
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_MISC_BLOCKS[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? EnumRarity.COMMON : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
|
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? EnumRarity.COMMON : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, TYPE);
|
return new BlockStateContainer(this, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.setHasSubtypes(true);
|
this.setHasSubtypes(true);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
public String getTranslationKey(ItemStack stack) {
|
||||||
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_MISC_BLOCKS[stack.getItemDamage()].name;
|
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_MISC_BLOCKS[stack.getItemDamage()].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemBurnTime(ItemStack stack) {
|
public int getItemBurnTime(ItemStack stack) {
|
||||||
if(stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) return 16000;
|
if (stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) return 16000;
|
||||||
return super.getItemBurnTime(stack);
|
return super.getItemBurnTime(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
@ -25,17 +26,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.Mirror;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockOilGenerator extends BlockContainerBase {
|
||||||
|
|
||||||
public class BlockOilGenerator extends BlockContainerBase{
|
public BlockOilGenerator(String name) {
|
||||||
|
|
||||||
public BlockOilGenerator(String name){
|
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -45,39 +48,39 @@ public class BlockOilGenerator extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityOilGenerator();
|
return new TileEntityOilGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityOilGenerator){
|
if (tile instanceof TileEntityOilGenerator) {
|
||||||
if(((TileEntityOilGenerator)tile).currentBurnTime > 0){
|
if (((TileEntityOilGenerator) tile).currentBurnTime > 0) {
|
||||||
for(int i = 0; i < 5; i++){
|
for (int i = 0; i < 5; i++) {
|
||||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(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
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
|
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos);
|
||||||
if(generator != null){
|
if (generator != null) {
|
||||||
if(!this.tryUseItemOnTank(player, hand, generator.tank)){
|
if (!this.tryUseItemOnTank(player, hand, generator.tank)) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,39 +90,39 @@ public class BlockOilGenerator extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,12 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
|
@ -38,11 +43,11 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
public final Type type;
|
public final Type type;
|
||||||
|
|
||||||
public BlockPhantom(Type type, String name){
|
public BlockPhantom(Type type, String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
|
@ -52,40 +57,36 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvidePower(IBlockState state){
|
public boolean canProvidePower(IBlockState state) {
|
||||||
return this.type == Type.REDSTONEFACE;
|
return this.type == Type.REDSTONEFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side){
|
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
if(this.type == Type.REDSTONEFACE){
|
if (this.type == Type.REDSTONEFACE) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityPhantomRedstoneface){
|
if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; }
|
||||||
return ((TileEntityPhantomRedstoneface)tile).providesWeak[side.ordinal()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side){
|
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
if(this.type == Type.REDSTONEFACE){
|
if (this.type == Type.REDSTONEFACE) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityPhantomRedstoneface){
|
if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; }
|
||||||
return ((TileEntityPhantomRedstoneface)tile).providesStrong[side.ordinal()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldDropInventory(World world, BlockPos pos){
|
public boolean shouldDropInventory(World world, BlockPos pos) {
|
||||||
return this.type == Type.PLACER || this.type == Type.BREAKER;
|
return this.type == Type.PLACER || this.type == Type.BREAKER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
switch(this.type){
|
switch (this.type) {
|
||||||
case PLACER:
|
case PLACER:
|
||||||
return new TileEntityPhantomPlacer();
|
return new TileEntityPhantomPlacer();
|
||||||
case BREAKER:
|
case BREAKER:
|
||||||
|
@ -102,55 +103,51 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
|
||||||
if(!world.isRemote){
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof IPhantomTile && ((IPhantomTile)tile).getGuiID() != -1){
|
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, ((IPhantomTile)tile).getGuiID(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, ((IPhantomTile) tile).getGuiID(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile != null){
|
if (tile != null) {
|
||||||
if(tile instanceof IPhantomTile){
|
if (tile instanceof IPhantomTile) {
|
||||||
IPhantomTile phantom = (IPhantomTile)tile;
|
IPhantomTile phantom = (IPhantomTile) tile;
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 40, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
if(phantom.hasBoundPosition()){
|
if (phantom.hasBoundPosition()) {
|
||||||
int distance = MathHelper.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())));
|
int distance = MathHelper.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())));
|
||||||
IBlockState state = minecraft.world.getBlockState(phantom.getBoundPosition());
|
IBlockState state = minecraft.world.getBlockState(phantom.getBoundPosition());
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
Item item = Item.getItemFromBlock(block);
|
Item item = Item.getItemFromBlock(block);
|
||||||
String name = item == null ? "Something Unrecognizable" : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state)));
|
String name = item == null ? "Something Unrecognizable" : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state)));
|
||||||
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip."+ActuallyAdditions.MODID+".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);
|
StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".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()){
|
if (phantom.isBoundThingInRange()) {
|
||||||
StringUtil.drawSplitString(minecraft.fontRenderer, TextFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
StringUtil.drawSplitString(minecraft.fontRenderer, TextFormatting.DARK_GREEN + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||||
|
} else {
|
||||||
|
StringUtil.drawSplitString(minecraft.fontRenderer, TextFormatting.DARK_RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||||
}
|
}
|
||||||
else{
|
} else {
|
||||||
StringUtil.drawSplitString(minecraft.fontRenderer, TextFormatting.DARK_RED+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
|
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 25, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.RED+StringUtil.localize("tooltip."+ActuallyAdditions.MODID+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type{
|
public enum Type {
|
||||||
FACE,
|
FACE,
|
||||||
PLACER,
|
PLACER,
|
||||||
BREAKER,
|
BREAKER,
|
||||||
|
|
|
@ -23,11 +23,11 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockPhantomBooster extends BlockContainerBase{
|
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);
|
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){
|
public BlockPhantomBooster(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -36,28 +36,27 @@ public class BlockPhantomBooster extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return AABB;
|
return AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int i){
|
public TileEntity createNewTileEntity(World world, int i) {
|
||||||
return new TileEntityPhantomBooster();
|
return new TileEntityPhantomBooster();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,9 +30,9 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay{
|
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {
|
||||||
|
|
||||||
public BlockPlayerInterface(String name){
|
public BlockPlayerInterface(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(4.5F);
|
this.setHardness(4.5F);
|
||||||
|
@ -41,21 +41,21 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityPlayerInterface();
|
return new TileEntityPlayerInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityPlayerInterface){
|
if (tile instanceof TileEntityPlayerInterface) {
|
||||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface)tile;
|
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
||||||
if(face.connectedPlayer == null){
|
if (face.connectedPlayer == null) {
|
||||||
face.connectedPlayer = player.getUniqueID();
|
face.connectedPlayer = player.getUniqueID();
|
||||||
face.playerName = player.getName();
|
face.playerName = player.getName();
|
||||||
face.markDirty();
|
face.markDirty();
|
||||||
|
@ -68,14 +68,14 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile != null){
|
if (tile != null) {
|
||||||
if(tile instanceof TileEntityPlayerInterface){
|
if (tile instanceof TileEntityPlayerInterface) {
|
||||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface)tile;
|
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
||||||
String name = face.playerName == null ? "Unknown" : face.playerName;
|
String name = face.playerName == null ? "Unknown" : face.playerName;
|
||||||
minecraft.fontRenderer.drawStringWithShadow("Bound to: "+TextFormatting.RED+name, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow("Bound to: " + TextFormatting.RED + name, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
minecraft.fontRenderer.drawStringWithShadow("UUID: "+TextFormatting.DARK_GREEN+face.connectedPlayer, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
|
minecraft.fontRenderer.drawStringWithShadow("UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockRangedCollector extends BlockContainerBase{
|
public class BlockRangedCollector extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockRangedCollector(String name){
|
public BlockRangedCollector(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
|
@ -36,20 +36,17 @@ public class BlockRangedCollector extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityRangedCollector();
|
return new TileEntityRangedCollector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(this.tryToggleRedstone(world, pos, player)){
|
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
||||||
return true;
|
if (!world.isRemote) {
|
||||||
}
|
TileEntityRangedCollector breaker = (TileEntityRangedCollector) world.getTileEntity(pos);
|
||||||
if(!world.isRemote){
|
if (breaker != null) {
|
||||||
TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos);
|
|
||||||
if(breaker != null){
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.RANGED_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.RANGED_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -58,7 +55,7 @@ public class BlockRangedCollector extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
|
@ -24,13 +28,9 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.world.ExplosionEvent;
|
import net.minecraftforge.event.world.ExplosionEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class BlockShockSuppressor extends BlockContainerBase {
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockShockSuppressor extends BlockContainerBase{
|
public BlockShockSuppressor(String name) {
|
||||||
|
|
||||||
public BlockShockSuppressor(String name){
|
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(20.0F);
|
this.setHardness(20.0F);
|
||||||
|
@ -41,29 +41,29 @@ public class BlockShockSuppressor extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onExplosion(ExplosionEvent.Detonate event){
|
public void onExplosion(ExplosionEvent.Detonate event) {
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
List<BlockPos> affectedBlocks = event.getAffectedBlocks();
|
List<BlockPos> affectedBlocks = event.getAffectedBlocks();
|
||||||
List<Entity> affectedEntities = event.getAffectedEntities();
|
List<Entity> affectedEntities = event.getAffectedEntities();
|
||||||
|
|
||||||
int rangeSq = TileEntityShockSuppressor.RANGE*TileEntityShockSuppressor.RANGE;
|
int rangeSq = TileEntityShockSuppressor.RANGE * TileEntityShockSuppressor.RANGE;
|
||||||
int use = TileEntityShockSuppressor.USE_PER;
|
int use = TileEntityShockSuppressor.USE_PER;
|
||||||
|
|
||||||
for(TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS){
|
for (TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS) {
|
||||||
if(!suppressor.isRedstonePowered){
|
if (!suppressor.isRedstonePowered) {
|
||||||
BlockPos supPos = suppressor.getPos();
|
BlockPos supPos = suppressor.getPos();
|
||||||
|
|
||||||
List<Entity> entitiesToRemove = new ArrayList<>();
|
List<Entity> entitiesToRemove = new ArrayList<>();
|
||||||
List<BlockPos> posesToRemove = new ArrayList<>();
|
List<BlockPos> posesToRemove = new ArrayList<>();
|
||||||
|
|
||||||
for(BlockPos pos : affectedBlocks){
|
for (BlockPos pos : affectedBlocks) {
|
||||||
if(pos.distanceSq(supPos) <= rangeSq){
|
if (pos.distanceSq(supPos) <= rangeSq) {
|
||||||
posesToRemove.add(pos);
|
posesToRemove.add(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Entity entity : affectedEntities){
|
for (Entity entity : affectedEntities) {
|
||||||
if(entity.getPositionVector().squareDistanceTo(supPos.getX(), supPos.getY(), supPos.getZ()) <= rangeSq){
|
if (entity.getPositionVector().squareDistanceTo(supPos.getX(), supPos.getY(), supPos.getZ()) <= rangeSq) {
|
||||||
entitiesToRemove.add(entity);
|
entitiesToRemove.add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,21 +71,19 @@ public class BlockShockSuppressor extends BlockContainerBase{
|
||||||
Collections.shuffle(entitiesToRemove);
|
Collections.shuffle(entitiesToRemove);
|
||||||
Collections.shuffle(posesToRemove);
|
Collections.shuffle(posesToRemove);
|
||||||
|
|
||||||
for(BlockPos pos : posesToRemove){
|
for (BlockPos pos : posesToRemove) {
|
||||||
if(suppressor.storage.getEnergyStored() >= use){
|
if (suppressor.storage.getEnergyStored() >= use) {
|
||||||
suppressor.storage.extractEnergyInternal(use, false);
|
suppressor.storage.extractEnergyInternal(use, false);
|
||||||
affectedBlocks.remove(pos);
|
affectedBlocks.remove(pos);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Entity entity : entitiesToRemove){
|
for (Entity entity : entitiesToRemove) {
|
||||||
if(suppressor.storage.getEnergyStored() >= use){
|
if (suppressor.storage.getEnergyStored() >= use) {
|
||||||
suppressor.storage.extractEnergyInternal(use, false);
|
suppressor.storage.extractEnergyInternal(use, false);
|
||||||
affectedEntities.remove(entity);
|
affectedEntities.remove(entity);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,12 +93,12 @@ public class BlockShockSuppressor extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta){
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
return new TileEntityShockSuppressor();
|
return new TileEntityShockSuppressor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,18 +33,18 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockSlabs extends BlockBase{
|
public class BlockSlabs extends BlockBase {
|
||||||
|
|
||||||
public static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
|
public 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 AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||||
|
|
||||||
private final IBlockState fullBlockState;
|
private final IBlockState fullBlockState;
|
||||||
|
|
||||||
public BlockSlabs(String name, Block fullBlock){
|
public BlockSlabs(String name, Block fullBlock) {
|
||||||
this(name, fullBlock.getDefaultState());
|
this(name, fullBlock.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockSlabs(String name, IBlockState fullBlockState){
|
public BlockSlabs(String name, IBlockState fullBlockState) {
|
||||||
super(fullBlockState.getMaterial(), name);
|
super(fullBlockState.getMaterial(), name);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
this.setResistance(10.0F);
|
this.setResistance(10.0F);
|
||||||
|
@ -52,79 +52,75 @@ public class BlockSlabs extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||||
if(facing.ordinal() == 1){
|
if (facing.ordinal() == 1) { return this.getStateFromMeta(meta); }
|
||||||
return this.getStateFromMeta(meta);
|
if (facing.ordinal() == 0 || hitY >= 0.5F) { return this.getStateFromMeta(meta + 1); }
|
||||||
}
|
|
||||||
if(facing.ordinal() == 0 || hitY >= 0.5F){
|
|
||||||
return this.getStateFromMeta(meta+1);
|
|
||||||
}
|
|
||||||
return this.getStateFromMeta(meta);
|
return this.getStateFromMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
|
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.COMMON;
|
return EnumRarity.COMMON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? 0 : 1;
|
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockSlab.HALF);
|
return new BlockStateContainer(this, BlockSlab.HALF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.setHasSubtypes(false);
|
this.setHasSubtypes(false);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
if(StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)){
|
if (StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
if(state.getBlock() == this.block){
|
if (state.getBlock() == this.block) {
|
||||||
BlockSlabs theBlock = (BlockSlabs)this.block;
|
BlockSlabs theBlock = (BlockSlabs) this.block;
|
||||||
if(facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP){
|
if (facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||||
IBlockState newState = theBlock.fullBlockState;
|
IBlockState newState = theBlock.fullBlockState;
|
||||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
||||||
|
|
||||||
if(bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)){
|
if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) {
|
||||||
SoundType soundtype = theBlock.fullBlockState.getBlock().getSoundType(theBlock.fullBlockState, world, pos, player);
|
SoundType soundtype = theBlock.fullBlockState.getBlock().getSoundType(theBlock.fullBlockState, world, pos, player);
|
||||||
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume()+1.0F)/2.0F, soundtype.getPitch()*0.8F);
|
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
|
||||||
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,37 +129,34 @@ public class BlockSlabs extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.tryPlace(player, stack, hand, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
return this.tryPlace(player, stack, hand, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack){
|
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
IBlockState state = worldIn.getBlockState(pos);
|
||||||
|
|
||||||
if(state.getBlock() == this.block){
|
if (state.getBlock() == this.block) {
|
||||||
if(side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP){
|
if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return worldIn.getBlockState(pos.offset(side)).getBlock() == this.block || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
|
return worldIn.getBlockState(pos.offset(side)).getBlock() == this.block || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tryPlace(EntityPlayer player, ItemStack stack, EnumHand hand, World world, BlockPos pos){
|
private boolean tryPlace(EntityPlayer player, ItemStack stack, EnumHand hand, World world, BlockPos pos) {
|
||||||
IBlockState iblockstate = world.getBlockState(pos);
|
IBlockState iblockstate = world.getBlockState(pos);
|
||||||
|
|
||||||
if(iblockstate.getBlock() == this.block){
|
if (iblockstate.getBlock() == this.block) {
|
||||||
BlockSlabs theBlock = (BlockSlabs)this.block;
|
BlockSlabs theBlock = (BlockSlabs) this.block;
|
||||||
IBlockState newState = theBlock.fullBlockState;
|
IBlockState newState = theBlock.fullBlockState;
|
||||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
||||||
|
|
||||||
if(bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)){
|
if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) {
|
||||||
SoundType soundtype = theBlock.fullBlockState.getBlock().getSoundType(theBlock.fullBlockState, world, pos, player);
|
SoundType soundtype = theBlock.fullBlockState.getBlock().getSoundType(theBlock.fullBlockState, world, pos, player);
|
||||||
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume()+1.0F)/2.0F, soundtype.getPitch()*0.8F);
|
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
|
||||||
|
|
||||||
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
||||||
}
|
}
|
||||||
|
@ -174,9 +167,8 @@ public class BlockSlabs extends BlockBase{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
public String getTranslationKey(ItemStack stack) {
|
||||||
return this.getTranslationKey();
|
return this.getTranslationKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
@ -25,17 +26,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.Mirror;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockSmileyCloud extends BlockContainerBase {
|
||||||
|
|
||||||
public class BlockSmileyCloud extends BlockContainerBase{
|
public BlockSmileyCloud(String name) {
|
||||||
|
|
||||||
public BlockSmileyCloud(String name){
|
|
||||||
super(Material.CLOTH, name);
|
super(Material.CLOTH, name);
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
this.setResistance(5.0F);
|
this.setResistance(5.0F);
|
||||||
|
@ -44,33 +47,33 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if(world.rand.nextInt(30) == 0){
|
if (world.rand.nextInt(30) == 0) {
|
||||||
for(int i = 0; i < 2; i++){
|
for (int i = 0; i < 2; i++) {
|
||||||
double d = world.rand.nextGaussian()*0.02D;
|
double d = world.rand.nextGaussian() * 0.02D;
|
||||||
double d1 = world.rand.nextGaussian()*0.02D;
|
double d1 = world.rand.nextGaussian() * 0.02D;
|
||||||
double d2 = world.rand.nextGaussian()*0.02D;
|
double d2 = world.rand.nextGaussian() * 0.02D;
|
||||||
world.spawnParticle(EnumParticleTypes.HEART, pos.getX()+world.rand.nextFloat(), pos.getY()+0.65+world.rand.nextFloat(), pos.getZ()+world.rand.nextFloat(), d, d1, d2);
|
world.spawnParticle(EnumParticleTypes.HEART, pos.getX() + world.rand.nextFloat(), pos.getY() + 0.65 + world.rand.nextFloat(), pos.getZ() + world.rand.nextFloat(), d, d1, d2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntitySmileyCloud){
|
if (tile instanceof TileEntitySmileyCloud) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
|
||||||
//TheAchievements.NAME_SMILEY_CLOUD.get(player);
|
//TheAchievements.NAME_SMILEY_CLOUD.get(player);
|
||||||
|
@ -79,46 +82,45 @@ public class BlockSmileyCloud extends BlockContainerBase{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta){
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntitySmileyCloud();
|
return new TileEntitySmileyCloud();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockTorch;
|
import net.minecraft.block.BlockTorch;
|
||||||
|
@ -19,7 +23,11 @@ import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.Mirror;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -27,12 +35,9 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
//Copied from BlockTorch.
|
//Copied from BlockTorch.
|
||||||
//I have no idea what all of this means.
|
//I have no idea what all of this means.
|
||||||
public class BlockTinyTorch extends BlockBase{
|
public class BlockTinyTorch extends BlockBase {
|
||||||
|
|
||||||
//Thanks to xdjackiexd for these.
|
//Thanks to xdjackiexd for these.
|
||||||
//Man, I hate numbers.
|
//Man, I hate numbers.
|
||||||
|
@ -42,7 +47,7 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
private static final AxisAlignedBB TORCH_WEST_AABB = new AxisAlignedBB(0.8125D, 0.25D, 0.4375D, 1.0D, 0.5625D, 0.5625D);
|
private static final AxisAlignedBB TORCH_WEST_AABB = new AxisAlignedBB(0.8125D, 0.25D, 0.4375D, 1.0D, 0.5625D, 0.5625D);
|
||||||
private static final AxisAlignedBB TORCH_EAST_AABB = new AxisAlignedBB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D);
|
private static final AxisAlignedBB TORCH_EAST_AABB = new AxisAlignedBB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D);
|
||||||
|
|
||||||
public BlockTinyTorch(String name){
|
public BlockTinyTorch(String name) {
|
||||||
super(Material.CIRCUITS, name);
|
super(Material.CIRCUITS, name);
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, EnumFacing.UP));
|
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, EnumFacing.UP));
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
|
@ -53,8 +58,8 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
switch(state.getValue(BlockTorch.FACING)){
|
switch (state.getValue(BlockTorch.FACING)) {
|
||||||
case EAST:
|
case EAST:
|
||||||
return TORCH_EAST_AABB;
|
return TORCH_EAST_AABB;
|
||||||
case WEST:
|
case WEST:
|
||||||
|
@ -70,22 +75,22 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos){
|
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||||
return NULL_AABB;
|
return NULL_AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube(IBlockState state){
|
public boolean isNormalCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,38 +99,33 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
return BlockFaceShape.UNDEFINED;
|
return BlockFaceShape.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canPlaceOn(World worldIn, BlockPos pos){
|
private boolean canPlaceOn(World worldIn, BlockPos pos) {
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
IBlockState state = worldIn.getBlockState(pos);
|
||||||
return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
|
return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos){
|
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
||||||
for(EnumFacing enumfacing : BlockTorch.FACING.getAllowedValues()){
|
for (EnumFacing enumfacing : BlockTorch.FACING.getAllowedValues()) {
|
||||||
if(this.canPlaceAt(worldIn, pos, enumfacing)){
|
if (this.canPlaceAt(worldIn, pos, enumfacing)) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing){
|
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing) {
|
||||||
BlockPos blockpos = pos.offset(facing.getOpposite());
|
BlockPos blockpos = pos.offset(facing.getOpposite());
|
||||||
boolean flag = facing.getAxis().isHorizontal();
|
boolean flag = facing.getAxis().isHorizontal();
|
||||||
return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
|
return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
|
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||||
if(this.canPlaceAt(worldIn, pos, facing)){
|
if (this.canPlaceAt(worldIn, pos, facing)) {
|
||||||
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
|
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
|
||||||
}
|
} else {
|
||||||
else{
|
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
|
||||||
for(EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL){
|
if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) { return this.getDefaultState().withProperty(BlockTorch.FACING, enumfacing); }
|
||||||
if(worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)){
|
|
||||||
return this.getDefaultState().withProperty(BlockTorch.FACING, enumfacing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getDefaultState();
|
return this.getDefaultState();
|
||||||
|
@ -133,49 +133,45 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state){
|
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||||
this.checkForDrop(worldIn, pos, state);
|
this.checkForDrop(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos){
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||||
this.onNeighborChangeInternal(worldIn, pos, state);
|
this.onNeighborChangeInternal(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state){
|
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) {
|
||||||
if(!this.checkForDrop(worldIn, pos, state)){
|
if (!this.checkForDrop(worldIn, pos, state)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
EnumFacing enumfacing = state.getValue(BlockTorch.FACING);
|
EnumFacing enumfacing = state.getValue(BlockTorch.FACING);
|
||||||
EnumFacing.Axis axis = enumfacing.getAxis();
|
EnumFacing.Axis axis = enumfacing.getAxis();
|
||||||
EnumFacing enumfacing1 = enumfacing.getOpposite();
|
EnumFacing enumfacing1 = enumfacing.getOpposite();
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if(axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)){
|
if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
} else if (axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) {
|
||||||
else if(axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))){
|
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag){
|
if (flag) {
|
||||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state){
|
protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) {
|
||||||
if(state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))){
|
if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
if (worldIn.getBlockState(pos).getBlock() == this) {
|
||||||
if(worldIn.getBlockState(pos).getBlock() == this){
|
|
||||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
}
|
}
|
||||||
|
@ -186,19 +182,18 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||||
if(rand.nextBoolean()){
|
if (rand.nextBoolean()) {
|
||||||
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
|
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
|
||||||
double d0 = pos.getX()+0.5D;
|
double d0 = pos.getX() + 0.5D;
|
||||||
double d1 = pos.getY()+0.4D;
|
double d1 = pos.getY() + 0.4D;
|
||||||
double d2 = pos.getZ()+0.5D;
|
double d2 = pos.getZ() + 0.5D;
|
||||||
|
|
||||||
if(enumfacing.getAxis().isHorizontal()){
|
if (enumfacing.getAxis().isHorizontal()) {
|
||||||
EnumFacing enumfacing1 = enumfacing.getOpposite();
|
EnumFacing enumfacing1 = enumfacing.getOpposite();
|
||||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.35D*enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
|
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
|
||||||
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+0.35D*enumfacing1.getXOffset(), d1+0.22D, d2+0.35D*enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
|
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||||
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
|
@ -206,10 +201,10 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
IBlockState iblockstate = this.getDefaultState();
|
IBlockState iblockstate = this.getDefaultState();
|
||||||
|
|
||||||
switch(meta){
|
switch (meta) {
|
||||||
case 1:
|
case 1:
|
||||||
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.EAST);
|
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.EAST);
|
||||||
break;
|
break;
|
||||||
|
@ -231,15 +226,15 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getRenderLayer(){
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
switch(state.getValue(BlockTorch.FACING)){
|
switch (state.getValue(BlockTorch.FACING)) {
|
||||||
case EAST:
|
case EAST:
|
||||||
i = i | 1;
|
i = i | 1;
|
||||||
break;
|
break;
|
||||||
|
@ -262,17 +257,17 @@ public class BlockTinyTorch extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING)));
|
return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn){
|
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||||
return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
|
return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockTorch.FACING);
|
return new BlockStateContainer(this, BlockTorch.FACING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,9 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockTreasureChest extends BlockBase{
|
public class BlockTreasureChest extends BlockBase {
|
||||||
|
|
||||||
public BlockTreasureChest(String name){
|
public BlockTreasureChest(String name) {
|
||||||
super(Material.WOOD, name);
|
super(Material.WOOD, name);
|
||||||
this.setHarvestLevel("axe", 0);
|
this.setHarvestLevel("axe", 0);
|
||||||
this.setHardness(300.0F);
|
this.setHardness(300.0F);
|
||||||
|
@ -54,25 +54,25 @@ public class BlockTreasureChest extends BlockBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
|
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||||
for(int i = 0; i < 2; i++){
|
for (int i = 0; i < 2; i++) {
|
||||||
for(float f = 0; f <= 3; f += 0.5){
|
for (float f = 0; f <= 3; f += 0.5) {
|
||||||
float particleX = rand.nextFloat();
|
float particleX = rand.nextFloat();
|
||||||
float particleZ = rand.nextFloat();
|
float particleZ = rand.nextFloat();
|
||||||
world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, (double)pos.getX()+particleX, (double)pos.getY()+f+1, (double)pos.getZ()+particleZ, 0.0D, 0.2D, 0.0D);
|
world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, (double) pos.getX() + particleX, (double) pos.getY() + f + 1, (double) pos.getZ() + particleZ, 0.0D, 0.2D, 0.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||||
return Items.AIR;
|
return Items.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat()*0.1F+0.9F);
|
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F);
|
||||||
this.dropItems(world, pos);
|
this.dropItems(world, pos);
|
||||||
world.setBlockToAir(pos);
|
world.setBlockToAir(pos);
|
||||||
|
|
||||||
|
@ -82,62 +82,62 @@ public class BlockTreasureChest extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropItems(World world, BlockPos pos){
|
private void dropItems(World world, BlockPos pos) {
|
||||||
for(int i = 0; i < MathHelper.getInt(world.rand, 3, 6); i++){
|
for (int i = 0; i < MathHelper.getInt(world.rand, 3, 6); i++) {
|
||||||
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(world.rand, ActuallyAdditionsAPI.TREASURE_CHEST_LOOT);
|
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(world.rand, ActuallyAdditionsAPI.TREASURE_CHEST_LOOT);
|
||||||
ItemStack itemStack = theReturn.returnItem.copy();
|
ItemStack itemStack = theReturn.returnItem.copy();
|
||||||
itemStack.setCount(MathHelper.getInt(world.rand, theReturn.minAmount, theReturn.maxAmount));
|
itemStack.setCount(MathHelper.getInt(world.rand, theReturn.minAmount, theReturn.maxAmount));
|
||||||
|
|
||||||
float dX = world.rand.nextFloat()*0.8F+0.1F;
|
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = world.rand.nextFloat()*0.8F+0.1F;
|
float dY = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dZ = world.rand.nextFloat()*0.8F+0.1F;
|
float dZ = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, itemStack);
|
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, itemStack);
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
entityItem.motionX = world.rand.nextGaussian()*factor;
|
entityItem.motionX = world.rand.nextGaussian() * factor;
|
||||||
entityItem.motionY = world.rand.nextGaussian()*factor+0.2F;
|
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
||||||
entityItem.motionZ = world.rand.nextGaussian()*factor;
|
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
||||||
world.spawnEntity(entityItem);
|
world.spawnEntity(entityItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockWallAA extends BlockBase{
|
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[] 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)};
|
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) };
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public BlockWallAA(String name, Block blocc){
|
public BlockWallAA(String name, Block blocc) {
|
||||||
super(blocc.getDefaultState().getMaterial(), name);
|
super(blocc.getDefaultState().getMaterial(), name);
|
||||||
this.setHardness(1.5F);
|
this.setHardness(1.5F);
|
||||||
this.setResistance(10F);
|
this.setResistance(10F);
|
||||||
|
@ -42,22 +42,22 @@ public class BlockWallAA extends BlockBase{
|
||||||
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));
|
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){
|
private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(IBlockState state) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if(state.getValue(BlockWall.NORTH)){
|
if (state.getValue(BlockWall.NORTH)) {
|
||||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.getValue(BlockWall.EAST)){
|
if (state.getValue(BlockWall.EAST)) {
|
||||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.getValue(BlockWall.SOUTH)){
|
if (state.getValue(BlockWall.SOUTH)) {
|
||||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.getValue(BlockWall.WEST)){
|
if (state.getValue(BlockWall.WEST)) {
|
||||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class BlockWallAA extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
|
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||||
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
||||||
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
||||||
|
@ -75,65 +75,63 @@ public class BlockWallAA extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state){
|
public boolean isFullCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos){
|
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
|
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||||
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
state = this.getActualState(state, source, pos);
|
state = this.getActualState(state, source, pos);
|
||||||
return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
|
return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos){
|
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||||
blockState = this.getActualState(blockState, worldIn, pos);
|
blockState = this.getActualState(blockState, worldIn, pos);
|
||||||
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
|
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state){
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
list.add(new ItemStack(this, 1, 0));
|
list.add(new ItemStack(this, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
|
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
IBlockState state = worldIn.getBlockState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD);
|
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState();
|
return this.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
|
return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||||
|
@ -35,98 +34,96 @@ import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockWildPlant extends BlockBushBase{
|
public class BlockWildPlant extends BlockBushBase {
|
||||||
|
|
||||||
public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
|
public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
|
||||||
public static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
|
public static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
|
||||||
|
|
||||||
public BlockWildPlant(String name){
|
public BlockWildPlant(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
this.setSoundType(SoundType.PLANT);
|
this.setSoundType(SoundType.PLANT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
|
public boolean canBlockStay(World world, BlockPos pos, IBlockState state) {
|
||||||
BlockPos offset = pos.down();
|
BlockPos offset = pos.down();
|
||||||
IBlockState offsetState = world.getBlockState(offset);
|
IBlockState offsetState = world.getBlockState(offset);
|
||||||
Block offsetBlock = offsetState.getBlock();
|
Block offsetBlock = offsetState.getBlock();
|
||||||
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion();
|
BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion();
|
||||||
return new ItemStack(normal.seedItem);
|
return new ItemStack(normal.seedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for(int j = 0; j < ALL_WILD_PLANTS.length; j++){
|
for (int j = 0; j < ALL_WILD_PLANTS.length; j++) {
|
||||||
list.add(new ItemStack(this, 1, j));
|
list.add(new ItemStack(this, 1, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
Block normal = state.getValue(TYPE).getNormalVersion();
|
Block normal = state.getValue(TYPE).getNormalVersion();
|
||||||
normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune);
|
normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new TheItemBlock(this);
|
return new TheItemBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
for(int i = 0; i < ALL_WILD_PLANTS.length; i++){
|
for (int i = 0; i < ALL_WILD_PLANTS.length; i++) {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName()+"="+ALL_WILD_PLANTS[i].getName());
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_WILD_PLANTS[i].getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]);
|
return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(TYPE).ordinal();
|
return state.getValue(TYPE).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, TYPE);
|
return new BlockStateContainer(this, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity();
|
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase {
|
||||||
|
|
||||||
public TheItemBlock(Block block){
|
public TheItemBlock(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.setHasSubtypes(true);
|
this.setHasSubtypes(true);
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey(ItemStack stack){
|
public String getTranslationKey(ItemStack stack) {
|
||||||
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey()+"_"+ALL_WILD_PLANTS[stack.getItemDamage()].getName();
|
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_WILD_PLANTS[stack.getItemDamage()].getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
|
@ -32,9 +31,9 @@ import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockXPSolidifier extends BlockContainerBase{
|
public class BlockXPSolidifier extends BlockContainerBase {
|
||||||
|
|
||||||
public BlockXPSolidifier(String name){
|
public BlockXPSolidifier(String name) {
|
||||||
super(Material.ROCK, name);
|
super(Material.ROCK, name);
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
this.setHarvestLevel("pickaxe", 0);
|
||||||
this.setHardness(2.5F);
|
this.setHardness(2.5F);
|
||||||
|
@ -42,17 +41,16 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
||||||
this.setSoundType(SoundType.STONE);
|
this.setSoundType(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int par2){
|
public TileEntity createNewTileEntity(World world, int par2) {
|
||||||
return new TileEntityXPSolidifier();
|
return new TileEntityXPSolidifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos);
|
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos);
|
||||||
if(solidifier != null){
|
if (solidifier != null) {
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -61,39 +59,39 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta){
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state){
|
public int getMetaFromState(IBlockState state) {
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState(){
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot){
|
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror){
|
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public interface IHudDisplay{
|
public interface IHudDisplay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
public final class InitBlocks{
|
public final class InitBlocks {
|
||||||
|
|
||||||
public static Block blockCompost;
|
public static Block blockCompost;
|
||||||
public static Block blockMisc;
|
public static Block blockMisc;
|
||||||
|
@ -116,7 +116,7 @@ public final class InitBlocks{
|
||||||
public static Block blockCrystalClusterEmerald;
|
public static Block blockCrystalClusterEmerald;
|
||||||
public static Block blockCrystalClusterIron;
|
public static Block blockCrystalClusterIron;
|
||||||
|
|
||||||
public static void init(){
|
public static void init() {
|
||||||
ActuallyAdditions.LOGGER.info("Initializing Blocks...");
|
ActuallyAdditions.LOGGER.info("Initializing Blocks...");
|
||||||
|
|
||||||
blockCrystalClusterRedstone = new BlockCrystalCluster("block_crystal_cluster_redstone", TheCrystals.REDSTONE);
|
blockCrystalClusterRedstone = new BlockCrystalCluster("block_crystal_cluster_redstone", TheCrystals.REDSTONE);
|
||||||
|
|
|
@ -19,40 +19,40 @@ import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.IRarity;
|
import net.minecraftforge.common.IRarity;
|
||||||
|
|
||||||
public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel{
|
public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockBase(Material material, String name){
|
public BlockBase(Material material, String name) {
|
||||||
super(material);
|
super(material);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register() {
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName(){
|
protected String getBaseName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRarity getRarity(ItemStack stack){
|
public IRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.COMMON;
|
return EnumRarity.COMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,40 +18,40 @@ import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel{
|
public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockBushBase(String name){
|
public BlockBushBase(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.setSoundType(SoundType.PLANT);
|
this.setSoundType(SoundType.PLANT);
|
||||||
|
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register() {
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName(){
|
protected String getBaseName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.COMMON;
|
return EnumRarity.COMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
|
@ -42,55 +48,50 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity, IHasModel{
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockContainerBase(Material material, String name){
|
public BlockContainerBase(Material material, String name) {
|
||||||
super(material);
|
super(material);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register() {
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName(){
|
protected String getBaseName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.COMMON;
|
return EnumRarity.COMMON;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropInventory(World world, BlockPos position){
|
private void dropInventory(World world, BlockPos position) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntity aTile = world.getTileEntity(position);
|
TileEntity aTile = world.getTileEntity(position);
|
||||||
if(aTile instanceof TileEntityInventoryBase){
|
if (aTile instanceof TileEntityInventoryBase) {
|
||||||
TileEntityInventoryBase tile = (TileEntityInventoryBase)aTile;
|
TileEntityInventoryBase tile = (TileEntityInventoryBase) aTile;
|
||||||
if(tile.inv.getSlots() > 0){
|
if (tile.inv.getSlots() > 0) {
|
||||||
for(int i = 0; i < tile.inv.getSlots(); i++){
|
for (int i = 0; i < tile.inv.getSlots(); i++) {
|
||||||
this.dropSlotFromInventory(i, tile, world, position);
|
this.dropSlotFromInventory(i, tile, world, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,28 +99,28 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos){
|
private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) {
|
||||||
ItemStack stack = tile.inv.getStackInSlot(i);
|
ItemStack stack = tile.inv.getStackInSlot(i);
|
||||||
if(StackUtil.isValid(stack)){
|
if (StackUtil.isValid(stack)) {
|
||||||
float dX = world.rand.nextFloat()*0.8F+0.1F;
|
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = world.rand.nextFloat()*0.8F+0.1F;
|
float dY = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dZ = world.rand.nextFloat()*0.8F+0.1F;
|
float dZ = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, stack.copy());
|
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
entityItem.motionX = world.rand.nextGaussian()*factor;
|
entityItem.motionX = world.rand.nextGaussian() * factor;
|
||||||
entityItem.motionY = world.rand.nextGaussian()*factor+0.2F;
|
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
||||||
entityItem.motionZ = world.rand.nextGaussian()*factor;
|
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
||||||
world.spawnEntity(entityItem);
|
world.spawnEntity(entityItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
|
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player) {
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
if(StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator){
|
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
if(!world.isRemote && base.isRedstoneToggle()){
|
if (!world.isRemote && base.isRedstoneToggle()) {
|
||||||
base.isPulseMode = !base.isPulseMode;
|
base.isPulseMode = !base.isPulseMode;
|
||||||
base.markDirty();
|
base.markDirty();
|
||||||
base.sendUpdate();
|
base.sendUpdate();
|
||||||
|
@ -131,82 +132,81 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
if(base.respondsToPulses()){
|
if (base.respondsToPulses()) {
|
||||||
base.activateOnPulse();
|
base.activateOnPulse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void neighborsChangedCustom(World world, BlockPos pos){
|
public void neighborsChangedCustom(World world, BlockPos pos) {
|
||||||
this.updateRedstoneState(world, pos);
|
this.updateRedstoneState(world, pos);
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
if(base.shouldSaveDataOnChangeOrWorldStart()){
|
if (base.shouldSaveDataOnChangeOrWorldStart()) {
|
||||||
base.saveDataOnChangeOrWorldStart();
|
base.saveDataOnChangeOrWorldStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos){
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||||
this.neighborsChangedCustom(worldIn, pos);
|
this.neighborsChangedCustom(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){
|
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
||||||
super.onNeighborChange(world, pos, neighbor);
|
super.onNeighborChange(world, pos, neighbor);
|
||||||
if(world instanceof World){
|
if (world instanceof World) {
|
||||||
this.neighborsChangedCustom((World)world, pos);
|
this.neighborsChangedCustom((World) world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRedstoneState(World world, BlockPos pos){
|
public void updateRedstoneState(World world, BlockPos pos) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
boolean powered = world.getRedstonePowerFromNeighbors(pos) > 0;
|
boolean powered = world.getRedstonePowerFromNeighbors(pos) > 0;
|
||||||
boolean wasPowered = base.isRedstonePowered;
|
boolean wasPowered = base.isRedstonePowered;
|
||||||
if(powered && !wasPowered){
|
if (powered && !wasPowered) {
|
||||||
if(base.respondsToPulses()){
|
if (base.respondsToPulses()) {
|
||||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||||
}
|
}
|
||||||
base.setRedstonePowered(true);
|
base.setRedstonePowered(true);
|
||||||
}
|
} else if (!powered && wasPowered) {
|
||||||
else if(!powered && wasPowered){
|
|
||||||
base.setRedstonePowered(false);
|
base.setRedstonePowered(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank){
|
protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank) {
|
||||||
ItemStack heldItem = player.getHeldItem(hand);
|
ItemStack heldItem = player.getHeldItem(hand);
|
||||||
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
|
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||||
this.updateRedstoneState(world, pos);
|
this.updateRedstoneState(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||||
if(stack.hasTagCompound()){
|
if (stack.hasTagCompound()) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
||||||
if(compound != null){
|
if (compound != null) {
|
||||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,56 +214,54 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||||
if(!player.capabilities.isCreativeMode){
|
if (!player.capabilities.isCreativeMode) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase && ((TileEntityBase)tile).stopFromDropping){
|
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
||||||
player.sendMessage(new TextComponentTranslation("info."+ActuallyAdditions.MODID+".machineBroke").setStyle(new Style().setColor(TextFormatting.RED)));
|
player.sendMessage(new TextComponentTranslation("info." + ActuallyAdditions.MODID + ".machineBroke").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride(IBlockState state){
|
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos){
|
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); }
|
||||||
return ((TileEntityBase)tile).getComparatorStrength();
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if (tile instanceof TileEntityBase) {
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase) tile;
|
||||||
if(!base.stopFromDropping){
|
if (!base.stopFromDropping) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||||
|
|
||||||
//Remove unnecessarily saved default values to avoid unstackability
|
//Remove unnecessarily saved default values to avoid unstackability
|
||||||
List<String> keysToRemove = new ArrayList<>();
|
List<String> keysToRemove = new ArrayList<>();
|
||||||
for(String key : data.getKeySet()){
|
for (String key : data.getKeySet()) {
|
||||||
NBTBase tag = data.getTag(key);
|
NBTBase tag = data.getTag(key);
|
||||||
//Remove only ints because they are the most common ones
|
//Remove only ints because they are the most common ones
|
||||||
//Add else if below here to remove more types
|
//Add else if below here to remove more types
|
||||||
if(tag instanceof NBTTagInt){
|
if (tag instanceof NBTTagInt) {
|
||||||
if(((NBTTagInt)tag).getInt() == 0){
|
if (((NBTTagInt) tag).getInt() == 0) {
|
||||||
keysToRemove.add(key);
|
keysToRemove.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(String key : keysToRemove){
|
for (String key : keysToRemove) {
|
||||||
data.removeTag(key);
|
data.removeTag(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
||||||
if(!data.isEmpty()){
|
if (!data.isEmpty()) {
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
stack.getTagCompound().setTag("Data", data);
|
stack.getTagCompound().setTag("Data", data);
|
||||||
}
|
}
|
||||||
|
@ -287,20 +285,20 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state){
|
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||||
return EnumBlockRenderType.MODEL;
|
return EnumBlockRenderType.MODEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
if(this.shouldDropInventory(world, pos)){
|
if (this.shouldDropInventory(world, pos)) {
|
||||||
this.dropInventory(world, pos);
|
this.dropInventory(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldDropInventory(World world, BlockPos pos){
|
public boolean shouldDropInventory(World world, BlockPos pos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
@ -21,11 +20,11 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity{
|
public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){
|
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName) {
|
||||||
super(fluid, material);
|
super(fluid, material);
|
||||||
this.name = unlocalizedName;
|
this.name = unlocalizedName;
|
||||||
this.displacements.put(this, false);
|
this.displacements.put(this, false);
|
||||||
|
@ -33,34 +32,34 @@ public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBas
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register() {
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName(){
|
protected String getBaseName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDisplace(IBlockAccess world, BlockPos pos){
|
public boolean canDisplace(IBlockAccess world, BlockPos pos) {
|
||||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean displaceIfPossible(World world, BlockPos pos){
|
public boolean displaceIfPossible(World world, BlockPos pos) {
|
||||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
@ -29,9 +31,7 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.EnumPlantType;
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||||
|
|
||||||
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel{
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int minDropAmount;
|
private final int minDropAmount;
|
||||||
|
@ -40,72 +40,72 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
||||||
private Item returnItem;
|
private Item returnItem;
|
||||||
private int returnMeta;
|
private int returnMeta;
|
||||||
|
|
||||||
public BlockPlant(String name, int minDropAmount, int addDropAmount){
|
public BlockPlant(String name, int minDropAmount, int addDropAmount) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.minDropAmount = minDropAmount;
|
this.minDropAmount = minDropAmount;
|
||||||
this.addDropAmount = addDropAmount;
|
this.addDropAmount = addDropAmount;
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doStuff(Item seedItem, Item returnItem, int returnMeta){
|
public void doStuff(Item seedItem, Item returnItem, int returnMeta) {
|
||||||
this.seedItem = seedItem;
|
this.seedItem = seedItem;
|
||||||
this.returnItem = returnItem;
|
this.returnItem = returnItem;
|
||||||
this.returnMeta = returnMeta;
|
this.returnMeta = returnMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register() {
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName(){
|
protected String getBaseName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.RARE;
|
return EnumRarity.RARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
|
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
|
||||||
return EnumPlantType.Crop;
|
return EnumPlantType.Crop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state){
|
public int damageDropped(IBlockState state) {
|
||||||
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
if(this.getMetaFromState(state) >= 7){
|
if (this.getMetaFromState(state) >= 7) {
|
||||||
if(!world.isRemote){
|
if (!world.isRemote) {
|
||||||
|
|
||||||
NonNullList<ItemStack> drops = NonNullList.create();
|
NonNullList<ItemStack> drops = NonNullList.create();
|
||||||
this.getDrops(drops, world, pos, state, 0);
|
this.getDrops(drops, world, pos, state, 0);
|
||||||
boolean deductedSeedSize = false;
|
boolean deductedSeedSize = false;
|
||||||
for(ItemStack drop : drops){
|
for (ItemStack drop : drops) {
|
||||||
if(StackUtil.isValid(drop)){
|
if (StackUtil.isValid(drop)) {
|
||||||
if(drop.getItem() == this.seedItem && !deductedSeedSize){
|
if (drop.getItem() == this.seedItem && !deductedSeedSize) {
|
||||||
drop.shrink(1);
|
drop.shrink(1);
|
||||||
deductedSeedSize = true;
|
deductedSeedSize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StackUtil.isValid(drop)){
|
if (StackUtil.isValid(drop)) {
|
||||||
EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, drop);
|
EntityItem entity = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, drop);
|
||||||
world.spawnEntity(entity);
|
world.spawnEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,24 +119,23 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getSeed(){
|
public Item getSeed() {
|
||||||
return this.seedItem;
|
return this.seedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(IBlockState state, int fortune, Random random){
|
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||||
return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount)+this.minDropAmount : super.quantityDropped(state, fortune, random);
|
return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount) + this.minDropAmount : super.quantityDropped(state, fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getCrop(){
|
public Item getCrop() {
|
||||||
return this.returnItem;
|
return this.returnItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
@ -20,15 +19,15 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRarity, IHasModel{
|
public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public BlockStair(Block block, String name){
|
public BlockStair(Block block, String name) {
|
||||||
this(block.getDefaultState(), name);
|
this(block.getDefaultState(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockStair(IBlockState state, String name){
|
public BlockStair(IBlockState state, String name) {
|
||||||
super(state);
|
super(state);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity(0);
|
||||||
|
@ -36,29 +35,29 @@ public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRari
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register() {
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBaseName(){
|
protected String getBaseName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock(){
|
protected ItemBlockBase getItemBlock() {
|
||||||
return new ItemBlockBase(this);
|
return new ItemBlockBase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldAddCreative(){
|
public boolean shouldAddCreative() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRendering(){
|
public void registerRendering() {
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.COMMON;
|
return EnumRarity.COMMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheColoredLampColors implements IStringSerializable{
|
public enum TheColoredLampColors implements IStringSerializable {
|
||||||
|
|
||||||
WHITE("White", "white"),
|
WHITE("White", "white"),
|
||||||
ORANGE("Orange", "orange"),
|
ORANGE("Orange", "orange"),
|
||||||
|
@ -34,20 +34,18 @@ public enum TheColoredLampColors implements IStringSerializable{
|
||||||
public final String regName;
|
public final String regName;
|
||||||
public final String oreName;
|
public final String oreName;
|
||||||
|
|
||||||
TheColoredLampColors(String oreName, String regName){
|
TheColoredLampColors(String oreName, String regName) {
|
||||||
this.oreName = oreName;
|
this.oreName = oreName;
|
||||||
this.regName = regName;
|
this.regName = regName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TheColoredLampColors getColorFromDyeName(String color){
|
public static TheColoredLampColors getColorFromDyeName(String color) {
|
||||||
if(color.substring(0, 3).equals("dye")){
|
if (color.substring(0, 3).equals("dye")) {
|
||||||
String actualName = color.substring(3);
|
String actualName = color.substring(3);
|
||||||
for(int i = 0; i < values().length; i++){
|
for (int i = 0; i < values().length; i++) {
|
||||||
String aName = values()[i].oreName;
|
String aName = values()[i].oreName;
|
||||||
if(aName != null){
|
if (aName != null) {
|
||||||
if(aName.equalsIgnoreCase(actualName)){
|
if (aName.equalsIgnoreCase(actualName)) { return values()[i]; }
|
||||||
return values()[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +53,7 @@ public enum TheColoredLampColors implements IStringSerializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(){
|
public String getName() {
|
||||||
return this.regName;
|
return this.regName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheMiscBlocks implements IStringSerializable{
|
public enum TheMiscBlocks implements IStringSerializable {
|
||||||
|
|
||||||
QUARTZ_PILLAR("black_quartz_pillar", EnumRarity.RARE),
|
QUARTZ_PILLAR("black_quartz_pillar", EnumRarity.RARE),
|
||||||
QUARTZ_CHISELED("black_quartz_chiseled", EnumRarity.RARE),
|
QUARTZ_CHISELED("black_quartz_chiseled", EnumRarity.RARE),
|
||||||
|
@ -29,13 +29,13 @@ public enum TheMiscBlocks implements IStringSerializable{
|
||||||
public final String name;
|
public final String name;
|
||||||
public final EnumRarity rarity;
|
public final EnumRarity rarity;
|
||||||
|
|
||||||
TheMiscBlocks(String name, EnumRarity rarity){
|
TheMiscBlocks(String name, EnumRarity rarity) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(){
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
public interface IHasModel{
|
public interface IHasModel {
|
||||||
|
|
||||||
public void registerRendering();
|
public void registerRendering();
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
||||||
|
@ -26,21 +28,17 @@ import net.minecraftforge.energy.IEnergyStorage;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatteryBox>{
|
public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatteryBox> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f){
|
public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f) {
|
||||||
if(!(tile instanceof TileEntityBatteryBox)){
|
if (!(tile instanceof TileEntityBatteryBox)) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery){
|
if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y+1F, (float)z+0.5F);
|
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
|
@ -48,17 +46,17 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatter
|
||||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||||
GlStateManager.translate(0F, 0F, -50F);
|
GlStateManager.translate(0F, 0F, -50F);
|
||||||
|
|
||||||
if(stack.hasCapability(CapabilityEnergy.ENERGY, null)){
|
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
||||||
IEnergyStorage cap = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
IEnergyStorage cap = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||||
|
|
||||||
String s = format.format(cap.getEnergyStored())+"/"+format.format(cap.getMaxEnergyStored());
|
String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored());
|
||||||
float lengthS = -font.getStringWidth(s)/2F;
|
float lengthS = -font.getStringWidth(s) / 2F;
|
||||||
String s2 = "Crystal Flux";
|
String s2 = "Crystal Flux";
|
||||||
float lengthS2 = -font.getStringWidth(s2)/2F;
|
float lengthS2 = -font.getStringWidth(s2) / 2F;
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++){
|
for (int i = 0; i < 4; i++) {
|
||||||
font.drawString(s, lengthS, 10F, 0xFFFFFF, false);
|
font.drawString(s, lengthS, 10F, 0xFFFFFF, false);
|
||||||
font.drawString(s2, lengthS2, 20F, 0xFFFFFF, false);
|
font.drawString(s2, lengthS2, 20F, 0xFFFFFF, false);
|
||||||
|
|
||||||
|
@ -69,17 +67,16 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatter
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime()/800D;
|
double boop = Minecraft.getSystemTime() / 800D;
|
||||||
GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.065, 0D);
|
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float)(boop*40D%360), 0, 1, 0);
|
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
try{
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e){
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + stack.getItem().getRegistryName() + "!", e);
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is "+stack.getItem().getRegistryName()+"!", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
|
@ -23,30 +23,27 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand>{
|
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f){
|
public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f) {
|
||||||
if(!(tile instanceof TileEntityDisplayStand)){
|
if (!(tile instanceof TileEntityDisplayStand)) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(stack)){
|
if (StackUtil.isValid(stack)) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y+1F, (float)z+0.5F);
|
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime()/800D;
|
double boop = Minecraft.getSystemTime() / 800D;
|
||||||
GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.065, 0D);
|
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float)(boop*40D%360), 0, 1, 0);
|
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
try{
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e){
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is " + stack.getItem().getRegistryName() + "!", e);
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is "+stack.getItem().getRegistryName()+"!", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
|
@ -27,29 +27,26 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer>{
|
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f){
|
public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f) {
|
||||||
if(!(tile instanceof TileEntityEmpowerer)){
|
if (!(tile instanceof TileEntityEmpowerer)) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(stack)){
|
if (StackUtil.isValid(stack)) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y+1F, (float)z+0.5F);
|
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime()/800D;
|
double boop = Minecraft.getSystemTime() / 800D;
|
||||||
GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.065, 0D);
|
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float)(boop*40D%360), 0, 1, 0);
|
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
try{
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e){
|
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is " + stack.getItem().getRegistryName() + ":" + stack.getMetadata() + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is " + stack.getItem().getRegistryName() + ":" + stack.getMetadata() + "!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,14 +54,14 @@ public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpower
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = tile.recipeForRenderIndex;
|
int index = tile.recipeForRenderIndex;
|
||||||
if(index >= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index){
|
if (index >= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index) {
|
||||||
EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index);
|
EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index);
|
||||||
if(recipe != null){
|
if (recipe != null) {
|
||||||
for(int i = 0; i < EnumFacing.HORIZONTALS.length; i++){
|
for (int i = 0; i < EnumFacing.HORIZONTALS.length; i++) {
|
||||||
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
||||||
BlockPos offset = tile.getPos().offset(facing, 3);
|
BlockPos offset = tile.getPos().offset(facing, 3);
|
||||||
|
|
||||||
AssetUtil.renderLaser(tile.getPos().getX()+0.5, tile.getPos().getY()+0.5, tile.getPos().getZ()+0.5, offset.getX()+0.5, offset.getY()+0.95, offset.getZ()+0.5, 80, 1F, 0.1F, recipe.getParticleColors());
|
AssetUtil.renderLaser(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
|
@ -33,16 +32,16 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay>{
|
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay> {
|
||||||
|
|
||||||
private static final float[] COLOR = new float[]{1F, 0F, 0F};
|
private static final float[] COLOR = new float[] { 1F, 0F, 0F };
|
||||||
private static final float[] COLOR_ITEM = new float[]{0F, 124F/255F, 16F/255F};
|
private static final float[] COLOR_ITEM = new float[] { 0F, 124F / 255F, 16F / 255F };
|
||||||
private static final float[] COLOR_FLUIDS = new float[]{0F, 97F/255F, 198F/255F};
|
private static final float[] COLOR_FLUIDS = new float[] { 0F, 97F / 255F, 198F / 255F };
|
||||||
private static final float[] COLOR_INFRARED = new float[]{209F/255F, 179F/255F, 239F/255F};
|
private static final float[] COLOR_INFRARED = new float[] { 209F / 255F, 179F / 255F, 239F / 255F };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f){
|
public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f) {
|
||||||
if(tile instanceof TileEntityLaserRelay){
|
if (tile instanceof TileEntityLaserRelay) {
|
||||||
TileEntityLaserRelay relay = tile;
|
TileEntityLaserRelay relay = tile;
|
||||||
boolean hasInvis = false;
|
boolean hasInvis = false;
|
||||||
|
|
||||||
|
@ -50,21 +49,21 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserR
|
||||||
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
||||||
|
|
||||||
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(upgrade)){
|
if (StackUtil.isValid(upgrade)) {
|
||||||
if(upgrade.getItem() == InitItems.itemLaserUpgradeInvisibility){
|
if (upgrade.getItem() == InitItems.itemLaserUpgradeInvisibility) {
|
||||||
hasInvis = true;
|
hasInvis = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack hand = player.getHeldItemMainhand();
|
ItemStack hand = player.getHeldItemMainhand();
|
||||||
if(hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName())){
|
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName())) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
float yTrans = tile.getBlockMetadata() == 0 ? 0.2F : 0.8F;
|
float yTrans = tile.getBlockMetadata() == 0 ? 0.2F : 0.8F;
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y+yTrans, (float)z+0.5F);
|
GlStateManager.translate((float) x + 0.5F, (float) y + yTrans, (float) z + 0.5F);
|
||||||
GlStateManager.scale(0.2F, 0.2F, 0.2F);
|
GlStateManager.scale(0.2F, 0.2F, 0.2F);
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime()/800D;
|
double boop = Minecraft.getSystemTime() / 800D;
|
||||||
GlStateManager.rotate((float)(boop*40D%360), 0, 1, 0);
|
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
||||||
|
|
||||||
AssetUtil.renderItemInWorld(upgrade);
|
AssetUtil.renderItemInWorld(upgrade);
|
||||||
|
|
||||||
|
@ -73,21 +72,21 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserR
|
||||||
}
|
}
|
||||||
|
|
||||||
ConcurrentSet<IConnectionPair> connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld());
|
ConcurrentSet<IConnectionPair> connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld());
|
||||||
if(connections != null && !connections.isEmpty()){
|
if (connections != null && !connections.isEmpty()) {
|
||||||
for(IConnectionPair pair : connections){
|
for (IConnectionPair pair : connections) {
|
||||||
if(!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])){
|
if (!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])) {
|
||||||
BlockPos first = tile.getPos();
|
BlockPos first = tile.getPos();
|
||||||
BlockPos second = pair.getPositions()[1];
|
BlockPos second = pair.getPositions()[1];
|
||||||
|
|
||||||
TileEntity secondTile = tile.getWorld().getTileEntity(second);
|
TileEntity secondTile = tile.getWorld().getTileEntity(second);
|
||||||
if(secondTile instanceof TileEntityLaserRelay){
|
if (secondTile instanceof TileEntityLaserRelay) {
|
||||||
ItemStack secondUpgrade = ((TileEntityLaserRelay)secondTile).inv.getStackInSlot(0);
|
ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0);
|
||||||
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
||||||
|
|
||||||
if(hasGoggles || !hasInvis || !otherInvis){
|
if (hasGoggles || !hasInvis || !otherInvis) {
|
||||||
float[] color = hasInvis && otherInvis ? COLOR_INFRARED : relay.type == LaserType.ITEM ? COLOR_ITEM : relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR;
|
float[] color = hasInvis && otherInvis ? COLOR_INFRARED : relay.type == LaserType.ITEM ? COLOR_ITEM : relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR;
|
||||||
|
|
||||||
AssetUtil.renderLaser(first.getX()+0.5, first.getY()+0.5, first.getZ()+0.5, second.getX()+0.5, second.getY()+0.5, second.getZ()+0.5, 120, hasInvis && otherInvis ? 0.1F : 0.35F, 0.05, color);
|
AssetUtil.renderLaser(first.getX() + 0.5, first.getY() + 0.5, first.getZ() + 0.5, second.getX() + 0.5, second.getY() + 0.5, second.getZ() + 0.5, 120, hasInvis && otherInvis ? 0.1F : 0.35F, 0.05, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +96,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserR
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGlobalRenderer(TileEntityLaserRelay tile){
|
public boolean isGlobalRenderer(TileEntityLaserRelay tile) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
@ -23,43 +22,43 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor>{
|
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f){
|
public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f) {
|
||||||
if(tile == null) return;
|
if (tile == null) return;
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
|
|
||||||
if(StackUtil.isValid(stack) && stack.getItem() instanceof ILensItem){
|
if (StackUtil.isValid(stack) && stack.getItem() instanceof ILensItem) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
GlStateManager.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
||||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||||
int meta = state.getBlock().getMetaFromState(state);
|
int meta = state.getBlock().getMetaFromState(state);
|
||||||
if(meta == 0){
|
if (meta == 0) {
|
||||||
GlStateManager.translate(0F, -0.5F, 0F);
|
GlStateManager.translate(0F, -0.5F, 0F);
|
||||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||||
}
|
}
|
||||||
if(meta == 1){
|
if (meta == 1) {
|
||||||
GlStateManager.translate(0F, -1.5F-0.5F/16F, 0F);
|
GlStateManager.translate(0F, -1.5F - 0.5F / 16F, 0F);
|
||||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||||
}
|
}
|
||||||
if(meta == 2){
|
if (meta == 2) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
GlStateManager.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(0F, 0F, -0.5F);
|
GlStateManager.translate(0F, 0F, -0.5F);
|
||||||
}
|
}
|
||||||
if(meta == 3){
|
if (meta == 3) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
GlStateManager.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(0F, 0F, 0.5F+0.5F/16F);
|
GlStateManager.translate(0F, 0F, 0.5F + 0.5F / 16F);
|
||||||
}
|
}
|
||||||
if(meta == 4){
|
if (meta == 4) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
GlStateManager.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(0.5F+0.5F/16F, 0F, 0F);
|
GlStateManager.translate(0.5F + 0.5F / 16F, 0F, 0F);
|
||||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||||
}
|
}
|
||||||
if(meta == 5){
|
if (meta == 5) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
GlStateManager.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(-0.5F, 0F, 0F);
|
GlStateManager.translate(-0.5F, 0F, 0F);
|
||||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||||
|
@ -25,61 +27,58 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud>{
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntitySmileyCloud theCloud, double x, double y, double z, float par5, int partial, float f){
|
public void render(TileEntitySmileyCloud theCloud, double x, double y, double z, float par5, int partial, float f) {
|
||||||
if(theCloud instanceof TileEntitySmileyCloud){
|
if (theCloud instanceof TileEntitySmileyCloud) {
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
GlStateManager.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
||||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
||||||
GlStateManager.translate(0.0F, -2F, 0.0F);
|
GlStateManager.translate(0.0F, -2F, 0.0F);
|
||||||
|
|
||||||
if(theCloud.name != null && !theCloud.name.isEmpty()){
|
if (theCloud.name != null && !theCloud.name.isEmpty()) {
|
||||||
boolean renderedEaster = false;
|
boolean renderedEaster = false;
|
||||||
|
|
||||||
easterEggs:
|
easterEggs: for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
||||||
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF){
|
for (String triggerName : cloud.getTriggerNames()) {
|
||||||
for(String triggerName : cloud.getTriggerNames()){
|
if (triggerName != null && theCloud.name != null) {
|
||||||
if(triggerName != null && theCloud.name != null){
|
if (triggerName.equalsIgnoreCase(theCloud.name)) {
|
||||||
if(triggerName.equalsIgnoreCase(theCloud.name)){
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
|
|
||||||
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
||||||
if(state.getBlock() == InitBlocks.blockSmileyCloud){
|
if (state.getBlock() == InitBlocks.blockSmileyCloud) {
|
||||||
switch(state.getValue(BlockHorizontal.FACING)){
|
switch (state.getValue(BlockHorizontal.FACING)) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
GlStateManager.rotate(180, 0, 1, 0);
|
GlStateManager.rotate(180, 0, 1, 0);
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
GlStateManager.rotate(270, 0, 1, 0);
|
GlStateManager.rotate(270, 0, 1, 0);
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
GlStateManager.rotate(90, 0, 1, 0);
|
GlStateManager.rotate(90, 0, 1, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cloud.renderExtra(0.0625F);
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
|
|
||||||
renderedEaster = true;
|
|
||||||
break easterEggs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloud.renderExtra(0.0625F);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
renderedEaster = true;
|
||||||
|
break easterEggs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String nameLower = theCloud.name.toLowerCase(Locale.ROOT);
|
String nameLower = theCloud.name.toLowerCase(Locale.ROOT);
|
||||||
if(SpecialRenderInit.SPECIAL_LIST.containsKey(nameLower)){
|
if (SpecialRenderInit.SPECIAL_LIST.containsKey(nameLower)) {
|
||||||
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
||||||
if(render != null){
|
if (render != null) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(0F, renderedEaster ? 0.05F : 0.25F, 0F);
|
GlStateManager.translate(0F, renderedEaster ? 0.05F : 0.25F, 0F);
|
||||||
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
||||||
|
@ -92,9 +91,9 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmile
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
if(theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI){
|
if (theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI) {
|
||||||
if(mc.player.getDistanceSq(theCloud.getPos()) <= 36){
|
if (mc.player.getDistanceSq(theCloud.getPos()) <= 36) {
|
||||||
AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.5F);
|
AssetUtil.renderNameTag(theCloud.name, x + 0.5F, y + 1.5F, z + 0.5F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,11 +91,11 @@ import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
|
||||||
public final class InitBooklet{
|
public final class InitBooklet {
|
||||||
|
|
||||||
public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
|
public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
|
||||||
|
|
||||||
public static void preInit(){
|
public static void preInit() {
|
||||||
ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
|
ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
|
||||||
ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
|
ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
|
||||||
|
|
||||||
|
@ -111,19 +111,19 @@ public final class InitBooklet{
|
||||||
ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
|
ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void postInit(){
|
public static void postInit() {
|
||||||
initChapters();
|
initChapters();
|
||||||
|
|
||||||
int chapCount = 0;
|
int chapCount = 0;
|
||||||
int pageCount = 0;
|
int pageCount = 0;
|
||||||
int infoCount = 0;
|
int infoCount = 0;
|
||||||
for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){
|
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
|
||||||
for(IBookletChapter chapter : entry.getAllChapters()){
|
for (IBookletChapter chapter : entry.getAllChapters()) {
|
||||||
if(!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)){
|
if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) {
|
||||||
ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
|
ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
|
||||||
chapCount++;
|
chapCount++;
|
||||||
|
|
||||||
for(IBookletPage page : chapter.getAllPages()){
|
for (IBookletPage page : chapter.getAllPages()) {
|
||||||
pageCount++;
|
pageCount++;
|
||||||
|
|
||||||
List<ItemStack> items = new ArrayList<>();
|
List<ItemStack> items = new ArrayList<>();
|
||||||
|
@ -131,8 +131,8 @@ public final class InitBooklet{
|
||||||
List<FluidStack> fluids = new ArrayList<>();
|
List<FluidStack> fluids = new ArrayList<>();
|
||||||
page.getFluidStacksForPage(fluids);
|
page.getFluidStacksForPage(fluids);
|
||||||
|
|
||||||
if(items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()){
|
if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) {
|
||||||
if(!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)){
|
if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) {
|
||||||
ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
|
ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
|
||||||
infoCount++;
|
infoCount++;
|
||||||
}
|
}
|
||||||
|
@ -158,31 +158,31 @@ public final class InitBooklet{
|
||||||
return prio2.compareTo(prio1);
|
return prio2.compareTo(prio1);
|
||||||
});
|
});
|
||||||
|
|
||||||
ActuallyAdditions.LOGGER.info("Registered a total of "+chapCount+" booklet chapters, where "+infoCount+" out of "+pageCount+" booklet pages contain information about items or fluids!");
|
ActuallyAdditions.LOGGER.info("Registered a total of " + chapCount + " booklet chapters, where " + infoCount + " out of " + pageCount + " booklet pages contain information about items or fluids!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initChapters(){
|
private static void initChapters() {
|
||||||
//Getting Started
|
//Getting Started
|
||||||
chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText());
|
chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText());
|
||||||
chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant();
|
chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant();
|
||||||
new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
||||||
ArrayList<BookletPage> crystalPages = new ArrayList<>();
|
ArrayList<BookletPage> crystalPages = new ArrayList<>();
|
||||||
crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard()));
|
crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard()));
|
||||||
for(int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++){
|
for (int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++) {
|
||||||
crystalPages.add(new PageReconstructor(7+i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
|
crystalPages.add(new PageReconstructor(7 + i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
|
||||||
}
|
}
|
||||||
crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTALS).setNoText());
|
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTALS).setNoText());
|
||||||
crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText());
|
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText());
|
||||||
chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145));
|
chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145));
|
||||||
chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
|
chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
|
||||||
chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
|
chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
|
||||||
ArrayList<BookletPage> empowererPages = new ArrayList<>();
|
ArrayList<BookletPage> empowererPages = new ArrayList<>();
|
||||||
empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand)));
|
empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand)));
|
||||||
for(int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++){
|
for (int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++) {
|
||||||
empowererPages.add(new PageEmpowerer(7+i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
|
empowererPages.add(new PageEmpowerer(7 + i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
|
||||||
}
|
}
|
||||||
empowererPages.add(new PageCrafting(empowererPages.size()+1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).setNoText());
|
empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).setNoText());
|
||||||
empowererPages.add(new PageCrafting(empowererPages.size()+1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText());
|
empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText());
|
||||||
new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockEmpowerer), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial();
|
new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockEmpowerer), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial();
|
||||||
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(), new PageCrafting(14, ItemCrafting.recipeLens).setNoText());
|
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(), new PageCrafting(14, ItemCrafting.recipeLens).setNoText());
|
||||||
chaptersIntroduction[4] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1), new PageTextOnly(2)).setImportant();
|
chaptersIntroduction[4] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1), new PageTextOnly(2)).setImportant();
|
||||||
|
@ -197,11 +197,11 @@ public final class InitBooklet{
|
||||||
new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial();
|
new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).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());
|
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<BookletPage> lampPages = new ArrayList<>();
|
ArrayList<BookletPage> lampPages = new ArrayList<>();
|
||||||
lampPages.add(new PageTextOnly(lampPages.size()+1));
|
lampPages.add(new PageTextOnly(lampPages.size() + 1));
|
||||||
lampPages.add(new PageTextOnly(lampPages.size()+1));
|
lampPages.add(new PageTextOnly(lampPages.size() + 1));
|
||||||
lampPages.add(new PageCrafting(lampPages.size()+1, BlockCrafting.recipePowerer).setWildcard().setNoText());
|
lampPages.add(new PageCrafting(lampPages.size() + 1, BlockCrafting.recipePowerer).setWildcard().setNoText());
|
||||||
for(IRecipe recipe : BlockCrafting.RECIPES_LAMPS){
|
for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) {
|
||||||
lampPages.add(new PageCrafting(lampPages.size()+1, recipe).setNoText());
|
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("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("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.ENDER_STAR.ordinal()), new PageCrafting(1, ItemCrafting.recipeEnderStar));
|
||||||
|
@ -260,9 +260,9 @@ public final class InitBooklet{
|
||||||
list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityGrinder.ENERGY_USE));
|
list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityGrinder.ENERGY_USE));
|
||||||
list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
|
list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
|
||||||
list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
|
list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
|
||||||
if(CrusherCrafting.recipeIronHorseArmor != null) list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
|
if (CrusherCrafting.recipeIronHorseArmor != null) list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
|
||||||
if(CrusherCrafting.recipeGoldHorseArmor != null) list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
|
if (CrusherCrafting.recipeGoldHorseArmor != null) list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
|
||||||
if(CrusherCrafting.recipeDiamondHorseArmor != null) list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
|
if (CrusherCrafting.recipeDiamondHorseArmor != null) list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
|
||||||
|
|
||||||
new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), list.toArray(new IBookletPage[0]));
|
new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), list.toArray(new IBookletPage[0]));
|
||||||
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityFurnaceDouble.ENERGY_USE));
|
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityFurnaceDouble.ENERGY_USE));
|
||||||
|
@ -284,23 +284,23 @@ public final class InitBooklet{
|
||||||
//No RF Using Items
|
//No RF Using Items
|
||||||
chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemEngineerGoggles), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant();
|
chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemEngineerGoggles), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant();
|
||||||
new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemBag), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant();
|
new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemBag), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant();
|
||||||
new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME/20), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial();
|
new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME / 20), 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).setNoText(), 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("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), 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();
|
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();
|
||||||
new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemPlayerProbe), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
|
new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemPlayerProbe), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
|
||||||
ArrayList<BookletPage> aiotPages = new ArrayList<>();
|
ArrayList<BookletPage> aiotPages = new ArrayList<>();
|
||||||
aiotPages.add(new PageTextOnly(aiotPages.size()+1));
|
aiotPages.add(new PageTextOnly(aiotPages.size() + 1));
|
||||||
for(IRecipe recipe : ToolCrafting.RECIPES_PAXELS){
|
for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) {
|
||||||
aiotPages.add(new PageCrafting(aiotPages.size()+1, recipe).setWildcard().setNoText());
|
aiotPages.add(new PageCrafting(aiotPages.size() + 1, recipe).setWildcard().setNoText());
|
||||||
}
|
}
|
||||||
new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant();
|
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).addItemsToPage(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3));
|
new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3));
|
||||||
|
|
||||||
ArrayList<BookletPage> potionRingPages = new ArrayList<>();
|
ArrayList<BookletPage> potionRingPages = new ArrayList<>();
|
||||||
potionRingPages.add(new PageTextOnly(potionRingPages.size()+1));
|
potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1));
|
||||||
for(IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS){
|
for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) {
|
||||||
potionRingPages.add(new PageCrafting(potionRingPages.size()+1, recipe).setNoText());
|
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("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("spawnerChanger", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemSpawnerChanger), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeSpawnerChanger).setNoText());
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
@ -29,45 +32,40 @@ import net.minecraftforge.fml.client.config.GuiUtils;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class BookmarkButton extends GuiButton{
|
public class BookmarkButton extends GuiButton {
|
||||||
|
|
||||||
private final GuiBooklet booklet;
|
private final GuiBooklet booklet;
|
||||||
public IBookletPage assignedPage;
|
public IBookletPage assignedPage;
|
||||||
|
|
||||||
public BookmarkButton(int id, int x, int y, GuiBooklet booklet){
|
public BookmarkButton(int id, int x, int y, GuiBooklet booklet) {
|
||||||
super(id, x, y, 16, 16, "");
|
super(id, x, y, 16, 16, "");
|
||||||
this.booklet = booklet;
|
this.booklet = booklet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPressed(){
|
public void onPressed() {
|
||||||
if(this.assignedPage != null){
|
if (this.assignedPage != null) {
|
||||||
if(GuiScreen.isShiftKeyDown()){
|
if (GuiScreen.isShiftKeyDown()) {
|
||||||
this.assignedPage = null;
|
this.assignedPage = null;
|
||||||
}
|
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
||||||
else if(!(this.booklet instanceof GuiPage) || ((GuiPage)this.booklet).pages[0] != this.assignedPage){
|
|
||||||
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage);
|
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage);
|
||||||
Minecraft.getMinecraft().displayGuiScreen(gui);
|
Minecraft.getMinecraft().displayGuiScreen(gui);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
if (this.booklet instanceof GuiPage) {
|
||||||
if(this.booklet instanceof GuiPage){
|
this.assignedPage = ((GuiPage) this.booklet).pages[0];
|
||||||
this.assignedPage = ((GuiPage)this.booklet).pages[0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawButton(Minecraft minecraft, int x, int y, float f){
|
public void drawButton(Minecraft minecraft, int x, int y, float f) {
|
||||||
if(this.visible){
|
if (this.visible) {
|
||||||
minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.hovered = x >= this.x && y >= this.y && x < this.x+this.width && y < this.y+this.height;
|
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||||
int k = this.getHoverState(this.hovered);
|
int k = this.getHoverState(this.hovered);
|
||||||
if(k == 0){
|
if (k == 0) {
|
||||||
k = 1;
|
k = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,39 +73,37 @@ public class BookmarkButton extends GuiButton{
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.blendFunc(770, 771);
|
GlStateManager.blendFunc(770, 771);
|
||||||
int renderHeight = 25;
|
int renderHeight = 25;
|
||||||
this.drawTexturedModalRect(this.x, this.y, 224+(this.assignedPage == null ? 0 : 16), 14-renderHeight+k*renderHeight, this.width, renderHeight);
|
this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null ? 0 : 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight);
|
||||||
this.mouseDragged(minecraft, x, y);
|
this.mouseDragged(minecraft, x, y);
|
||||||
|
|
||||||
if(this.assignedPage != null){
|
if (this.assignedPage != null) {
|
||||||
ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
|
ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
|
||||||
if(StackUtil.isValid(display)){
|
if (StackUtil.isValid(display)) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
AssetUtil.renderStackToGui(display, this.x+2, this.y+1, 0.725F);
|
AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawHover(int mouseX, int mouseY){
|
public void drawHover(int mouseX, int mouseY) {
|
||||||
if(this.isMouseOver()){
|
if (this.isMouseOver()) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
|
|
||||||
if(this.assignedPage != null){
|
if (this.assignedPage != null) {
|
||||||
IBookletChapter chapter = this.assignedPage.getChapter();
|
IBookletChapter chapter = this.assignedPage.getChapter();
|
||||||
|
|
||||||
list.add(TextFormatting.GOLD+chapter.getLocalizedName()+", Page "+(chapter.getPageIndex(this.assignedPage)+1));
|
list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1));
|
||||||
list.add(StringUtil.localize("booklet."+ActuallyAdditions.MODID+".bookmarkButton.bookmark.openDesc"));
|
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc"));
|
||||||
list.add(TextFormatting.ITALIC+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".bookmarkButton.bookmark.removeDesc"));
|
list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc"));
|
||||||
}
|
} else {
|
||||||
else{
|
list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name"));
|
||||||
list.add(TextFormatting.GOLD+StringUtil.localize("booklet."+ActuallyAdditions.MODID+".bookmarkButton.noBookmark.name"));
|
|
||||||
|
|
||||||
if(this.booklet instanceof GuiPage){
|
if (this.booklet instanceof GuiPage) {
|
||||||
list.add(StringUtil.localize("booklet."+ActuallyAdditions.MODID+".bookmarkButton.noBookmark.pageDesc"));
|
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc"));
|
||||||
}
|
} else {
|
||||||
else{
|
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc"));
|
||||||
list.add(StringUtil.localize("booklet."+ActuallyAdditions.MODID+".bookmarkButton.noBookmark.notPageDesc"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class EntryButton extends GuiButton{
|
public class EntryButton extends GuiButton {
|
||||||
|
|
||||||
private final GuiBookletBase gui;
|
private final GuiBookletBase gui;
|
||||||
private final ItemStack stackToRender;
|
private final ItemStack stackToRender;
|
||||||
|
|
||||||
public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender){
|
public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender) {
|
||||||
super(id, x, y, width, height, text);
|
super(id, x, y, width, height, text);
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
StackUtil.isValid(stackToRender);
|
StackUtil.isValid(stackToRender);
|
||||||
|
@ -35,32 +35,32 @@ public class EntryButton extends GuiButton{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f){
|
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) {
|
||||||
if(this.visible){
|
if (this.visible) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x+this.width && mouseY < this.y+this.height;
|
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.blendFunc(770, 771);
|
GlStateManager.blendFunc(770, 771);
|
||||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||||
|
|
||||||
int textOffsetX = 0;
|
int textOffsetX = 0;
|
||||||
if(StackUtil.isValid(this.stackToRender)){
|
if (StackUtil.isValid(this.stackToRender)) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
AssetUtil.renderStackToGui(this.stackToRender, this.x-4, this.y, 0.725F);
|
AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
textOffsetX = 10;
|
textOffsetX = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
float scale = this.gui.getMediumFontSize();
|
float scale = this.gui.getMediumFontSize();
|
||||||
|
|
||||||
if(this.hovered){
|
if (this.hovered) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
AssetUtil.drawHorizontalGradientRect(this.x+textOffsetX-1, this.y+this.height-1, this.x+(int)(minecraft.fontRenderer.getStringWidth(this.displayString)*scale)+textOffsetX+1, this.y+this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
|
AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.fontRenderer.getStringWidth(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringUtil.renderScaledAsciiString(minecraft.fontRenderer, this.displayString, this.x+textOffsetX, this.y+2+(this.height-8)/2, 0, false, scale);
|
StringUtil.renderScaledAsciiString(minecraft.fontRenderer, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,36 +16,34 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public class TrialsButton extends TexturedButton{
|
public class TrialsButton extends TexturedButton {
|
||||||
|
|
||||||
private final boolean isTrials;
|
private final boolean isTrials;
|
||||||
|
|
||||||
public TrialsButton(GuiBooklet gui){
|
public TrialsButton(GuiBooklet gui) {
|
||||||
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft()+gui.getSizeX(), gui.getGuiTop()+10, 0, 204, 52, 16);
|
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16);
|
||||||
this.isTrials = gui.areTrialsOpened();
|
this.isTrials = gui.areTrialsOpened();
|
||||||
this.enabled = !this.isTrials;
|
this.enabled = !this.isTrials;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawButton(Minecraft minecraft, int x, int y, float f){
|
public void drawButton(Minecraft minecraft, int x, int y, float f) {
|
||||||
super.drawButton(minecraft, x, y, f);
|
super.drawButton(minecraft, x, y, f);
|
||||||
|
|
||||||
if(this.visible){
|
if (this.visible) {
|
||||||
if(this.hovered || this.isTrials){
|
if (this.hovered || this.isTrials) {
|
||||||
this.drawCenteredString(minecraft.fontRenderer, StringUtil.localize("booklet."+ActuallyAdditions.MODID+".trialsButton.name"), this.x+(this.width-8)/2, this.y+(this.height-8)/2, 14737632);
|
this.drawCenteredString(minecraft.fontRenderer, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getHoverState(boolean mouseOver){
|
protected int getHoverState(boolean mouseOver) {
|
||||||
if(mouseOver || this.isTrials){
|
if (mouseOver || this.isTrials) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
} else if (!this.enabled) {
|
||||||
else if(!this.enabled){
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BookletChapter implements IBookletChapter{
|
public class BookletChapter implements IBookletChapter {
|
||||||
|
|
||||||
public final IBookletPage[] pages;
|
public final IBookletPage[] pages;
|
||||||
public final IBookletEntry entry;
|
public final IBookletEntry entry;
|
||||||
|
@ -30,78 +30,76 @@ public class BookletChapter implements IBookletChapter{
|
||||||
private final int priority;
|
private final int priority;
|
||||||
public TextFormatting color;
|
public TextFormatting color;
|
||||||
|
|
||||||
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages){
|
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||||
this(identifier, entry, displayStack, 0, pages);
|
this(identifier, entry, displayStack, 0, pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages){
|
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
|
||||||
this.pages = pages;
|
this.pages = pages;
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
this.displayStack = displayStack;
|
this.displayStack = displayStack;
|
||||||
if(displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) displayStack = ItemStack.EMPTY;
|
if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) displayStack = ItemStack.EMPTY;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
this.color = TextFormatting.RESET;
|
this.color = TextFormatting.RESET;
|
||||||
|
|
||||||
this.entry.addChapter(this);
|
this.entry.addChapter(this);
|
||||||
for(IBookletPage page : this.pages){
|
for (IBookletPage page : this.pages) {
|
||||||
page.setChapter(this);
|
page.setChapter(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBookletPage[] getAllPages(){
|
public IBookletPage[] getAllPages() {
|
||||||
return this.pages;
|
return this.pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public String getLocalizedName(){
|
public String getLocalizedName() {
|
||||||
return StringUtil.localize("booklet."+ActuallyAdditions.MODID+".chapter."+this.getIdentifier()+".name");
|
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public String getLocalizedNameWithFormatting(){
|
public String getLocalizedNameWithFormatting() {
|
||||||
return this.color+this.getLocalizedName();
|
return this.color + this.getLocalizedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBookletEntry getEntry(){
|
public IBookletEntry getEntry() {
|
||||||
return this.entry;
|
return this.entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getDisplayItemStack(){
|
public ItemStack getDisplayItemStack() {
|
||||||
return this.displayStack;
|
return this.displayStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getIdentifier(){
|
public String getIdentifier() {
|
||||||
return this.identifier;
|
return this.identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPageIndex(IBookletPage page){
|
public int getPageIndex(IBookletPage page) {
|
||||||
for(int i = 0; i < this.pages.length; i++){
|
for (int i = 0; i < this.pages.length; i++) {
|
||||||
if(this.pages[i] == page){
|
if (this.pages[i] == page) { return i; }
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSortingPriority(){
|
public int getSortingPriority() {
|
||||||
return this.priority;
|
return this.priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BookletChapter setImportant(){
|
public BookletChapter setImportant() {
|
||||||
this.color = TextFormatting.DARK_GREEN;
|
this.color = TextFormatting.DARK_GREEN;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BookletChapter setSpecial(){
|
public BookletChapter setSpecial() {
|
||||||
this.color = TextFormatting.DARK_PURPLE;
|
this.color = TextFormatting.DARK_PURPLE;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
|
@ -19,23 +23,19 @@ import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class BookletChapterCoffee extends BookletChapter {
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BookletChapterCoffee extends BookletChapter{
|
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
|
||||||
|
|
||||||
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages){
|
|
||||||
super(identifier, entry, displayStack, getPages(pages));
|
super(identifier, entry, displayStack, getPages(pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBookletPage[] getPages(IBookletPage... pages){
|
private static IBookletPage[] getPages(IBookletPage... pages) {
|
||||||
List<IBookletPage> allPages = new ArrayList<>();
|
List<IBookletPage> allPages = new ArrayList<>();
|
||||||
allPages.addAll(Arrays.asList(pages));
|
allPages.addAll(Arrays.asList(pages));
|
||||||
|
|
||||||
for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
|
for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
|
||||||
BookletPage page = new PageCoffeeMachine(allPages.size()+1, ingredient);
|
BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
|
||||||
if(!(ingredient instanceof ItemCoffee.MilkIngredient)){
|
if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
|
||||||
page.setNoText();
|
page.setNoText();
|
||||||
}
|
}
|
||||||
allPages.add(page);
|
allPages.add(page);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue