mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-24 08:08:34 +01:00
Convert to skeletal project
This commit is contained in:
parent
36aeb38ce7
commit
6ef5e409c7
476 changed files with 77 additions and 48282 deletions
|
@ -1,332 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ActuallyAdditionsAPI.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
|
||||||
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
|
|
||||||
public final class ActuallyAdditionsAPI {
|
|
||||||
|
|
||||||
public static final String MOD_ID = "actuallyadditions";
|
|
||||||
public static final String API_ID = MOD_ID + "api";
|
|
||||||
public static final String API_VERSION = "34";
|
|
||||||
|
|
||||||
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
|
||||||
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
|
|
||||||
public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
|
|
||||||
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
|
|
||||||
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
|
||||||
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
|
||||||
/**
|
|
||||||
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
|
||||||
*/
|
|
||||||
public static final List<IFarmerBehavior> FARMER_BEHAVIORS = new ArrayList<>();
|
|
||||||
public static final List<CoffeeIngredient> COFFEE_MACHINE_INGREDIENTS = new ArrayList<>();
|
|
||||||
public static final List<CompostRecipe> COMPOST_RECIPES = new ArrayList<>();
|
|
||||||
public static final List<OilGenRecipe> OIL_GENERATOR_RECIPES = new ArrayList<>();
|
|
||||||
public static final List<IBookletEntry> BOOKLET_ENTRIES = new ArrayList<>();
|
|
||||||
//This is added to automatically, you don't need to add anything to this list
|
|
||||||
public static final List<IBookletChapter> ALL_CHAPTERS = new ArrayList<>();
|
|
||||||
//This is added to automatically, you don't need to add anything to this list
|
|
||||||
public static final List<IBookletPage> BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA = new ArrayList<>();
|
|
||||||
public static final List<WeightedOre> STONE_ORES = new ArrayList<>();
|
|
||||||
public static final List<WeightedOre> NETHERRACK_ORES = new ArrayList<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this to handle things that aren't based in the API itself
|
|
||||||
* DO NOT CHANGE/OVERRIDE THIS!!
|
|
||||||
* This is getting initialized in Actually Additions' PreInit phase
|
|
||||||
*/
|
|
||||||
public static IMethodHandler methodHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this to add, remove or get Laser Relay Connections and Networks
|
|
||||||
* The network system is built in a way that doesn't need the individual
|
|
||||||
* positions to be Laser Relays, it relies only on BlockPos
|
|
||||||
* DO NOT CHANGE/OVERRIDE THIS!!
|
|
||||||
* This is getting initialized in Actually Additions' PreInit phase
|
|
||||||
*/
|
|
||||||
public static ILaserRelayConnectionHandler connectionHandler;
|
|
||||||
|
|
||||||
//These are getting initialized in Actually Additions' PreInit phase
|
|
||||||
//DO NOT CHANGE/OVERRIDE THESE!!
|
|
||||||
public static IBookletEntry entryGettingStarted;
|
|
||||||
public static IBookletEntry entryReconstruction;
|
|
||||||
public static IBookletEntry entryLaserRelays;
|
|
||||||
public static IBookletEntry entryFunctionalNonRF;
|
|
||||||
public static IBookletEntry entryFunctionalRF;
|
|
||||||
public static IBookletEntry entryGeneratingRF;
|
|
||||||
public static IBookletEntry entryItemsNonRF;
|
|
||||||
public static IBookletEntry entryItemsRF;
|
|
||||||
public static IBookletEntry entryMisc;
|
|
||||||
public static IBookletEntry entryUpdatesAndInfos;
|
|
||||||
//This is added to automatically, you don't need to add anything to this entry
|
|
||||||
public static IBookletEntry entryAllAndSearch;
|
|
||||||
public static IBookletEntry entryTrials;
|
|
||||||
|
|
||||||
//These are getting initialized in Actually Additions' PreInit phase
|
|
||||||
//DO NOT CHANGE/OVERRIDE THESE!!
|
|
||||||
public static LensConversion lensDefaultConversion;
|
|
||||||
public static Lens lensDetonation;
|
|
||||||
public static Lens lensDeath;
|
|
||||||
public static Lens lensEvenMoarDeath;
|
|
||||||
public static Lens lensColor;
|
|
||||||
public static Lens lensDisruption;
|
|
||||||
public static Lens lensDisenchanting;
|
|
||||||
public static Lens lensMining;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of stone.
|
|
||||||
* Higher weight means higher occurence.
|
|
||||||
*
|
|
||||||
* @param oreName The ore's name
|
|
||||||
* @param weight The ore's weight
|
|
||||||
*/
|
|
||||||
public static void addMiningLensStoneOre(String oreName, int weight) {
|
|
||||||
STONE_ORES.add(new WeightedOre(oreName, weight));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of netherrack.
|
|
||||||
* Higher weight means higher occurence.
|
|
||||||
*
|
|
||||||
* @param oreName The ore's name
|
|
||||||
* @param weight The ore's weight
|
|
||||||
*/
|
|
||||||
public static void addMiningLensNetherOre(String oreName, int weight) {
|
|
||||||
NETHERRACK_ORES.add(new WeightedOre(oreName, weight));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a Recipe to the Crusher Recipe Registry
|
|
||||||
*
|
|
||||||
* @param input The input as an ItemStack
|
|
||||||
* @param outputOne The first output as an ItemStack
|
|
||||||
* @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)
|
|
||||||
*/
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a Recipe to the Crusher Recipe Registry
|
|
||||||
*
|
|
||||||
* @param input The input as an Ingredient
|
|
||||||
* @param outputOne The first output as an ItemStack
|
|
||||||
* @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)
|
|
||||||
*/
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds multiple Recipes to the Crusher Recipe Registry
|
|
||||||
* Use this if you want to add OreDictionary recipes easier
|
|
||||||
*
|
|
||||||
* @param inputs The inputs as an ItemStack List, stacksizes are ignored
|
|
||||||
* @param outputOnes The first outputs as an ItemStack List, stacksizes are ignored
|
|
||||||
* @param outputOneAmounts The amount of the first output, will be equal for all entries in the list
|
|
||||||
* @param outputTwos The second outputs as a List (can be null or empty if there should be none)
|
|
||||||
* @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)
|
|
||||||
*/
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Same thing as above, but with ItemStack outputs.
|
|
||||||
@Deprecated //Use Ingredient
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a Recipe to the Oil generator
|
|
||||||
*
|
|
||||||
* @param fluidName The name of the fluid to be consumed
|
|
||||||
* @param genAmount The amount of energy generated per operation
|
|
||||||
*/
|
|
||||||
public static void addOilGenRecipe(String fluidName, int genAmount) {
|
|
||||||
addOilGenRecipe(fluidName, genAmount, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a Recipe to the Oil generator
|
|
||||||
*
|
|
||||||
* @param fluidName The name of the fluid to be consumed
|
|
||||||
* @param genAmount The amount of energy generated per operation
|
|
||||||
*/
|
|
||||||
public static void addOilGenRecipe(String fluidName, int genAmount, int genTime) {
|
|
||||||
OIL_GENERATOR_RECIPES.add(new OilGenRecipe(fluidName, genAmount, genTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new conversion recipe to the compost.
|
|
||||||
*
|
|
||||||
* @param input The itemstack to be input into the compost
|
|
||||||
* @param inputDisplay The block to display when there is input in the compost
|
|
||||||
* @param output The itemstack to be output from the compost once conversion finishes
|
|
||||||
* @param outputDisplay The block to display when there is output in the compost
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
|
||||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new conversion recipe to the compost.
|
|
||||||
*
|
|
||||||
* @param input The ingredient to be input into the compost
|
|
||||||
* @param inputDisplay The state to display when there is input in the compost
|
|
||||||
* @param output The itemstack to be output from the compost once conversion finishes
|
|
||||||
* @param outputDisplay The state to display when there is output in the compost
|
|
||||||
*/
|
|
||||||
public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) {
|
|
||||||
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an item to the list of possible items to be returned when right-clicking a Ball Of Fur
|
|
||||||
*
|
|
||||||
* @param stack The ItemStack to be returned
|
|
||||||
* @param chance The chance (this is from WeightedRandom.Item)
|
|
||||||
*/
|
|
||||||
public static void addBallOfFurReturnItem(ItemStack stack, int chance) {
|
|
||||||
BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an item to the list of possible items to be returned when opening a Treasure Chest
|
|
||||||
*
|
|
||||||
* @param stack The ItemStack to be returned, the stacksize is ignored
|
|
||||||
* @param chance The chance (this is from WeightedRandom.Item)
|
|
||||||
* @param minAmount The minimum 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) {
|
|
||||||
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
|
||||||
* StackSizes can only be 1 and greater ones will be ignored
|
|
||||||
*
|
|
||||||
* @param input The input as an ItemStack
|
|
||||||
* @param output The output as an ItemStack
|
|
||||||
* @param energyUse The amount of RF used per conversion
|
|
||||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
|
||||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type) {
|
|
||||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse) {
|
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a recipe to the Atomic Reconstructor conversion lenses
|
|
||||||
* StackSizes can only be 1 and greater ones will be ignored
|
|
||||||
*
|
|
||||||
* @param input The input as an ItemStack
|
|
||||||
* @param output The output as an ItemStack
|
|
||||||
* @param energyUse The amount of RF used per conversion
|
|
||||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
|
||||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
|
||||||
*/
|
|
||||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type) {
|
|
||||||
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse) {
|
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an item and the way it is modified to the Atomic Reconstructor's color lens.
|
|
||||||
* This also works for blocks, but they have to be in their item form.
|
|
||||||
* The way it is modified is an instance of IColorLensChanger. When modifying the item,
|
|
||||||
* its modifyItem() method will be called with a stack containing the item.
|
|
||||||
*
|
|
||||||
* @param item The item (or block's item) to add
|
|
||||||
* @param changer The change mechanism
|
|
||||||
*/
|
|
||||||
public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer) {
|
|
||||||
RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an ingredient to the Coffee Machine ingredient list
|
|
||||||
*
|
|
||||||
* @param ingredient The ingredient to add
|
|
||||||
*/
|
|
||||||
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient) {
|
|
||||||
COFFEE_MACHINE_INGREDIENTS.add(ingredient);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a booklet entry to the list of entries
|
|
||||||
*
|
|
||||||
* @param entry The entry to add
|
|
||||||
*/
|
|
||||||
public static void addBookletEntry(IBookletEntry entry) {
|
|
||||||
BOOKLET_ENTRIES.add(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new farmer behavior to the Farmer
|
|
||||||
*
|
|
||||||
* @param behavior The behavior to add
|
|
||||||
*/
|
|
||||||
public static void addFarmerBehavior(IFarmerBehavior behavior) {
|
|
||||||
FARMER_BEHAVIORS.add(behavior);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IBookletChapter.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public interface IBookletChapter {
|
|
||||||
|
|
||||||
IBookletPage[] getAllPages();
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
String getLocalizedName();
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
String getLocalizedNameWithFormatting();
|
|
||||||
|
|
||||||
IBookletEntry getEntry();
|
|
||||||
|
|
||||||
ItemStack getDisplayItemStack();
|
|
||||||
|
|
||||||
String getIdentifier();
|
|
||||||
|
|
||||||
int getPageIndex(IBookletPage page);
|
|
||||||
|
|
||||||
int getSortingPriority();
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IBookletEntry.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public interface IBookletEntry {
|
|
||||||
|
|
||||||
List<IBookletChapter> getAllChapters();
|
|
||||||
|
|
||||||
String getIdentifier();
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
String getLocalizedName();
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
String getLocalizedNameWithFormatting();
|
|
||||||
|
|
||||||
void addChapter(IBookletChapter chapter);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
List<IBookletChapter> getChaptersForDisplay(String searchBarText);
|
|
||||||
|
|
||||||
int getSortingPriority();
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
boolean visibleOnFrontPage();
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IBookletPage.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public interface IBookletPage {
|
|
||||||
|
|
||||||
void getItemStacksForPage(List<ItemStack> list);
|
|
||||||
|
|
||||||
void getFluidStacksForPage(List<FluidStack> list);
|
|
||||||
|
|
||||||
IBookletChapter getChapter();
|
|
||||||
|
|
||||||
void setChapter(IBookletChapter chapter);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
String getInfoText();
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void actionPerformed(GuiBookletBase gui, GuiButton button);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void initGui(GuiBookletBase gui, int startX, int startY);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
|
|
||||||
|
|
||||||
boolean shouldBeOnLeftSide();
|
|
||||||
|
|
||||||
String getIdentifier();
|
|
||||||
|
|
||||||
String getWebLink();
|
|
||||||
|
|
||||||
IBookletPage addTextReplacement(String key, String value);
|
|
||||||
|
|
||||||
IBookletPage addTextReplacement(String key, float value);
|
|
||||||
|
|
||||||
IBookletPage addTextReplacement(String key, int value);
|
|
||||||
|
|
||||||
int getSortingPriority();
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("GuiBookletBase.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet.internal;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
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 renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length);
|
|
||||||
|
|
||||||
public abstract List<GuiButton> getButtonList();
|
|
||||||
|
|
||||||
public abstract int getGuiLeft();
|
|
||||||
|
|
||||||
public abstract int getGuiTop();
|
|
||||||
|
|
||||||
public abstract int getSizeX();
|
|
||||||
|
|
||||||
public abstract int getSizeY();
|
|
||||||
|
|
||||||
public abstract void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer);
|
|
||||||
|
|
||||||
public abstract float getSmallFontSize();
|
|
||||||
|
|
||||||
public abstract float getMediumFontSize();
|
|
||||||
|
|
||||||
public abstract float getLargeFontSize();
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("FarmerResult.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.farmer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return values for IFarmerBehavior, each one has a different meaning in harvest and planting contexts.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public enum FarmerResult {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates that your behavior failed to perform the action it attempted.
|
|
||||||
*/
|
|
||||||
FAIL,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates that your behavior succeeded doing the action it attempted. For harvesting, this also shrinks the current stack by one, and stops processing.
|
|
||||||
*/
|
|
||||||
SUCCESS,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates you want the farmer to halt all further actions this tick. This will exit the farmer behavior loop if returned.
|
|
||||||
*/
|
|
||||||
STOP_PROCESSING
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IFarmerBehavior.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.farmer;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IFarmer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IFarmerBehavior {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to plant a seed with this behavior
|
|
||||||
* If this method returns true, the seed ItemStack will be shrunk by one.
|
|
||||||
* This method will not be called if the block at the given position is not replaceable.
|
|
||||||
*
|
|
||||||
* @param seed The seed stack to plant
|
|
||||||
* @param world The world
|
|
||||||
* @param pos The position to plant the seed on
|
|
||||||
* @param farmer The Farmer doing this action. Can be used to query and extract energy and add items to the slots
|
|
||||||
* @return If planting was successful
|
|
||||||
*/
|
|
||||||
FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to harvest a plant with this behavior
|
|
||||||
*
|
|
||||||
* @param world The world
|
|
||||||
* @param pos The position of the plant
|
|
||||||
* @param farmer The Farmer doing this action. Can be used to query and extract energy and add items to the slots
|
|
||||||
* @return If harvesting was successful
|
|
||||||
*/
|
|
||||||
FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer);
|
|
||||||
|
|
||||||
int getPriority();
|
|
||||||
|
|
||||||
default Integer getPrioInt() {
|
|
||||||
return getPriority();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IAtomicReconstructor.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.internal;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a helper interface for Lens' invoke() method.
|
|
||||||
* <p>
|
|
||||||
* This is not supposed to be implemented.
|
|
||||||
* Can be cast to TileEntity.
|
|
||||||
*/
|
|
||||||
public interface IAtomicReconstructor extends IEnergyTile {
|
|
||||||
|
|
||||||
Lens getLens();
|
|
||||||
|
|
||||||
EnumFacing getOrientation();
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IEnergyTile.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.internal;
|
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is not supposed to be implemented.
|
|
||||||
* Can be cast to TileEntity.
|
|
||||||
*/
|
|
||||||
public interface IEnergyTile {
|
|
||||||
|
|
||||||
BlockPos getPosition();
|
|
||||||
|
|
||||||
int getX();
|
|
||||||
|
|
||||||
int getY();
|
|
||||||
|
|
||||||
int getZ();
|
|
||||||
|
|
||||||
//TODO: Rename to getWorld
|
|
||||||
World getWorldObject();
|
|
||||||
|
|
||||||
void extractEnergy(int amount);
|
|
||||||
|
|
||||||
int getEnergy();
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IFarmer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.internal;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a helper interface for IFarmerBehavior.
|
|
||||||
* <p>
|
|
||||||
* This is not supposed to be implemented.
|
|
||||||
* Can be cast to TileEntity.
|
|
||||||
*/
|
|
||||||
public interface IFarmer extends IEnergyTile {
|
|
||||||
|
|
||||||
EnumFacing getOrientation();
|
|
||||||
|
|
||||||
boolean canAddToSeeds(List<ItemStack> stacks);
|
|
||||||
|
|
||||||
boolean canAddToOutput(List<ItemStack> stacks);
|
|
||||||
|
|
||||||
void addToSeeds(List<ItemStack> stacks);
|
|
||||||
|
|
||||||
void addToOutput(List<ItemStack> stacks);
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IMethodHandler.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.internal;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.potion.PotionEffect;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the internal method handler.
|
|
||||||
* Use ActuallyAdditionsAPI.methodHandler for calling
|
|
||||||
* This is not supposed to be implemented.
|
|
||||||
*/
|
|
||||||
public interface IMethodHandler {
|
|
||||||
|
|
||||||
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
|
|
||||||
|
|
||||||
PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect);
|
|
||||||
|
|
||||||
void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp);
|
|
||||||
|
|
||||||
void addEffectToStack(ItemStack stack, PotionEffect effect);
|
|
||||||
|
|
||||||
PotionEffect[] getEffectsFromStack(ItemStack stack);
|
|
||||||
|
|
||||||
boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
|
||||||
|
|
||||||
boolean invokeReconstructor(IAtomicReconstructor tile);
|
|
||||||
|
|
||||||
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
|
|
||||||
boolean addCrusherRecipes(List<ItemStack> inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance);
|
|
||||||
|
|
||||||
IBookletPage generateTextPage(int id);
|
|
||||||
|
|
||||||
IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY);
|
|
||||||
|
|
||||||
IBookletPage generateCraftingPage(int id, IRecipe... recipes);
|
|
||||||
|
|
||||||
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result);
|
|
||||||
|
|
||||||
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages);
|
|
||||||
|
|
||||||
IBookletPage generateTextPage(int id, int priority);
|
|
||||||
|
|
||||||
IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY, int priority);
|
|
||||||
|
|
||||||
IBookletPage generateCraftingPage(int id, int priority, IRecipe... recipes);
|
|
||||||
|
|
||||||
IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result, int priority);
|
|
||||||
|
|
||||||
IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages);
|
|
||||||
|
|
||||||
IBookletChapter createTrial(String identifier, ItemStack displayStack, boolean textOnSecondPage);
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IConnectionPair.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.laser;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
public interface IConnectionPair {
|
|
||||||
|
|
||||||
void writeToNBT(NBTTagCompound compound);
|
|
||||||
|
|
||||||
void readFromNBT(NBTTagCompound compound);
|
|
||||||
|
|
||||||
BlockPos[] getPositions();
|
|
||||||
|
|
||||||
boolean doesSuppressRender();
|
|
||||||
|
|
||||||
LaserType getType();
|
|
||||||
|
|
||||||
boolean contains(BlockPos pos);
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ILaserRelayConnectionHandler.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.laser;
|
|
||||||
|
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the internal laser relay connection handler.
|
|
||||||
* Use ActuallyAdditionsAPI.connectionHandler for calling
|
|
||||||
* This is not supposed to be implemented.
|
|
||||||
* <p>
|
|
||||||
* The network system is built in a way that doesn't need the individual
|
|
||||||
* positions to be Laser Relays, it relies only on BlockPos
|
|
||||||
*/
|
|
||||||
public interface ILaserRelayConnectionHandler {
|
|
||||||
|
|
||||||
ConcurrentSet<IConnectionPair> getConnectionsFor(BlockPos relay, World world);
|
|
||||||
|
|
||||||
void removeRelayFromNetwork(BlockPos relay, World world);
|
|
||||||
|
|
||||||
Network getNetworkFor(BlockPos relay, World world);
|
|
||||||
|
|
||||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world);
|
|
||||||
|
|
||||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender);
|
|
||||||
|
|
||||||
boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected);
|
|
||||||
|
|
||||||
void removeConnection(World world, BlockPos firstRelay, BlockPos secondRelay);
|
|
||||||
|
|
||||||
LaserType getTypeFromLaser(TileEntity tile);
|
|
||||||
|
|
||||||
LaserType getTypeFromLaser(BlockPos pos, World world);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("LaserType.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.laser;
|
|
||||||
|
|
||||||
public enum LaserType {
|
|
||||||
ENERGY,
|
|
||||||
ITEM,
|
|
||||||
FLUID
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("Network.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.laser;
|
|
||||||
|
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
|
||||||
|
|
||||||
public class Network {
|
|
||||||
|
|
||||||
public final ConcurrentSet<IConnectionPair> connections = new ConcurrentSet<>();
|
|
||||||
public int changeAmount;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.connections.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof Network) {
|
|
||||||
if (this.connections.equals(((Network) obj).connections)) { return true; }
|
|
||||||
}
|
|
||||||
return super.equals(obj);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ILensItem.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.lens;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the base class for a Reconstructor Lens Item
|
|
||||||
*/
|
|
||||||
public interface ILensItem {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the lens type that belongs to this lens item
|
|
||||||
*/
|
|
||||||
Lens getLens();
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("Lens.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.lens;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
|
|
||||||
*/
|
|
||||||
public abstract class Lens {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invokes the lens type's behavior on a block
|
|
||||||
*
|
|
||||||
* @param hitBlock The block that was hit
|
|
||||||
* @param tile The tile the lens was invoked from
|
|
||||||
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
|
|
||||||
*/
|
|
||||||
public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the color in an array of 3 float values that are r, g, b
|
|
||||||
*/
|
|
||||||
public abstract float[] getColor();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the maximum distance the beam goes with this lens
|
|
||||||
*/
|
|
||||||
public abstract int getDistance();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If the lens can be invoked at the current time
|
|
||||||
*/
|
|
||||||
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("LensConversion.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.lens;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the base class for a Reconstructor Lens Type that converts two items
|
|
||||||
* via the ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES list.
|
|
||||||
* <p>
|
|
||||||
* If you want to make a new type of conversion, just use your type in the recipe
|
|
||||||
* If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion.
|
|
||||||
*/
|
|
||||||
public class LensConversion extends Lens {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
|
||||||
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float[] getColor() {
|
|
||||||
return new float[] { 27F / 255F, 109F / 255F, 1F };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDistance() {
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package de.ellpeck.actuallyadditions.api.misc;
|
|
||||||
|
|
||||||
public interface IDisableableItem {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an item that can be disabled in the configuration of the mod.
|
|
||||||
* If this returns true, assume the item is not registered with the game, but may still be instantiated.
|
|
||||||
* @return If the item has not been registered with the Forge Registry.
|
|
||||||
*/
|
|
||||||
public boolean isDisabled();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IDisplayStandItem.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.misc;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
public interface IDisplayStandItem {
|
|
||||||
|
|
||||||
boolean update(ItemStack stack, TileEntity tile, int elapsedTicks);
|
|
||||||
|
|
||||||
int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IGoggles.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.misc;
|
|
||||||
|
|
||||||
public interface IGoggles {
|
|
||||||
|
|
||||||
boolean displaySpectralMobs();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("package-info.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
@API(owner = ActuallyAdditionsAPI.MOD_ID, apiVersion = ActuallyAdditionsAPI.API_VERSION, provides = ActuallyAdditionsAPI.API_ID)
|
|
||||||
package de.ellpeck.actuallyadditions.api;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.API;
|
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BallOfFurReturn.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
|
||||||
|
|
||||||
public class BallOfFurReturn extends WeightedRandom.Item {
|
|
||||||
|
|
||||||
public final ItemStack returnItem;
|
|
||||||
|
|
||||||
public BallOfFurReturn(ItemStack returnItem, int chance) {
|
|
||||||
super(chance);
|
|
||||||
this.returnItem = returnItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("CoffeeIngredient.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
import net.minecraft.potion.PotionEffect;
|
|
||||||
|
|
||||||
public class CoffeeIngredient {
|
|
||||||
|
|
||||||
protected final Ingredient input;
|
|
||||||
protected final int maxAmplifier;
|
|
||||||
protected PotionEffect[] effects;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public CoffeeIngredient(ItemStack input, PotionEffect[] effects, int maxAmplifier) {
|
|
||||||
this(Ingredient.fromStacks(input), maxAmplifier, effects);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CoffeeIngredient(Ingredient input, int maxAmplifier, PotionEffect... effects) {
|
|
||||||
this.input = input;
|
|
||||||
this.effects = effects;
|
|
||||||
this.maxAmplifier = maxAmplifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
|
||||||
return this.input.apply(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getInput() {
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PotionEffect[] getEffects() {
|
|
||||||
return this.effects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean effect(ItemStack stack) {
|
|
||||||
return ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExtraText() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxAmplifier() {
|
|
||||||
return this.maxAmplifier;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ColorLensChangerByDyeMeta.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes an item's color by changing its metadata.
|
|
||||||
* Much like dye and wool, 0 is white and 15 is black and it will cycle around.
|
|
||||||
*/
|
|
||||||
public class ColorLensChangerByDyeMeta implements IColorLensChanger {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
|
|
||||||
ItemStack newStack = stack.copy();
|
|
||||||
int meta = newStack.getItemDamage();
|
|
||||||
newStack.setItemDamage((meta + 1) % 16);
|
|
||||||
return newStack;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("CompostRecipe.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
|
|
||||||
public class CompostRecipe {
|
|
||||||
|
|
||||||
protected final Ingredient input;
|
|
||||||
protected final ItemStack output;
|
|
||||||
protected final IBlockState inputDisplay;
|
|
||||||
protected final IBlockState outputDisplay;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
|
|
||||||
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
|
|
||||||
}
|
|
||||||
|
|
||||||
public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) {
|
|
||||||
this.input = input;
|
|
||||||
this.output = output;
|
|
||||||
this.inputDisplay = inputDisplay;
|
|
||||||
this.outputDisplay = outputDisplay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
|
||||||
return this.input.apply(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getInput() {
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getOutput() {
|
|
||||||
return this.output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBlockState getInputDisplay() {
|
|
||||||
return this.inputDisplay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBlockState getOutputDisplay() {
|
|
||||||
return this.outputDisplay;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("CrusherRecipe.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
|
|
||||||
public class CrusherRecipe {
|
|
||||||
|
|
||||||
protected Ingredient input;
|
|
||||||
protected ItemStack outputOne;
|
|
||||||
protected ItemStack outputTwo;
|
|
||||||
protected int outputChance;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public CrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
|
||||||
this(Ingredient.fromStacks(input), outputOne, outputTwo, outputChance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
|
|
||||||
this.input = input;
|
|
||||||
this.outputOne = outputOne;
|
|
||||||
this.outputTwo = outputTwo;
|
|
||||||
this.outputChance = outputChance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(ItemStack stack) {
|
|
||||||
return this.input.apply(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getOutputOne() {
|
|
||||||
return this.outputOne;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getOutputTwo() {
|
|
||||||
return this.outputTwo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSecondChance() {
|
|
||||||
return this.outputChance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getInput() {
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("EmpowererRecipe.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
|
|
||||||
public class EmpowererRecipe {
|
|
||||||
|
|
||||||
protected final Ingredient input;
|
|
||||||
protected final ItemStack output;
|
|
||||||
|
|
||||||
protected final Ingredient modifier1;
|
|
||||||
protected final Ingredient modifier2;
|
|
||||||
protected final Ingredient modifier3;
|
|
||||||
protected final Ingredient modifier4;
|
|
||||||
|
|
||||||
protected final int energyPerStand;
|
|
||||||
protected final float[] particleColor;
|
|
||||||
protected final int time;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
|
||||||
this(Ingredient.fromStacks(input), output, Ingredient.fromStacks(modifier1), Ingredient.fromStacks(modifier2), Ingredient.fromStacks(modifier3), Ingredient.fromStacks(modifier4), energyPerStand, time, particleColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
|
||||||
this.input = input;
|
|
||||||
this.output = output;
|
|
||||||
this.modifier1 = modifier1;
|
|
||||||
this.modifier2 = modifier2;
|
|
||||||
this.modifier3 = modifier3;
|
|
||||||
this.modifier4 = modifier4;
|
|
||||||
this.energyPerStand = energyPerStand;
|
|
||||||
this.particleColor = particleColor;
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
|
||||||
if (!this.input.apply(base)) return false;
|
|
||||||
List<Ingredient> matches = new ArrayList<>();
|
|
||||||
ItemStack[] stacks = { stand1, stand2, stand3, stand4 };
|
|
||||||
boolean[] unused = { true, true, true, true };
|
|
||||||
for (ItemStack s : stacks) {
|
|
||||||
if (unused[0] && this.modifier1.apply(s)) {
|
|
||||||
matches.add(this.modifier1);
|
|
||||||
unused[0] = false;
|
|
||||||
} else if (unused[1] && this.modifier2.apply(s)) {
|
|
||||||
matches.add(this.modifier2);
|
|
||||||
unused[1] = false;
|
|
||||||
} else if (unused[2] && this.modifier3.apply(s)) {
|
|
||||||
matches.add(this.modifier3);
|
|
||||||
unused[2] = false;
|
|
||||||
} else if (unused[3] && this.modifier4.apply(s)) {
|
|
||||||
matches.add(this.modifier4);
|
|
||||||
unused[3] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches.size() == 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getInput() {
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getOutput() {
|
|
||||||
return this.output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getStandOne() {
|
|
||||||
return this.modifier1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getStandTwo() {
|
|
||||||
return this.modifier2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getStandThree() {
|
|
||||||
return this.modifier3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getStandFour() {
|
|
||||||
return this.modifier4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTime() {
|
|
||||||
return this.time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEnergyPerStand() {
|
|
||||||
return this.energyPerStand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float[] getParticleColors() {
|
|
||||||
return this.particleColor;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IColorLensChanger.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for the Atomic Reconstructor's Color Lens changing algorythm.
|
|
||||||
* When registering a new item to be changed, it needs an IColorLensChanger which
|
|
||||||
* is the method with which the item will be changed.
|
|
||||||
* <p>
|
|
||||||
* See ColorLensChangerByDyeMeta for reference.
|
|
||||||
*/
|
|
||||||
public interface IColorLensChanger {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Modifies the given item.
|
|
||||||
* Will only be called with stacks containing items that are registered with
|
|
||||||
* this IColorLensChanger.
|
|
||||||
*
|
|
||||||
* @param stack the stack to modify
|
|
||||||
* @param hitBlockState The state of the block that was hit
|
|
||||||
* @param hitBlock the block that was hit (usually air, or the block that is also in the stack)
|
|
||||||
* @param tile the Reconstructor doing the color conversion
|
|
||||||
* @return the modified stack. Please make sure to return a modified COPY of the input stack.
|
|
||||||
*/
|
|
||||||
ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("LensConversionRecipe.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
public class LensConversionRecipe {
|
|
||||||
|
|
||||||
protected final Ingredient input;
|
|
||||||
protected final ItemStack output;
|
|
||||||
protected final int energy;
|
|
||||||
protected final Lens type;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public LensConversionRecipe(ItemStack input, ItemStack output, int energy, Lens type) {
|
|
||||||
this(Ingredient.fromStacks(input), output, energy, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LensConversionRecipe(Ingredient input, ItemStack output, int energy, Lens type) {
|
|
||||||
this.input = input;
|
|
||||||
this.output = output;
|
|
||||||
this.energy = energy;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(ItemStack input, Lens lens) {
|
|
||||||
return this.input.apply(input) && this.type == lens;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ingredient getInput() {
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getOutput() {
|
|
||||||
return this.output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEnergyUsed() {
|
|
||||||
return this.energy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Lens getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("OilGenRecipe.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
public class OilGenRecipe {
|
|
||||||
|
|
||||||
public final String fluidName;
|
|
||||||
public final int genAmount;
|
|
||||||
public final int genTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Oil generator recipe
|
|
||||||
* @param fluidName The fluid
|
|
||||||
* @param genAmount The power generated, in CF/t
|
|
||||||
* @param genTime The length the fluid burns for, in seconds
|
|
||||||
*/
|
|
||||||
public OilGenRecipe(String fluidName, int genAmount, int genTime) {
|
|
||||||
this.fluidName = fluidName;
|
|
||||||
this.genAmount = genAmount;
|
|
||||||
this.genTime = genTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("TreasureChestLoot.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
|
||||||
|
|
||||||
public class TreasureChestLoot extends WeightedRandom.Item {
|
|
||||||
|
|
||||||
public final ItemStack returnItem;
|
|
||||||
public final int minAmount;
|
|
||||||
public final int maxAmount;
|
|
||||||
|
|
||||||
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount) {
|
|
||||||
super(chance);
|
|
||||||
this.returnItem = returnItem;
|
|
||||||
this.minAmount = minAmount;
|
|
||||||
this.maxAmount = maxAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("WeightedOre.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.recipe;
|
|
||||||
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
|
||||||
|
|
||||||
public class WeightedOre extends WeightedRandom.Item {
|
|
||||||
|
|
||||||
public final String name;
|
|
||||||
|
|
||||||
public WeightedOre(String name, int weight) {
|
|
||||||
super(weight);
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IPhantomTile.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.tile;
|
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector
|
|
||||||
*/
|
|
||||||
public interface IPhantomTile {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If the Phantom Tile is currently bound to anything
|
|
||||||
*/
|
|
||||||
boolean hasBoundPosition();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If the Phantom Tile's bound position is in range
|
|
||||||
*/
|
|
||||||
boolean isBoundThingInRange();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The position this tile is bound to
|
|
||||||
*/
|
|
||||||
BlockPos getBoundPosition();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the bound position
|
|
||||||
*/
|
|
||||||
void setBoundPosition(BlockPos pos);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The ID of the GUI it opens, -1 if none
|
|
||||||
*/
|
|
||||||
int getGuiID();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The range the tile currently has
|
|
||||||
*/
|
|
||||||
int getRange();
|
|
||||||
}
|
|
|
@ -13,155 +13,25 @@ package de.ellpeck.actuallyadditions.mod;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.proxy.IProxy;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
|
|
||||||
import net.minecraft.launchwrapper.Launch;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.common.Mod.Instance;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
|
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
@Mod(modid = ActuallyAdditions.MODID, name = ActuallyAdditions.NAME, version = ActuallyAdditions.VERSION, guiFactory = ActuallyAdditions.GUIFACTORY, dependencies = ActuallyAdditions.DEPS)
|
@Mod(ActuallyAdditions.MODID)
|
||||||
public class ActuallyAdditions {
|
public class ActuallyAdditions {
|
||||||
|
|
||||||
public static final String MODID = ActuallyAdditionsAPI.MOD_ID;
|
public static final String MODID = "actuallyadditions";
|
||||||
public static final String NAME = "Actually Additions";
|
public static final Logger LOGGER = LogManager.getLogger(MODID);
|
||||||
public static final String VERSION = "@VERSION@";
|
|
||||||
public static final String GUIFACTORY = "de.ellpeck.actuallyadditions.mod.config.GuiFactory";
|
|
||||||
public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)";
|
|
||||||
public static final boolean DEOBF = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
|
||||||
|
|
||||||
@Instance
|
public ActuallyAdditions() {
|
||||||
public static ActuallyAdditions INSTANCE;
|
FMLJavaModLoadingContext ctx = FMLJavaModLoadingContext.get();
|
||||||
|
ctx.getModEventBus().register(this);
|
||||||
|
}
|
||||||
|
|
||||||
@SidedProxy(clientSide = "de.ellpeck.actuallyadditions.mod.proxy.ClientProxy", serverSide = "de.ellpeck.actuallyadditions.mod.proxy.ServerProxy")
|
@SubscribeEvent
|
||||||
public static IProxy PROXY;
|
public void setup(FMLCommonSetupEvent e) {
|
||||||
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger(NAME);
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
FluidRegistry.enableUniversalBucket();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean commonCapsLoaded;
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
|
||||||
ActuallyAdditions.LOGGER.info("Starting PreInitialization Phase...");
|
|
||||||
|
|
||||||
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
|
||||||
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
|
||||||
Lenses.init();
|
|
||||||
InitBooklet.preInit();
|
|
||||||
CompatUtil.registerCraftingTweaks();
|
|
||||||
commonCapsLoaded = Loader.isModLoaded("commoncapabilities");
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new RegistryHandler());
|
|
||||||
|
|
||||||
new ConfigurationHandler(event.getSuggestedConfigurationFile());
|
|
||||||
PacketHandler.init();
|
|
||||||
InitToolMaterials.init();
|
|
||||||
InitArmorMaterials.init();
|
|
||||||
InitFluids.init();
|
|
||||||
new UpdateChecker();
|
|
||||||
PROXY.preInit(event);
|
|
||||||
|
|
||||||
ActuallyAdditions.LOGGER.info("PreInitialization Finished.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void init(FMLInitializationEvent event) {
|
|
||||||
ActuallyAdditions.LOGGER.info("Starting Initialization Phase...");
|
|
||||||
|
|
||||||
BannerHelper.init();
|
|
||||||
//InitAchievements.init();
|
|
||||||
GuiHandler.init();
|
|
||||||
AAWorldGen gen = new AAWorldGen();
|
|
||||||
GameRegistry.registerWorldGenerator(gen, 10000);
|
|
||||||
MinecraftForge.TERRAIN_GEN_BUS.register(gen);
|
|
||||||
TileEntityBase.init();
|
|
||||||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
|
||||||
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
|
||||||
InitEntities.init();
|
|
||||||
|
|
||||||
PROXY.init(event);
|
|
||||||
|
|
||||||
RegistryHandler.BLOCKS_TO_REGISTER.clear();
|
|
||||||
|
|
||||||
ActuallyAdditions.LOGGER.info("Initialization Finished.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void postInit(FMLPostInitializationEvent event) {
|
|
||||||
ActuallyAdditions.LOGGER.info("Starting PostInitialization Phase...");
|
|
||||||
|
|
||||||
ItemCoffee.initIngredients();
|
|
||||||
CrusherCrafting.init();
|
|
||||||
HairyBallHandler.init();
|
|
||||||
TreasureChestHandler.init();
|
|
||||||
LensRecipeHandler.init();
|
|
||||||
EmpowererHandler.init();
|
|
||||||
LensMining.init();
|
|
||||||
|
|
||||||
InitBooklet.postInit();
|
|
||||||
PROXY.postInit(event);
|
|
||||||
|
|
||||||
ConfigurationHandler.redefineConfigs();
|
|
||||||
|
|
||||||
ActuallyAdditions.LOGGER.info("PostInitialization Finished.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void serverStarted(FMLServerStartedEvent event) {
|
|
||||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
|
||||||
if (server != null) {
|
|
||||||
World world = server.getEntityWorld();
|
|
||||||
if (world != null && !world.isRemote) {
|
|
||||||
WorldData.get(world, true).markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void serverStopped(FMLServerStoppedEvent event) {
|
|
||||||
WorldData.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
|
||||||
|
@EventBusSubscriber(value = Dist.CLIENT, modid = ActuallyAdditions.MODID, bus = Bus.MOD)
|
||||||
|
public class ActuallyAdditionsClient {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void setup(FMLClientSetupEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,63 +0,0 @@
|
||||||
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.CompostModel;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
|
|
||||||
public class ClientRegistryHandler {
|
|
||||||
|
|
||||||
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
|
||||||
*/
|
|
||||||
private static void registerCustomFluidBlockRenderer(Fluid fluid) {
|
|
||||||
Block block = fluid.getBlock();
|
|
||||||
Item item = Item.getItemFromBlock(block);
|
|
||||||
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
|
||||||
ModelBakery.registerItemVariants(item);
|
|
||||||
ModelLoader.setCustomMeshDefinition(item, mapper);
|
|
||||||
ModelLoader.setCustomStateMapper(block, mapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onModelRegistry(ModelRegistryEvent event) {
|
|
||||||
for (Block block : RegistryHandler.BLOCKS_TO_REGISTER) {
|
|
||||||
if (block instanceof IHasModel) {
|
|
||||||
((IHasModel) block).registerRendering();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()) {
|
|
||||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil);
|
|
||||||
registerCustomFluidBlockRenderer(InitFluids.fluidRefinedCanolaOil);
|
|
||||||
registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
|
||||||
registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onModelBake(ModelBakeEvent e) {
|
|
||||||
ModelResourceLocation mrl = new ModelResourceLocation(new ResourceLocation(ActuallyAdditions.MODID, "block_compost"), "normal");
|
|
||||||
CompostModel.compostBase = e.getModelRegistry().getObject(mrl);
|
|
||||||
e.getModelRegistry().putObject(mrl, new ActualCompostModel());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
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.config.values.ConfigBoolValues;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ore.InitOreDict;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.util.SoundEvent;
|
|
||||||
import net.minecraftforge.event.RegistryEvent.Register;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
|
||||||
|
|
||||||
//Class to wrap around the trainwreck that is the new registry system
|
|
||||||
public class RegistryHandler {
|
|
||||||
|
|
||||||
public static final List<Block> BLOCKS_TO_REGISTER = new ArrayList<>();
|
|
||||||
public static final List<Item> ITEMS_TO_REGISTER = new ArrayList<>();
|
|
||||||
public static final List<SoundEvent> SOUNDS_TO_REGISTER = new ArrayList<>();
|
|
||||||
public static final List<IRecipe> RECIPES_TO_REGISTER = new ArrayList<>();
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onBlockRegistry(Register<Block> event) {
|
|
||||||
InitBlocks.init();
|
|
||||||
|
|
||||||
for (Block block : BLOCKS_TO_REGISTER) {
|
|
||||||
event.getRegistry().register(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onItemRegistry(Register<Item> event) {
|
|
||||||
InitItems.init();
|
|
||||||
|
|
||||||
for (Item item : ITEMS_TO_REGISTER) {
|
|
||||||
event.getRegistry().register(item);
|
|
||||||
}
|
|
||||||
ITEMS_TO_REGISTER.clear();
|
|
||||||
|
|
||||||
//Hack to make this register before recipes :>
|
|
||||||
InitOreDict.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onVillagerRegistry(Register<VillagerProfession> event) {
|
|
||||||
InitVillager.init();
|
|
||||||
|
|
||||||
if (ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.jamProfession);
|
|
||||||
if (ConfigBoolValues.ENGINEER_VILLAGER_EXISTS.isEnabled()) event.getRegistry().register(InitVillager.engineerProfession);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onCraftingRegistry(Register<IRecipe> event) {
|
|
||||||
InitCrafting.init();
|
|
||||||
|
|
||||||
for (IRecipe recipe : RECIPES_TO_REGISTER) {
|
|
||||||
event.getRegistry().register(recipe);
|
|
||||||
}
|
|
||||||
RECIPES_TO_REGISTER.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onSoundRegistry(Register<SoundEvent> event) {
|
|
||||||
SoundHandler.init();
|
|
||||||
|
|
||||||
for (SoundEvent sound : SOUNDS_TO_REGISTER) {
|
|
||||||
event.getRegistry().register(sound);
|
|
||||||
}
|
|
||||||
SOUNDS_TO_REGISTER.clear();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("InitAchievements.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
//TODO Achievements -> Advancements?
|
|
||||||
/*
|
|
||||||
package de.ellpeck.actuallyadditions.mod.achievement;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.stats.Achievement;
|
|
||||||
import net.minecraftforge.common.AchievementPage;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public final class InitAchievements{
|
|
||||||
|
|
||||||
public static final ArrayList<Achievement> ACHIEVEMENT_LIST = new ArrayList<Achievement>();
|
|
||||||
public static int pageNumber;
|
|
||||||
public static AchievementPage theAchievementPage;
|
|
||||||
|
|
||||||
public static void init(){
|
|
||||||
ModUtil.LOGGER.info("Initializing Achievements...");
|
|
||||||
|
|
||||||
for(int i = 0; i < TheAchievements.values().length; i++){
|
|
||||||
ACHIEVEMENT_LIST.add(TheAchievements.values()[i].chieve);
|
|
||||||
}
|
|
||||||
|
|
||||||
theAchievementPage = new AchievementPage(StringUtil.localize("achievement.page."+ModUtil.MOD_ID), ACHIEVEMENT_LIST.toArray(new Achievement[ACHIEVEMENT_LIST.size()]));
|
|
||||||
pageNumber = AchievementPage.getAchievementPages().size();
|
|
||||||
AchievementPage.registerAchievementPage(theAchievementPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Type{
|
|
||||||
CRAFTING,
|
|
||||||
SMELTING,
|
|
||||||
PICK_UP,
|
|
||||||
MISC
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
|
@ -1,146 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("TheAchievements.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
//TODO Fix achievements
|
|
||||||
/*
|
|
||||||
package de.ellpeck.actuallyadditions.mod.achievement;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements.Type;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.stats.Achievement;
|
|
||||||
import net.minecraft.stats.StatisticsManager;
|
|
||||||
import net.minecraft.util.JsonSerializableSet;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public enum TheAchievements{
|
|
||||||
|
|
||||||
OPEN_BOOKLET("openBooklet", 0, 0, new ItemStack(InitItems.itemBooklet), null, Type.MISC),
|
|
||||||
NAME_SMILEY_CLOUD("nameSmileyCloud", 4, 3, new ItemStack(InitBlocks.blockSmileyCloud), null, Type.MISC, true, 0),
|
|
||||||
OPEN_TREASURE_CHEST("openTreasureChest", 1, -3, new ItemStack(InitBlocks.blockTreasureChest), OPEN_BOOKLET, Type.MISC),
|
|
||||||
CRAFT_COAL_GEN("craftCoalGen", -2, 0, new ItemStack(InitBlocks.blockCoalGenerator), OPEN_BOOKLET),
|
|
||||||
CRAFT_LEAF_GEN("craftLeafGen", -3, -2, new ItemStack(InitBlocks.blockLeafGenerator), CRAFT_COAL_GEN),
|
|
||||||
CRAFT_RECONSTRUCTOR("craftReconstructor", -5, 0, new ItemStack(InitBlocks.blockAtomicReconstructor), CRAFT_COAL_GEN),
|
|
||||||
MAKE_FIRST_CRYSTAL("makeCrystal", -4, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), CRAFT_RECONSTRUCTOR, Type.PICK_UP, new ItemStack(InitItems.itemCrystal, 1, Util.WILDCARD), new ItemStack(InitBlocks.blockCrystal, 1, Util.WILDCARD)),
|
|
||||||
CRAFT_EMPOWERER("craftEmpowerer", -4, 4, new ItemStack(InitBlocks.blockEmpowerer), MAKE_FIRST_CRYSTAL),
|
|
||||||
CRAFT_PHANTOMFACE("craftPhantomface", 2, 0, new ItemStack(InitBlocks.blockPhantomface), OPEN_BOOKLET),
|
|
||||||
CRAFT_LIQUIFACE("craftLiquiface", 2, 2, new ItemStack(InitBlocks.blockPhantomLiquiface), CRAFT_PHANTOMFACE),
|
|
||||||
CRAFT_ENERGYFACE("craftEnergyface", 4, -1, new ItemStack(InitBlocks.blockPhantomEnergyface), CRAFT_PHANTOMFACE),
|
|
||||||
CRAFT_LASER_RELAY("craftLaserRelay", -7, -2, new ItemStack(InitBlocks.blockLaserRelay), CRAFT_RECONSTRUCTOR),
|
|
||||||
CRAFT_LASER_RELAY_ITEM("craftLaserRelayItem", -9, -2, new ItemStack(InitBlocks.blockLaserRelayItem), CRAFT_LASER_RELAY, Type.PICK_UP),
|
|
||||||
CRAFT_ITEM_INTERFACE("craftItemInterface", -11, -3, new ItemStack(InitBlocks.blockItemViewer), CRAFT_LASER_RELAY_ITEM),
|
|
||||||
CRAFT_LASER_RELAY_ADVANCED("craftLaserRelayAdvanced", -7, -4, new ItemStack(InitBlocks.blockLaserRelayAdvanced), CRAFT_LASER_RELAY),
|
|
||||||
CRAFT_LASER_RELAY_EXTREME("craftLaserRelayExtreme", -9, -4, new ItemStack(InitBlocks.blockLaserRelayExtreme), CRAFT_LASER_RELAY_ADVANCED),
|
|
||||||
CRAFT_CRUSHER("craftCrusher", -8, 0, new ItemStack(InitBlocks.blockGrinder), CRAFT_RECONSTRUCTOR),
|
|
||||||
CRAFT_DOUBLE_CRUSHER("craftDoubleCrusher", -10, 1, new ItemStack(InitBlocks.blockGrinderDouble), CRAFT_CRUSHER),
|
|
||||||
PICK_UP_COFFEE("pickUpCoffee", -2, 2, new ItemStack(InitItems.itemCoffeeBean), CRAFT_COAL_GEN, Type.PICK_UP),
|
|
||||||
CRAFT_COFFEE_MACHINE("craftCoffeeMachine", -1, 3, new ItemStack(InitBlocks.blockCoffeeMachine), PICK_UP_COFFEE),
|
|
||||||
CRAFT_FIREWORK_BOX("craftFireworkBox", -4, -5, new ItemStack(InitBlocks.blockFireworkBox), null, Type.CRAFTING, true, 0),
|
|
||||||
GET_UNPROBED("getUnProbed", -7, 3, new ItemStack(InitItems.itemPlayerProbe), null, Type.MISC, true, 0),
|
|
||||||
|
|
||||||
GET_CRYSTALS_MILESTONE("getCrystalsMilestone", 6, -3, new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), null, Type.PICK_UP, true, 200, new ItemStack(InitItems.itemCrystal, 1, Util.WILDCARD), new ItemStack(InitBlocks.blockCrystal, 1, Util.WILDCARD)),
|
|
||||||
OPEN_BOOKLET_MILESTONE("openBookletMilestone", 6, -1, new ItemStack(InitItems.itemBooklet), null, Type.MISC, true, 50),
|
|
||||||
COMPLETE_TRIALS("completeTrials", 6, 1, new ItemStack(Items.GOLD_INGOT), null, Type.MISC, true, 0);
|
|
||||||
|
|
||||||
public final Achievement chieve;
|
|
||||||
public final Type type;
|
|
||||||
public final int progressToReach;
|
|
||||||
public List<ItemStack> itemsToBeGotten;
|
|
||||||
|
|
||||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, ItemStack... specialItemsToBeGotten){
|
|
||||||
this(name, x, y, displayStack, hasToHaveBefore, Type.CRAFTING, false, 0, specialItemsToBeGotten);
|
|
||||||
}
|
|
||||||
|
|
||||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type, boolean special, int progressToReach, ItemStack... specialItemsToBeGotten){
|
|
||||||
this.type = type;
|
|
||||||
this.progressToReach = progressToReach;
|
|
||||||
|
|
||||||
this.chieve = new Achievement("achievement."+ModUtil.MOD_ID+"."+name, ModUtil.MOD_ID+"."+name, x, y, displayStack, hasToHaveBefore == null ? null : hasToHaveBefore.chieve);
|
|
||||||
if(hasToHaveBefore == null){
|
|
||||||
this.chieve.initIndependentStat();
|
|
||||||
}
|
|
||||||
if(special){
|
|
||||||
this.chieve.setSpecial();
|
|
||||||
}
|
|
||||||
if(progressToReach > 0){
|
|
||||||
this.chieve.setSerializableClazz(JsonSerializableSet.class);
|
|
||||||
}
|
|
||||||
this.chieve.registerStat();
|
|
||||||
|
|
||||||
if(specialItemsToBeGotten == null || specialItemsToBeGotten.length <= 0){
|
|
||||||
this.itemsToBeGotten = Collections.singletonList(displayStack);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.itemsToBeGotten = Arrays.asList(specialItemsToBeGotten);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TheAchievements(String name, int x, int y, ItemStack displayStack, TheAchievements hasToHaveBefore, Type type, ItemStack... specialItemsToBeGotten){
|
|
||||||
this(name, x, y, displayStack, hasToHaveBefore, type, false, 0, specialItemsToBeGotten);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void get(EntityPlayer player){
|
|
||||||
this.get(player, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void get(EntityPlayer player, int amount){
|
|
||||||
if(this.progressToReach > 0){
|
|
||||||
this.updateStatus(player, amount);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
player.addStat(this.chieve);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateStatus(EntityPlayer player, int amount){
|
|
||||||
if(player instanceof EntityPlayerMP){
|
|
||||||
|
|
||||||
StatisticsManager manager = ((EntityPlayerMP)player).getStatFile();
|
|
||||||
if(manager != null && !manager.hasAchievementUnlocked(this.chieve) && manager.canUnlockAchievement(this.chieve)){
|
|
||||||
|
|
||||||
JsonSerializableSet data = manager.getProgress(this.chieve);
|
|
||||||
if(data == null){
|
|
||||||
data = manager.setProgress(this.chieve, new JsonSerializableSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
int gottenSoFar = 0;
|
|
||||||
for(String strg : data){
|
|
||||||
try{
|
|
||||||
int i = Integer.parseInt(strg);
|
|
||||||
gottenSoFar += i;
|
|
||||||
data.remove(strg);
|
|
||||||
}
|
|
||||||
catch(Exception e){
|
|
||||||
data.remove(strg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gottenSoFar += amount;
|
|
||||||
if(gottenSoFar >= this.progressToReach){
|
|
||||||
player.addStat(this.chieve);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
data.add(Integer.toString(gottenSoFar));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.block;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraftforge.event.RegistryEvent.Register;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||||
|
import net.minecraftforge.registries.ObjectHolder;
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = ActuallyAdditions.MODID, bus = Bus.MOD)
|
||||||
|
@ObjectHolder(ActuallyAdditions.MODID)
|
||||||
|
public class AABlocks {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void register(Register<Block> e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void registerItemBlocks(Register<Item> e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,221 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockAtomicReconstructor.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
public static final int NAME_FLAVOR_AMOUNTS_1 = 12;
|
|
||||||
public static final int NAME_FLAVOR_AMOUNTS_2 = 14;
|
|
||||||
|
|
||||||
public BlockAtomicReconstructor(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(10F);
|
|
||||||
this.setResistance(80F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos);
|
|
||||||
if (reconstructor != null) {
|
|
||||||
if (StackUtil.isValid(heldItem)) {
|
|
||||||
Item item = heldItem.getItem();
|
|
||||||
if (item instanceof ILensItem && !StackUtil.isValid(reconstructor.inv.getStackInSlot(0))) {
|
|
||||||
ItemStack toPut = heldItem.copy();
|
|
||||||
toPut.setCount(1);
|
|
||||||
reconstructor.inv.setStackInSlot(0, toPut);
|
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
|
||||||
}
|
|
||||||
//Shush, don't tell anyone!
|
|
||||||
else if (ConfigIntValues.ELEVEN.getValue() == 11 && item == Items.RECORD_11) {
|
|
||||||
reconstructor.counter++;
|
|
||||||
reconstructor.markDirty();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ItemStack slot = reconstructor.inv.getStackInSlot(0);
|
|
||||||
if (StackUtil.isValid(slot)) {
|
|
||||||
player.setHeldItem(hand, slot.copy());
|
|
||||||
reconstructor.inv.setStackInSlot(0, StackUtil.getEmpty());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int i) {
|
|
||||||
return new TileEntityAtomicReconstructor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (tile instanceof TileEntityAtomicReconstructor) {
|
|
||||||
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
|
|
||||||
String strg;
|
|
||||||
if (!StackUtil.isValid(slot)) {
|
|
||||||
strg = StringUtil.localize("info." + ActuallyAdditions.MODID + ".noLens");
|
|
||||||
} else {
|
|
||||||
strg = slot.getItem().getItemStackDisplayName(slot);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
private long lastSysTime;
|
|
||||||
private int toPick1;
|
|
||||||
private int toPick2;
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(false);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return this.getTranslationKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int damage) {
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag advanced) {
|
|
||||||
long sysTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (this.lastSysTime + 3000 < sysTime) {
|
|
||||||
this.lastSysTime = sysTime;
|
|
||||||
if (world != null) {
|
|
||||||
this.toPick1 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_1) + 1;
|
|
||||||
this.toPick2 = world.rand.nextInt(NAME_FLAVOR_AMOUNTS_2) + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String base = "tile." + ActuallyAdditions.MODID + "." + ((BlockAtomicReconstructor) this.block).getBaseName() + ".info.";
|
|
||||||
tooltip.add(StringUtil.localize(base + "1." + this.toPick1) + " " + StringUtil.localize(base + "2." + this.toPick2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos) {
|
|
||||||
TileEntity t = world.getTileEntity(pos);
|
|
||||||
int i = 0;
|
|
||||||
if (t instanceof TileEntityAtomicReconstructor) {
|
|
||||||
i = ((TileEntityAtomicReconstructor) t).getEnergy();
|
|
||||||
}
|
|
||||||
return MathHelper.clamp(i / 20000, 0, 15);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockBatteryBox.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockBatteryBox extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockBatteryBox(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
|
||||||
return new TileEntityBatteryBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
if (tile instanceof TileEntityBatteryBox) {
|
|
||||||
TileEntityBatteryBox box = (TileEntityBatteryBox) tile;
|
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
|
||||||
|
|
||||||
if (StackUtil.isValid(stack)) {
|
|
||||||
if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) {
|
|
||||||
box.inv.setStackInSlot(0, stack.copy());
|
|
||||||
player.setHeldItem(hand, StackUtil.getEmpty());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ItemStack inSlot = box.inv.getStackInSlot(0);
|
|
||||||
if (StackUtil.isValid(inSlot)) {
|
|
||||||
player.setHeldItem(hand, inSlot.copy());
|
|
||||||
box.inv.setStackInSlot(0, StackUtil.getEmpty());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockBioReactor.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockBioReactor extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockBioReactor(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(2.0F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
|
||||||
return new TileEntityBioReactor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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.getTileEntity(pos) instanceof TileEntityBioReactor) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockBlackLotus.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
|
||||||
|
|
||||||
public class BlockBlackLotus extends BlockBushBase {
|
|
||||||
|
|
||||||
public BlockBlackLotus(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,103 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockBreaker.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockBreaker extends BlockContainerBase {
|
|
||||||
|
|
||||||
private final boolean isPlacer;
|
|
||||||
|
|
||||||
public BlockBreaker(boolean isPlacer, String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.isPlacer = isPlacer;
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos);
|
|
||||||
if (breaker != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BREAKER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockCanolaPress.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockCanolaPress extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockCanolaPress(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityCanolaPress();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
|
|
||||||
if (press != null) {
|
|
||||||
if (!this.tryUseItemOnTank(player, hand, press.tank)) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockCoalGenerator.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.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.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockCoalGenerator extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockCoalGenerator(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityCoalGenerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityCoalGenerator) {
|
|
||||||
if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) {
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos);
|
|
||||||
if (press != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,132 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockCoffeeMachine extends BlockContainerBase {
|
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 1 - 0.0625 * 2, 1 - 0.0625);
|
|
||||||
|
|
||||||
public BlockCoffeeMachine(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos);
|
|
||||||
if (machine != null) {
|
|
||||||
if (!this.tryUseItemOnTank(player, hand, machine.tank)) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
|
||||||
return new TileEntityCoffeeMachine();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (rotation == 0) {
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(0), 2);
|
|
||||||
}
|
|
||||||
if (rotation == 1) {
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(3), 2);
|
|
||||||
}
|
|
||||||
if (rotation == 2) {
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(1), 2);
|
|
||||||
}
|
|
||||||
if (rotation == 3) {
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(2), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,165 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockColoredLamp.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
public class BlockColoredLamp extends BlockBase {
|
|
||||||
|
|
||||||
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
|
||||||
public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
|
|
||||||
public final boolean isOn;
|
|
||||||
|
|
||||||
public BlockColoredLamp(boolean isOn, String name) {
|
|
||||||
super(Material.REDSTONE_LIGHT, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(3.0F);
|
|
||||||
this.isOn = isOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
|
||||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(IBlockState state) {
|
|
||||||
return this.getMetaFromState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
//Turning On
|
|
||||||
if (hand == EnumHand.MAIN_HAND && stack.isEmpty()) {
|
|
||||||
world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2);
|
|
||||||
world.notifyLightSet(pos);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StackUtil.isValid(stack)) {
|
|
||||||
//Changing Colors
|
|
||||||
int[] oreIDs = OreDictionary.getOreIDs(stack);
|
|
||||||
if (oreIDs.length > 0) {
|
|
||||||
for (int oreID : oreIDs) {
|
|
||||||
String name = OreDictionary.getOreName(oreID);
|
|
||||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
|
||||||
if (color != null) {
|
|
||||||
if (this.getMetaFromState(state) != color.ordinal()) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(color.ordinal()), 2);
|
|
||||||
if (!player.capabilities.isCreativeMode) {
|
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
|
||||||
for (int j = 0; j < ALL_LAMP_TYPES.length; j++) {
|
|
||||||
list.add(new ItemStack(this, 1, j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
|
||||||
return this.isOn ? 15 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(TYPE).ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
|
||||||
if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { return StringUtil.BUGGED_ITEM_NAME; }
|
|
||||||
if (Util.isClient()) return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" : "");
|
|
||||||
else return super.getItemStackDisplayName(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return InitBlocks.blockColoredLamp.getTranslationKey() + "_" + ALL_LAMP_TYPES[stack.getItemDamage()].regName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,223 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockCompost.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
protected static final AxisAlignedBB AABB_LEGS = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.3125D, 1.0D);
|
|
||||||
protected static final AxisAlignedBB AABB_WALL_NORTH = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
|
||||||
protected static final AxisAlignedBB AABB_WALL_SOUTH = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
|
|
||||||
protected static final AxisAlignedBB AABB_WALL_EAST = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
|
||||||
protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 11 * 0.0625, 1 - 0.0625);
|
|
||||||
|
|
||||||
public BlockCompost(String name) {
|
|
||||||
super(Material.WOOD, name);
|
|
||||||
this.setHarvestLevel("axe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(5.0F);
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean someBool) {
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
|
||||||
ItemStack stackPlayer = player.getHeldItem(hand);
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityCompost) {
|
|
||||||
TileEntityCompost compost = (TileEntityCompost) tile;
|
|
||||||
ItemStack slot = compost.inv.getStackInSlot(0);
|
|
||||||
CompostRecipe recipeIn = TileEntityCompost.getRecipeForInput(slot);
|
|
||||||
if (!StackUtil.isValid(slot) || recipeIn != null) {
|
|
||||||
if (StackUtil.isValid(stackPlayer)) {
|
|
||||||
CompostRecipe recipeHand = TileEntityCompost.getRecipeForInput(stackPlayer);
|
|
||||||
if (recipeHand != null && (recipeIn == null || recipeIn == recipeHand)) {
|
|
||||||
int maxAdd = stackPlayer.getCount();
|
|
||||||
|
|
||||||
if (!StackUtil.isValid(slot)) {
|
|
||||||
ItemStack stackToAdd = stackPlayer.copy();
|
|
||||||
stackToAdd.setCount(maxAdd);
|
|
||||||
compost.inv.setStackInSlot(0, stackToAdd);
|
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, maxAdd);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
ItemStack stackIn = slot.copy();
|
|
||||||
if (stackIn.getCount() < slot.getMaxStackSize()) {
|
|
||||||
int sizeAdded = Math.min(maxAdd, slot.getMaxStackSize() - stackIn.getCount());
|
|
||||||
stackIn.grow(sizeAdded);
|
|
||||||
compost.inv.setStackInSlot(0, stackIn);
|
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, sizeAdded);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!StackUtil.isValid(stackPlayer)) {
|
|
||||||
player.setHeldItem(hand, slot.copy());
|
|
||||||
compost.inv.setStackInSlot(0, StackUtil.getEmpty());
|
|
||||||
return true;
|
|
||||||
} else if (ItemUtil.canBeStacked(stackPlayer, slot)) {
|
|
||||||
int addedStackSize = Math.min(slot.getCount(), stackPlayer.getMaxStackSize() - stackPlayer.getCount());
|
|
||||||
ItemStack stackToAdd = stackPlayer.copy();
|
|
||||||
stackToAdd.grow(addedStackSize);
|
|
||||||
player.setHeldItem(hand, stackToAdd);
|
|
||||||
compost.inv.getStackInSlot(0).shrink(addedStackSize);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tile.markDirty();
|
|
||||||
world.notifyBlockUpdate(pos, this.getDefaultState(), this.getDefaultState(), 3);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
|
||||||
return new TileEntityCompost();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (tile instanceof TileEntityCompost) {
|
|
||||||
ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0);
|
|
||||||
String strg;
|
|
||||||
if (!StackUtil.isValid(slot)) {
|
|
||||||
strg = "Empty";
|
|
||||||
} else {
|
|
||||||
strg = slot.getDisplayName();
|
|
||||||
|
|
||||||
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth() / 2 + 15, resolution.getScaledHeight() / 2 - 29, 1F);
|
|
||||||
}
|
|
||||||
minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg, resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2 - 25, StringUtil.DECIMAL_COLOR_WHITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { COMPOST_PROP });
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
|
||||||
TileEntity te = world.getTileEntity(pos);
|
|
||||||
if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) {
|
|
||||||
TileEntityCompost compost = (TileEntityCompost) te;
|
|
||||||
return ((IExtendedBlockState) state).withProperty(COMPOST_PROP, Pair.of(compost.getCurrentDisplay(), compost.getHeight()));
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockRenderLayer getBlockLayer() {
|
|
||||||
return BlockRenderLayer.CUTOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CompostProperty COMPOST_PROP = new CompostProperty();
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
private static class CompostProperty implements IUnlistedProperty<Pair> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "compost";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(Pair value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<Pair> getType() {
|
|
||||||
return Pair.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String valueToString(Pair value) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockCrystal.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockCrystal extends BlockBase {
|
|
||||||
|
|
||||||
public static final TheCrystals[] ALL_CRYSTALS = TheCrystals.values();
|
|
||||||
private static final PropertyEnum<TheCrystals> TYPE = PropertyEnum.create("type", TheCrystals.class);
|
|
||||||
|
|
||||||
private final boolean isEmpowered;
|
|
||||||
|
|
||||||
public BlockCrystal(String name, boolean isEmpowered) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.isEmpowered = isEmpowered;
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setHarvestLevel("pickaxe", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(IBlockState state) {
|
|
||||||
return this.getMetaFromState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
|
||||||
for (int j = 0; j < ALL_CRYSTALS.length; j++) {
|
|
||||||
list.add(new ItemStack(this, 1, j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
for (int i = 0; i < ALL_CRYSTALS.length; i++) {
|
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_CRYSTALS[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(TYPE, TheCrystals.values()[meta]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(TYPE).ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IRarity getRarity(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= ALL_CRYSTALS.length ? EnumRarity.COMMON : ALL_CRYSTALS[stack.getItemDamage()].rarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_CRYSTALS[stack.getItemDamage()].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEffect(ItemStack stack) {
|
|
||||||
return this.block instanceof BlockCrystal && ((BlockCrystal) this.block).isEmpowered;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,146 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockCrystalCluster.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
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.gen.WorldGenLushCaves;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem {
|
|
||||||
|
|
||||||
private final TheCrystals crystal;
|
|
||||||
|
|
||||||
public BlockCrystalCluster(String name, TheCrystals crystal) {
|
|
||||||
super(Material.GLASS, name);
|
|
||||||
this.crystal = crystal;
|
|
||||||
|
|
||||||
this.setHardness(0.25F);
|
|
||||||
this.setResistance(1.0F);
|
|
||||||
this.setSoundType(SoundType.GLASS);
|
|
||||||
this.setLightOpacity(1);
|
|
||||||
this.setLightLevel(0.7F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
|
||||||
return this.getStateFromMeta(side.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IBlockColor getBlockColor() {
|
|
||||||
return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockRenderLayer getRenderLayer() {
|
|
||||||
return BlockRenderLayer.TRANSLUCENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IItemColor getItemColor() {
|
|
||||||
return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
|
||||||
return InitItems.itemCrystalShard;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(IBlockState state) {
|
|
||||||
return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
|
||||||
return new ItemStack(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int quantityDropped(Random random) {
|
|
||||||
return random.nextInt(5) + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockDirectionalBreaker.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockDirectionalBreaker extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockDirectionalBreaker(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityDirectionalBreaker();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockDisplayStand.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockDisplayStand extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockDisplayStand(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
|
||||||
return new TileEntityDisplayStand();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos);
|
|
||||||
if (stand != null) {
|
|
||||||
ItemStack display = stand.inv.getStackInSlot(0);
|
|
||||||
if (StackUtil.isValid(heldItem)) {
|
|
||||||
if (!StackUtil.isValid(display)) {
|
|
||||||
ItemStack toPut = heldItem.copy();
|
|
||||||
toPut.setCount(1);
|
|
||||||
stand.inv.setStackInSlot(0, toPut);
|
|
||||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
|
||||||
return true;
|
|
||||||
} else if (ItemUtil.canBeStacked(heldItem, display)) {
|
|
||||||
int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
|
||||||
if (maxTransfer > 0) {
|
|
||||||
heldItem.grow(maxTransfer);
|
|
||||||
ItemStack newDisplay = display.copy();
|
|
||||||
newDisplay.shrink(maxTransfer);
|
|
||||||
stand.inv.setStackInSlot(0, newDisplay);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (StackUtil.isValid(display)) {
|
|
||||||
player.setHeldItem(hand, display.copy());
|
|
||||||
stand.inv.setStackInSlot(0, StackUtil.getEmpty());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face) {
|
|
||||||
if (face == EnumFacing.DOWN) return BlockFaceShape.SOLID;
|
|
||||||
return BlockFaceShape.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockDropper.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockDropper extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockDropper(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityDropper();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos);
|
|
||||||
if (dropper != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DROPPER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockEmpowerer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockEmpowerer extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockEmpowerer(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
|
||||||
return new TileEntityEmpowerer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return BlockSlabs.AABB_BOTTOM_HALF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos);
|
|
||||||
if (empowerer != null) {
|
|
||||||
ItemStack stackThere = empowerer.inv.getStackInSlot(0);
|
|
||||||
if (StackUtil.isValid(heldItem)) {
|
|
||||||
if (!StackUtil.isValid(stackThere) && TileEntityEmpowerer.isPossibleInput(heldItem)) {
|
|
||||||
ItemStack toPut = heldItem.copy();
|
|
||||||
toPut.setCount(1);
|
|
||||||
empowerer.inv.setStackInSlot(0, toPut);
|
|
||||||
if (!player.capabilities.isCreativeMode) heldItem.shrink(1);
|
|
||||||
return true;
|
|
||||||
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
|
|
||||||
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
|
|
||||||
if (maxTransfer > 0) {
|
|
||||||
player.setHeldItem(hand, StackUtil.grow(heldItem, maxTransfer));
|
|
||||||
ItemStack newStackThere = stackThere.copy();
|
|
||||||
newStackThere = StackUtil.shrink(newStackThere, maxTransfer);
|
|
||||||
empowerer.inv.setStackInSlot(0, newStackThere);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (StackUtil.isValid(stackThere)) {
|
|
||||||
player.setHeldItem(hand, stackThere.copy());
|
|
||||||
empowerer.inv.setStackInSlot(0, StackUtil.getEmpty());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockEnergizer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockEnergizer extends BlockContainerBase {
|
|
||||||
|
|
||||||
private final boolean isEnergizer;
|
|
||||||
|
|
||||||
public BlockEnergizer(boolean isEnergizer, String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.isEnergizer = isEnergizer;
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(2.0F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
if (this.isEnergizer) {
|
|
||||||
TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos);
|
|
||||||
if (energizer != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
TileEntityEnervator energizer = (TileEntityEnervator) world.getTileEntity(pos);
|
|
||||||
if (energizer != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFarmer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFarmer extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockFarmer(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFarmer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos);
|
|
||||||
if (farmer != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FARMER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFeeder.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFeeder extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockFeeder(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(6.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFeeder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
|
|
||||||
if (feeder != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFermentingBarrel.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFermentingBarrel extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockFermentingBarrel(String name) {
|
|
||||||
super(Material.WOOD, name);
|
|
||||||
this.setHarvestLevel("axe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(5.0F);
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFermentingBarrel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
|
|
||||||
if (press != null) {
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFireworkBox.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFireworkBox extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockFireworkBox(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)) {
|
|
||||||
return true;
|
|
||||||
} else if (!world.isRemote) {
|
|
||||||
TileEntityFireworkBox grinder = (TileEntityFireworkBox) world.getTileEntity(pos);
|
|
||||||
if (grinder != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FIREWORK_BOX.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFireworkBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFishingNet.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFishingNet extends BlockContainerBase {
|
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
|
|
||||||
|
|
||||||
public BlockFishingNet(String name) {
|
|
||||||
super(Material.WOOD, name);
|
|
||||||
this.setHarvestLevel("axe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(3.0F);
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFishingNet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFluidCollector.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFluidCollector extends BlockContainerBase {
|
|
||||||
|
|
||||||
private final boolean isPlacer;
|
|
||||||
|
|
||||||
public BlockFluidCollector(boolean isPlacer, String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.isPlacer = isPlacer;
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos);
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFurnaceDouble.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
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.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.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.text.TextFormatting;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockFurnaceDouble extends BlockContainerBase {
|
|
||||||
|
|
||||||
public static final PropertyBool IS_ON = PropertyBool.create("on");
|
|
||||||
|
|
||||||
public BlockFurnaceDouble(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFurnaceDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
|
||||||
if (state.getValue(IS_ON)) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
|
|
||||||
if (furnace != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
|
||||||
return state.getValue(IS_ON) ? 12 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
boolean isOn = meta >= 4;
|
|
||||||
EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta - 4 : meta);
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
return state.getValue(IS_ON) ? meta + 4 : meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING, IS_ON);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
|
||||||
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".previouslyDoubleFurnace"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFurnaceSolar.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockFurnaceSolar extends BlockContainerBase {
|
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6 * 0.0625, 1);
|
|
||||||
|
|
||||||
public BlockFurnaceSolar(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityFurnaceSolar();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockGeneric.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class BlockGeneric extends BlockBase {
|
|
||||||
|
|
||||||
public BlockGeneric(String name) {
|
|
||||||
this(name, Material.ROCK, SoundType.STONE, 1.5F, 10.0F, "pickaxe", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockGeneric(String name, Material material, SoundType sound, float hardness, float resistance, String harvestTool, int harvestLevel) {
|
|
||||||
super(material, name);
|
|
||||||
this.setHarvestLevel(harvestTool, harvestLevel);
|
|
||||||
this.setHardness(hardness);
|
|
||||||
this.setResistance(resistance);
|
|
||||||
this.setSoundType(sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.COMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,188 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockGiantChest.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
|
||||||
|
|
||||||
public class BlockGiantChest extends BlockContainerBase {
|
|
||||||
|
|
||||||
public final int type;
|
|
||||||
|
|
||||||
public BlockGiantChest(String name, int type) {
|
|
||||||
super(Material.WOOD, name);
|
|
||||||
this.type = type;
|
|
||||||
|
|
||||||
this.setHarvestLevel("axe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(15.0F);
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
switch (this.type) {
|
|
||||||
case 1:
|
|
||||||
return new TileEntityGiantChestMedium();
|
|
||||||
case 2:
|
|
||||||
return new TileEntityGiantChestLarge();
|
|
||||||
default:
|
|
||||||
return new TileEntityGiantChest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
|
|
||||||
if (chest != null) {
|
|
||||||
chest.fillWithLoot(player);
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
|
||||||
if (stack.getTagCompound() != null) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityGiantChest) {
|
|
||||||
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
|
|
||||||
IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
|
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); i++) {
|
|
||||||
NBTTagCompound compound = list.getCompoundTagAt(i);
|
|
||||||
if (compound != null && compound.hasKey("id")) {
|
|
||||||
inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, entity, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
|
||||||
super.getDrops(drops, world, pos, state, fortune);
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityGiantChest) {
|
|
||||||
ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
|
|
||||||
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
|
||||||
if (place >= 0) {
|
|
||||||
NBTTagList list = new NBTTagList();
|
|
||||||
for (int i = 0; i < slots.getSlots(); i++) {
|
|
||||||
//Destroy the keeper
|
|
||||||
if (i != place) {
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
|
||||||
if (StackUtil.isValid(slots.getStackInSlot(i))) {
|
|
||||||
slots.getStackInSlot(i).writeToNBT(compound);
|
|
||||||
}
|
|
||||||
list.appendTag(compound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (list.tagCount() > 0) {
|
|
||||||
ItemStack stackInQuestion = drops.get(0);
|
|
||||||
if (StackUtil.isValid(stackInQuestion)) {
|
|
||||||
if (stackInQuestion.getTagCompound() == null) {
|
|
||||||
stackInQuestion.setTagCompound(new NBTTagCompound());
|
|
||||||
}
|
|
||||||
stackInQuestion.getTagCompound().setTag("Items", list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldDropInventory(World world, BlockPos pos) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
return !(tile instanceof TileEntityGiantChest) || !ItemUtil.contains(((TileEntityGiantChest) tile).inv.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
|
|
||||||
int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1;
|
|
||||||
if (type == 2) {
|
|
||||||
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
|
|
||||||
} else if (type == 0) {
|
|
||||||
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChest.desc"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound getNBTShareTag(ItemStack stack) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockGreenhouseGlass.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Triple;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.IGrowable;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockGreenhouseGlass extends BlockBase {
|
|
||||||
|
|
||||||
public BlockGreenhouseGlass(String name) {
|
|
||||||
super(Material.GLASS, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.GLASS);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightOpacity(IBlockState state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
|
||||||
IBlockState otherState = world.getBlockState(pos.offset(side));
|
|
||||||
Block block = otherState.getBlock();
|
|
||||||
|
|
||||||
return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockRenderLayer getRenderLayer() {
|
|
||||||
return BlockRenderLayer.CUTOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
|
||||||
if (world.isRemote) return;
|
|
||||||
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
|
|
||||||
Triple<BlockPos, IBlockState, IGrowable> trip = firstBlock(world, pos);
|
|
||||||
boolean once = false;
|
|
||||||
if (trip != null) for (int i = 0; i < 3; i++) {
|
|
||||||
IBlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
|
|
||||||
if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
|
|
||||||
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
|
||||||
once = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (once) world.playEvent(2005, trip.getMiddle().isOpaqueCube() ? trip.getLeft().up() : trip.getLeft(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Triple<BlockPos, IBlockState, IGrowable> firstBlock(World world, BlockPos glassPos) {
|
|
||||||
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
|
|
||||||
while (true) {
|
|
||||||
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
|
||||||
if (mut.getY() < 0) return null;
|
|
||||||
IBlockState state = world.getBlockState(mut);
|
|
||||||
if (state.isOpaqueCube() || state.getBlock() instanceof IGrowable || state.getBlock() == this) {
|
|
||||||
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockGrinder.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockGrinder extends BlockContainerBase {
|
|
||||||
|
|
||||||
private final boolean isDouble;
|
|
||||||
|
|
||||||
public BlockGrinder(boolean isDouble, String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.isDouble = isDouble;
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
|
||||||
if (state.getValue(BlockFurnaceDouble.IS_ON)) {
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
double xRand = 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.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos);
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
|
||||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(IBlockState state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
boolean isOn = meta == 1;
|
|
||||||
return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockFurnaceDouble.IS_ON);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockHeatCollector.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockHeatCollector extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockHeatCollector(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(2.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityHeatCollector();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,115 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockInputter.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputterAdvanced;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockInputter extends BlockContainerBase {
|
|
||||||
|
|
||||||
public static final int NAME_FLAVOR_AMOUNTS = 15;
|
|
||||||
|
|
||||||
public final boolean isAdvanced;
|
|
||||||
|
|
||||||
public BlockInputter(boolean isAdvanced, String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
this.isAdvanced = isAdvanced;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos);
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
private final Random rand = new Random();
|
|
||||||
private long lastSysTime;
|
|
||||||
private int toPick;
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(false);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return this.getTranslationKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int damage) {
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
|
||||||
if (Util.isClient()) {
|
|
||||||
long sysTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (this.lastSysTime + 5000 < sysTime) {
|
|
||||||
this.lastSysTime = sysTime;
|
|
||||||
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") + ")";
|
|
||||||
} else return super.getItemStackDisplayName(stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockItemRepairer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockItemRepairer extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockItemRepairer(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(20.0F);
|
|
||||||
this.setResistance(15.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityItemRepairer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos);
|
|
||||||
if (repairer != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
|
||||||
return this.getMetaFromState(state) == 1 ? 12 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockItemViewer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockItemViewer extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockItemViewer(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
|
||||||
return new TileEntityItemViewer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockItemViewerHopping.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping;
|
|
||||||
import net.minecraft.block.properties.PropertyDirection;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
//Most of this is just copied from BlockHopper, no credit taken. Or clue what it is.
|
|
||||||
public class BlockItemViewerHopping extends BlockItemViewer {
|
|
||||||
|
|
||||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.UP);
|
|
||||||
|
|
||||||
private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D);
|
|
||||||
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
|
||||||
private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 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);
|
|
||||||
|
|
||||||
public BlockItemViewerHopping(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return FULL_BLOCK_AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
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, EAST_AABB);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
|
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
|
||||||
return new TileEntityItemViewerHopping();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
|
||||||
EnumFacing opp = facing.getOpposite();
|
|
||||||
return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override //was isFullyOpaque, not sure if correct change.
|
|
||||||
public boolean isNormalCube(IBlockState state) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockRenderLayer getRenderLayer() {
|
|
||||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,127 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockLampPowerer.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
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.util.WorldUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockLampPowerer extends BlockBase {
|
|
||||||
|
|
||||||
public BlockLampPowerer(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
|
||||||
this.updateLamp(worldIn, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
|
||||||
this.updateLamp(world, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal();
|
|
||||||
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateLamp(World world, BlockPos pos) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state));
|
|
||||||
this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<BlockPos>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
Block block = state.getBlock();
|
|
||||||
if (block instanceof BlockColoredLamp) {
|
|
||||||
boolean isOn = ((BlockColoredLamp) block).isOn;
|
|
||||||
if (powered) {
|
|
||||||
if (!isOn) {
|
|
||||||
world.setBlockState(pos, InitBlocks.blockColoredLampOn.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isOn) {
|
|
||||||
world.setBlockState(pos, InitBlocks.blockColoredLamp.getDefaultState().withProperty(BlockColoredLamp.TYPE, state.getValue(BlockColoredLamp.TYPE)), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateSurrounding(world, pos, powered, updatedAlready);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateSurrounding(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready) {
|
|
||||||
for (EnumFacing side : EnumFacing.values()) {
|
|
||||||
BlockPos offset = pos.offset(side);
|
|
||||||
if (!updatedAlready.contains(offset)) {
|
|
||||||
updatedAlready.add(pos);
|
|
||||||
this.updateLampsAtPos(world, offset, powered, updatedAlready);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,301 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockLaserRelay.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
|
||||||
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.StringUtil;
|
|
||||||
import net.minecraft.block.BlockDirectional;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
//This took way too much fiddling around. I'm not good with numbers.
|
|
||||||
private static final float F = 1 / 16F;
|
|
||||||
private static final AxisAlignedBB AABB_UP = new AxisAlignedBB(2 * F, 0, 2 * F, 1 - 2 * F, 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_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_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 final Type type;
|
|
||||||
|
|
||||||
public BlockLaserRelay(String name, Type type) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
|
|
||||||
this.type = type;
|
|
||||||
|
|
||||||
if (this.type.ordinal() == 0) {
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) {
|
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
|
||||||
World world = event.getWorld();
|
|
||||||
ItemStack stack = event.getItemStack();
|
|
||||||
BlockPos pos = event.getPos();
|
|
||||||
|
|
||||||
if (player != null && world != null && StackUtil.isValid(stack) && pos != null) {
|
|
||||||
IBlockState state = event.getWorld().getBlockState(pos);
|
|
||||||
if (state != null && state.getBlock() instanceof BlockLaserRelay) {
|
|
||||||
if (player.isSneaking()) {
|
|
||||||
event.setUseBlock(Event.Result.ALLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
switch (this.getMetaFromState(state)) {
|
|
||||||
case 1:
|
|
||||||
return AABB_UP;
|
|
||||||
case 2:
|
|
||||||
return AABB_NORTH;
|
|
||||||
case 3:
|
|
||||||
return AABB_SOUTH;
|
|
||||||
case 4:
|
|
||||||
return AABB_WEST;
|
|
||||||
case 5:
|
|
||||||
return AABB_EAST;
|
|
||||||
default:
|
|
||||||
return AABB_DOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) {
|
|
||||||
return this.getStateFromMeta(side.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockDirectional.FACING).getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockDirectional.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityLaserRelay) {
|
|
||||||
TileEntityLaserRelay relay = (TileEntityLaserRelay) tile;
|
|
||||||
|
|
||||||
if (StackUtil.isValid(stack)) {
|
|
||||||
if (stack.getItem() instanceof ItemLaserWrench) {
|
|
||||||
return false;
|
|
||||||
} else if (stack.getItem() == ConfigValues.itemCompassConfigurator) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
relay.onCompassAction(player);
|
|
||||||
|
|
||||||
Network network = relay.getNetwork();
|
|
||||||
if (network != null) {
|
|
||||||
network.changeAmount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
relay.markDirty();
|
|
||||||
relay.sendUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else if (stack.getItem() instanceof ItemLaserRelayUpgrade) {
|
|
||||||
ItemStack inRelay = relay.inv.getStackInSlot(0);
|
|
||||||
if (!StackUtil.isValid(inRelay)) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
if (!player.isCreative()) {
|
|
||||||
player.setHeldItem(hand, StackUtil.shrink(stack, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack set = stack.copy();
|
|
||||||
set.setCount(1);
|
|
||||||
relay.inv.setStackInSlot(0, set);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.isSneaking()) {
|
|
||||||
ItemStack inRelay = relay.inv.getStackInSlot(0).copy();
|
|
||||||
if (StackUtil.isValid(inRelay)) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
relay.inv.setStackInSlot(0, StackUtil.getEmpty());
|
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(inRelay)) {
|
|
||||||
player.entityDropItem(inRelay, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (relay instanceof TileEntityLaserRelayItemWhitelist) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.LASER_RELAY_ITEM_WHITELIST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int i) {
|
|
||||||
switch (this.type) {
|
|
||||||
case ITEM:
|
|
||||||
return new TileEntityLaserRelayItem();
|
|
||||||
case ITEM_WHITELIST:
|
|
||||||
return new TileEntityLaserRelayItemWhitelist();
|
|
||||||
case ENERGY_ADVANCED:
|
|
||||||
return new TileEntityLaserRelayEnergyAdvanced();
|
|
||||||
case ENERGY_EXTREME:
|
|
||||||
return new TileEntityLaserRelayEnergyExtreme();
|
|
||||||
case FLUIDS:
|
|
||||||
return new TileEntityLaserRelayFluids();
|
|
||||||
default:
|
|
||||||
return new TileEntityLaserRelayEnergy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
if (posHit != null && posHit.getBlockPos() != null && minecraft.world != null) {
|
|
||||||
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
|
||||||
if (wearing || StackUtil.isValid(stack)) {
|
|
||||||
boolean compass = stack.getItem() == ConfigValues.itemCompassConfigurator;
|
|
||||||
if (wearing || compass || stack.getItem() instanceof ItemLaserWrench) {
|
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (tile instanceof TileEntityLaserRelay) {
|
|
||||||
TileEntityLaserRelay relay = (TileEntityLaserRelay) tile;
|
|
||||||
|
|
||||||
String strg = relay.getExtraDisplayString();
|
|
||||||
minecraft.fontRenderer.drawStringWithShadow(strg, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, StringUtil.DECIMAL_COLOR_WHITE);
|
|
||||||
|
|
||||||
String expl;
|
|
||||||
if (compass) {
|
|
||||||
expl = relay.getCompassDisplayString();
|
|
||||||
} else {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
|
|
||||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
|
||||||
return BlockFaceShape.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Type {
|
|
||||||
ENERGY_BASIC,
|
|
||||||
ENERGY_ADVANCED,
|
|
||||||
ENERGY_EXTREME,
|
|
||||||
FLUIDS,
|
|
||||||
ITEM,
|
|
||||||
ITEM_WHITELIST
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockLavaFactoryController.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
public BlockLavaFactoryController(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(4.5F);
|
|
||||||
this.setResistance(20.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityLavaFactoryController();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (factory != null) {
|
|
||||||
int state = factory.isMultiblock();
|
|
||||||
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);
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockLeafGenerator.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockLeafGenerator extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockLeafGenerator(String name) {
|
|
||||||
super(Material.IRON, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(5.0F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.METAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityLeafGenerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockMiner.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockMiner extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
public BlockMiner(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(8F);
|
|
||||||
this.setResistance(30F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityMiner) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.MINER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int i) {
|
|
||||||
return new TileEntityMiner();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (tile instanceof TileEntityMiner) {
|
|
||||||
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) + ".";
|
|
||||||
minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 20, StringUtil.DECIMAL_COLOR_WHITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,103 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockMisc.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
|
|
||||||
public class BlockMisc extends BlockBase {
|
|
||||||
|
|
||||||
public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
|
|
||||||
public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
|
|
||||||
|
|
||||||
public BlockMisc(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setHarvestLevel("pickaxe", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(IBlockState state) {
|
|
||||||
return this.getMetaFromState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
|
||||||
for (int j = 0; j < ALL_MISC_BLOCKS.length; j++) {
|
|
||||||
list.add(new ItemStack(this, 1, j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? EnumRarity.COMMON : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(TYPE).ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_MISC_BLOCKS[stack.getItemDamage()].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemBurnTime(ItemStack stack) {
|
|
||||||
if (stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) return 16000;
|
|
||||||
return super.getItemBurnTime(stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,128 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockOilGenerator.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.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.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockOilGenerator extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockOilGenerator(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityOilGenerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityOilGenerator) {
|
|
||||||
if (((TileEntityOilGenerator) tile).currentBurnTime > 0) {
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos);
|
|
||||||
if (generator != null) {
|
|
||||||
if (!this.tryUseItemOnTank(player, hand, generator.tank)) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockPhantom.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
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 net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
public final Type type;
|
|
||||||
|
|
||||||
public BlockPhantom(Type type, String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.type = type;
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(4.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvidePower(IBlockState state) {
|
|
||||||
return this.type == Type.REDSTONEFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
|
||||||
if (this.type == Type.REDSTONEFACE) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; }
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
|
||||||
if (this.type == Type.REDSTONEFACE) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; }
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldDropInventory(World world, BlockPos pos) {
|
|
||||||
return this.type == Type.PLACER || this.type == Type.BREAKER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
switch (this.type) {
|
|
||||||
case PLACER:
|
|
||||||
return new TileEntityPhantomPlacer();
|
|
||||||
case BREAKER:
|
|
||||||
return new TileEntityPhantomBreaker();
|
|
||||||
case LIQUIFACE:
|
|
||||||
return new TileEntityPhantomLiquiface();
|
|
||||||
case ENERGYFACE:
|
|
||||||
return new TileEntityPhantomEnergyface();
|
|
||||||
case REDSTONEFACE:
|
|
||||||
return new TileEntityPhantomRedstoneface();
|
|
||||||
default:
|
|
||||||
return new TileEntityPhantomItemface();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
|
||||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, ((IPhantomTile) tile).getGuiID(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (tile != null) {
|
|
||||||
if (tile instanceof IPhantomTile) {
|
|
||||||
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);
|
|
||||||
if (phantom.hasBoundPosition()) {
|
|
||||||
int distance = MathHelper.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())));
|
|
||||||
IBlockState state = minecraft.world.getBlockState(phantom.getBoundPosition());
|
|
||||||
Block block = state.getBlock();
|
|
||||||
Item item = Item.getItemFromBlock(block);
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
} 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 {
|
|
||||||
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 {
|
|
||||||
FACE,
|
|
||||||
PLACER,
|
|
||||||
BREAKER,
|
|
||||||
LIQUIFACE,
|
|
||||||
ENERGYFACE,
|
|
||||||
REDSTONEFACE
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockPhantomBooster.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockPhantomBooster extends BlockContainerBase {
|
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(2 * 0.0625, 0, 2 * 0.0625, 1 - 2 * 0.0625, 1, 1 - 2 * 0.0625);
|
|
||||||
|
|
||||||
public BlockPhantomBooster(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int i) {
|
|
||||||
return new TileEntityPhantomBooster();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockPlayerInterface.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay {
|
|
||||||
|
|
||||||
public BlockPlayerInterface(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(4.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityPlayerInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityPlayerInterface) {
|
|
||||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
|
||||||
if (face.connectedPlayer == null) {
|
|
||||||
face.connectedPlayer = player.getUniqueID();
|
|
||||||
face.playerName = player.getName();
|
|
||||||
face.markDirty();
|
|
||||||
face.sendUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {
|
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
|
||||||
if (tile != null) {
|
|
||||||
if (tile instanceof TileEntityPlayerInterface) {
|
|
||||||
TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile;
|
|
||||||
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("UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 15, StringUtil.DECIMAL_COLOR_WHITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockRangedCollector.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockRangedCollector extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockRangedCollector(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityRangedCollector();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (this.tryToggleRedstone(world, pos, player)) { return true; }
|
|
||||||
if (!world.isRemote) {
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockShockSuppressor.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
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.tile.TileEntityShockSuppressor;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.event.world.ExplosionEvent;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
|
|
||||||
public class BlockShockSuppressor extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockShockSuppressor(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(20.0F);
|
|
||||||
this.setResistance(2000.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onExplosion(ExplosionEvent.Detonate event) {
|
|
||||||
World world = event.getWorld();
|
|
||||||
if (!world.isRemote) {
|
|
||||||
List<BlockPos> affectedBlocks = event.getAffectedBlocks();
|
|
||||||
List<Entity> affectedEntities = event.getAffectedEntities();
|
|
||||||
|
|
||||||
int rangeSq = TileEntityShockSuppressor.RANGE * TileEntityShockSuppressor.RANGE;
|
|
||||||
int use = TileEntityShockSuppressor.USE_PER;
|
|
||||||
|
|
||||||
for (TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS) {
|
|
||||||
if (!suppressor.isRedstonePowered) {
|
|
||||||
BlockPos supPos = suppressor.getPos();
|
|
||||||
|
|
||||||
List<Entity> entitiesToRemove = new ArrayList<>();
|
|
||||||
List<BlockPos> posesToRemove = new ArrayList<>();
|
|
||||||
|
|
||||||
for (BlockPos pos : affectedBlocks) {
|
|
||||||
if (pos.distanceSq(supPos) <= rangeSq) {
|
|
||||||
posesToRemove.add(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Entity entity : affectedEntities) {
|
|
||||||
if (entity.getPositionVector().squareDistanceTo(supPos.getX(), supPos.getY(), supPos.getZ()) <= rangeSq) {
|
|
||||||
entitiesToRemove.add(entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.shuffle(entitiesToRemove);
|
|
||||||
Collections.shuffle(posesToRemove);
|
|
||||||
|
|
||||||
for (BlockPos pos : posesToRemove) {
|
|
||||||
if (suppressor.storage.getEnergyStored() >= use) {
|
|
||||||
suppressor.storage.extractEnergyInternal(use, false);
|
|
||||||
affectedBlocks.remove(pos);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Entity entity : entitiesToRemove) {
|
|
||||||
if (suppressor.storage.getEnergyStored() >= use) {
|
|
||||||
suppressor.storage.extractEnergyInternal(use, false);
|
|
||||||
affectedEntities.remove(entity);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
|
||||||
return new TileEntityShockSuppressor();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,175 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockSlabs.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockSlab;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumActionResult;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.SoundCategory;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
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);
|
|
||||||
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;
|
|
||||||
|
|
||||||
public BlockSlabs(String name, Block fullBlock) {
|
|
||||||
this(name, fullBlock.getDefaultState());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockSlabs(String name, IBlockState fullBlockState) {
|
|
||||||
super(fullBlockState.getMaterial(), name);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.fullBlockState = fullBlockState;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
|
||||||
if (facing.ordinal() == 1) { return this.getStateFromMeta(meta); }
|
|
||||||
if (facing.ordinal() == 0 || hitY >= 0.5F) { return this.getStateFromMeta(meta + 1); }
|
|
||||||
return this.getStateFromMeta(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.COMMON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockSlab.HALF);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(false);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
|
||||||
if (StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
|
|
||||||
if (state.getBlock() == 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) {
|
|
||||||
IBlockState newState = theBlock.fullBlockState;
|
|
||||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
|
||||||
|
|
||||||
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);
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
return EnumActionResult.SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.tryPlace(player, stack, hand, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
|
||||||
} else {
|
|
||||||
return EnumActionResult.FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
|
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
|
||||||
|
|
||||||
if (state.getBlock() == this.block) {
|
|
||||||
if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
IBlockState iblockstate = world.getBlockState(pos);
|
|
||||||
|
|
||||||
if (iblockstate.getBlock() == this.block) {
|
|
||||||
BlockSlabs theBlock = (BlockSlabs) this.block;
|
|
||||||
IBlockState newState = theBlock.fullBlockState;
|
|
||||||
AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos);
|
|
||||||
|
|
||||||
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);
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return this.getTranslationKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.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.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockSmileyCloud extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockSmileyCloud(String name) {
|
|
||||||
super(Material.CLOTH, name);
|
|
||||||
this.setHardness(0.5F);
|
|
||||||
this.setResistance(5.0F);
|
|
||||||
this.setSoundType(SoundType.CLOTH);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
|
||||||
if (world.rand.nextInt(30) == 0) {
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
double d = world.rand.nextGaussian() * 0.02D;
|
|
||||||
double d1 = 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntitySmileyCloud) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
|
|
||||||
//TheAchievements.NAME_SMILEY_CLOUD.get(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
|
||||||
return new TileEntitySmileyCloud();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.RARE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,273 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockTinyTorch.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockTorch;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
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.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
//Copied from BlockTorch.
|
|
||||||
//I have no idea what all of this means.
|
|
||||||
public class BlockTinyTorch extends BlockBase {
|
|
||||||
|
|
||||||
//Thanks to xdjackiexd for these.
|
|
||||||
//Man, I hate numbers.
|
|
||||||
private static final AxisAlignedBB STANDING_AABB = new AxisAlignedBB(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.3125D, 0.5625D);
|
|
||||||
private static final AxisAlignedBB TORCH_NORTH_AABB = new AxisAlignedBB(0.4375D, 0.25D, 0.8125D, 0.5625D, 0.5625D, 1.0D);
|
|
||||||
private static final AxisAlignedBB TORCH_SOUTH_AABB = new AxisAlignedBB(0.4375D, 0.25D, 0.0D, 0.5625D, 0.5625D, 0.1875D);
|
|
||||||
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);
|
|
||||||
|
|
||||||
public BlockTinyTorch(String name) {
|
|
||||||
super(Material.CIRCUITS, name);
|
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, EnumFacing.UP));
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
|
|
||||||
this.setHardness(0.0F);
|
|
||||||
this.setLightLevel(0.8F);
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
switch (state.getValue(BlockTorch.FACING)) {
|
|
||||||
case EAST:
|
|
||||||
return TORCH_EAST_AABB;
|
|
||||||
case WEST:
|
|
||||||
return TORCH_WEST_AABB;
|
|
||||||
case SOUTH:
|
|
||||||
return TORCH_SOUTH_AABB;
|
|
||||||
case NORTH:
|
|
||||||
return TORCH_NORTH_AABB;
|
|
||||||
default:
|
|
||||||
return STANDING_AABB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
|
||||||
return NULL_AABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNormalCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing facing) {
|
|
||||||
return BlockFaceShape.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canPlaceOn(World worldIn, BlockPos pos) {
|
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
|
||||||
return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
|
||||||
for (EnumFacing enumfacing : BlockTorch.FACING.getAllowedValues()) {
|
|
||||||
if (this.canPlaceAt(worldIn, pos, enumfacing)) { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing) {
|
|
||||||
BlockPos blockpos = pos.offset(facing.getOpposite());
|
|
||||||
boolean flag = facing.getAxis().isHorizontal();
|
|
||||||
return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)) {
|
|
||||||
return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
|
|
||||||
} else {
|
|
||||||
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
|
|
||||||
if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) { return this.getDefaultState().withProperty(BlockTorch.FACING, enumfacing); }
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getDefaultState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
|
||||||
this.checkForDrop(worldIn, pos, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
|
||||||
this.onNeighborChangeInternal(worldIn, pos, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) {
|
|
||||||
if (!this.checkForDrop(worldIn, pos, state)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
EnumFacing enumfacing = state.getValue(BlockTorch.FACING);
|
|
||||||
EnumFacing.Axis axis = enumfacing.getAxis();
|
|
||||||
EnumFacing enumfacing1 = enumfacing.getOpposite();
|
|
||||||
boolean flag = false;
|
|
||||||
|
|
||||||
if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) {
|
|
||||||
flag = true;
|
|
||||||
} else if (axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) {
|
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag) {
|
|
||||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
|
||||||
worldIn.setBlockToAir(pos);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) {
|
|
||||||
if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (worldIn.getBlockState(pos).getBlock() == this) {
|
|
||||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
|
||||||
worldIn.setBlockToAir(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
|
||||||
if (rand.nextBoolean()) {
|
|
||||||
EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING);
|
|
||||||
double d0 = pos.getX() + 0.5D;
|
|
||||||
double d1 = pos.getY() + 0.4D;
|
|
||||||
double d2 = pos.getZ() + 0.5D;
|
|
||||||
|
|
||||||
if (enumfacing.getAxis().isHorizontal()) {
|
|
||||||
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.FLAME, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
|
|
||||||
} else {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
IBlockState iblockstate = this.getDefaultState();
|
|
||||||
|
|
||||||
switch (meta) {
|
|
||||||
case 1:
|
|
||||||
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.EAST);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.WEST);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.SOUTH);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.NORTH);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
default:
|
|
||||||
iblockstate = iblockstate.withProperty(BlockTorch.FACING, EnumFacing.UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
return iblockstate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockRenderLayer getRenderLayer() {
|
|
||||||
return BlockRenderLayer.CUTOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
switch (state.getValue(BlockTorch.FACING)) {
|
|
||||||
case EAST:
|
|
||||||
i = i | 1;
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
i = i | 2;
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
i = i | 3;
|
|
||||||
break;
|
|
||||||
case NORTH:
|
|
||||||
i = i | 4;
|
|
||||||
break;
|
|
||||||
case DOWN:
|
|
||||||
case UP:
|
|
||||||
default:
|
|
||||||
i = i | 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
|
||||||
return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockTorch.FACING);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,143 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockTreasureChest.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.init.SoundEvents;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
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.SoundCategory;
|
|
||||||
import net.minecraft.util.WeightedRandom;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockTreasureChest extends BlockBase {
|
|
||||||
|
|
||||||
public BlockTreasureChest(String name) {
|
|
||||||
super(Material.WOOD, name);
|
|
||||||
this.setHarvestLevel("axe", 0);
|
|
||||||
this.setHardness(300.0F);
|
|
||||||
this.setResistance(50.0F);
|
|
||||||
this.setSoundType(SoundType.WOOD);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
for (float f = 0; f <= 3; f += 0.5) {
|
|
||||||
float particleX = rand.nextFloat();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
|
||||||
return Items.AIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F);
|
|
||||||
this.dropItems(world, pos);
|
|
||||||
world.setBlockToAir(pos);
|
|
||||||
|
|
||||||
//TheAchievements.OPEN_TREASURE_CHEST.get(player);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dropItems(World world, BlockPos pos) {
|
|
||||||
for (int i = 0; i < MathHelper.getInt(world.rand, 3, 6); i++) {
|
|
||||||
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(world.rand, ActuallyAdditionsAPI.TREASURE_CHEST_LOOT);
|
|
||||||
ItemStack itemStack = theReturn.returnItem.copy();
|
|
||||||
itemStack.setCount(MathHelper.getInt(world.rand, theReturn.minAmount, theReturn.maxAmount));
|
|
||||||
|
|
||||||
float dX = 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;
|
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, itemStack);
|
|
||||||
float factor = 0.05F;
|
|
||||||
entityItem.motionX = world.rand.nextGaussian() * factor;
|
|
||||||
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
|
||||||
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntity(entityItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,137 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockWallAA.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockFenceGate;
|
|
||||||
import net.minecraft.block.BlockWall;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockWallAA extends BlockBase {
|
|
||||||
|
|
||||||
protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] { new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D) };
|
|
||||||
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] { AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D) };
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public BlockWallAA(String name, Block blocc) {
|
|
||||||
super(blocc.getDefaultState().getMaterial(), name);
|
|
||||||
this.setHardness(1.5F);
|
|
||||||
this.setResistance(10F);
|
|
||||||
this.setSoundType(blocc.getSoundType());
|
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(IBlockState state) {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if (state.getValue(BlockWall.NORTH)) {
|
|
||||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.getValue(BlockWall.EAST)) {
|
|
||||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.getValue(BlockWall.SOUTH)) {
|
|
||||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.getValue(BlockWall.WEST)) {
|
|
||||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
|
||||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
|
||||||
boolean flag1 = this.canConnectTo(worldIn, pos.east());
|
|
||||||
boolean flag2 = this.canConnectTo(worldIn, pos.south());
|
|
||||||
boolean flag3 = this.canConnectTo(worldIn, pos.west());
|
|
||||||
boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
|
|
||||||
return state.withProperty(BlockWall.UP, !flag4 || !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, flag).withProperty(BlockWall.EAST, flag1).withProperty(BlockWall.SOUTH, flag2).withProperty(BlockWall.WEST, flag3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFullCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@Deprecated
|
|
||||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
|
||||||
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
state = this.getActualState(state, source, pos);
|
|
||||||
return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
|
||||||
blockState = this.getActualState(blockState, worldIn, pos);
|
|
||||||
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
|
||||||
list.add(new ItemStack(this, 1, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
|
||||||
Block block = state.getBlock();
|
|
||||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,129 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockWildPlant.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockCrops;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockWildPlant extends BlockBushBase {
|
|
||||||
|
|
||||||
public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
|
|
||||||
public static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
|
|
||||||
|
|
||||||
public BlockWildPlant(String name) {
|
|
||||||
super(name);
|
|
||||||
this.setSoundType(SoundType.PLANT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state) {
|
|
||||||
BlockPos offset = pos.down();
|
|
||||||
IBlockState offsetState = world.getBlockState(offset);
|
|
||||||
Block offsetBlock = offsetState.getBlock();
|
|
||||||
return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
|
||||||
BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion();
|
|
||||||
return new ItemStack(normal.seedItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
|
||||||
for (int j = 0; j < ALL_WILD_PLANTS.length; j++) {
|
|
||||||
list.add(new ItemStack(this, 1, j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
|
||||||
Block normal = state.getValue(TYPE).getNormalVersion();
|
|
||||||
normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new TheItemBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(TYPE).ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? EnumRarity.COMMON : ALL_WILD_PLANTS[stack.getItemDamage()].getRarity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase {
|
|
||||||
|
|
||||||
public TheItemBlock(Block block) {
|
|
||||||
super(block);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTranslationKey(ItemStack stack) {
|
|
||||||
return stack.getItemDamage() >= ALL_WILD_PLANTS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + "_" + ALL_WILD_PLANTS[stack.getItemDamage()].getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockXPSolidifier.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
|
||||||
import net.minecraft.block.BlockHorizontal;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.Mirror;
|
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockXPSolidifier extends BlockContainerBase {
|
|
||||||
|
|
||||||
public BlockXPSolidifier(String name) {
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(2.5F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world, int par2) {
|
|
||||||
return new TileEntityXPSolidifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos);
|
|
||||||
if (solidifier != null) {
|
|
||||||
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
|
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
|
||||||
return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, BlockHorizontal.FACING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
|
||||||
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirror) {
|
|
||||||
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("IHudDisplay.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public interface IHudDisplay {
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,218 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("InitBlocks.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay.Type;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
|
|
||||||
public final class InitBlocks {
|
|
||||||
|
|
||||||
public static Block blockCompost;
|
|
||||||
public static Block blockMisc;
|
|
||||||
public static Block blockWildPlant;
|
|
||||||
public static Block blockFeeder;
|
|
||||||
public static Block blockGiantChest;
|
|
||||||
public static Block blockGiantChestMedium;
|
|
||||||
public static Block blockGiantChestLarge;
|
|
||||||
public static Block blockGrinder;
|
|
||||||
public static Block blockGrinderDouble;
|
|
||||||
public static Block blockFurnaceDouble;
|
|
||||||
public static Block blockInputter;
|
|
||||||
public static Block blockInputterAdvanced;
|
|
||||||
public static Block blockFishingNet;
|
|
||||||
public static Block blockFurnaceSolar;
|
|
||||||
public static Block blockHeatCollector;
|
|
||||||
public static Block blockItemRepairer;
|
|
||||||
public static Block blockGreenhouseGlass;
|
|
||||||
public static Block blockBreaker;
|
|
||||||
public static Block blockPlacer;
|
|
||||||
public static Block blockDropper;
|
|
||||||
public static Block blockRice;
|
|
||||||
public static Block blockCanola;
|
|
||||||
public static Block blockFlax;
|
|
||||||
public static Block blockCoffee;
|
|
||||||
public static Block blockCanolaPress;
|
|
||||||
public static Block blockFermentingBarrel;
|
|
||||||
public static Block blockCoalGenerator;
|
|
||||||
public static Block blockOilGenerator;
|
|
||||||
public static Block blockPhantomface;
|
|
||||||
public static Block blockPhantomPlacer;
|
|
||||||
public static Block blockPhantomBreaker;
|
|
||||||
public static Block blockPhantomLiquiface;
|
|
||||||
public static Block blockPhantomEnergyface;
|
|
||||||
public static Block blockPhantomRedstoneface;
|
|
||||||
public static Block blockPlayerInterface;
|
|
||||||
public static Block blockFluidPlacer;
|
|
||||||
public static Block blockFluidCollector;
|
|
||||||
public static Block blockLavaFactoryController;
|
|
||||||
public static Block blockCoffeeMachine;
|
|
||||||
public static Block blockPhantomBooster;
|
|
||||||
public static Block blockEnergizer;
|
|
||||||
public static Block blockEnervator;
|
|
||||||
public static Block blockTestifiBucksGreenWall;
|
|
||||||
public static Block blockTestifiBucksWhiteWall;
|
|
||||||
public static Block blockTestifiBucksGreenStairs;
|
|
||||||
public static Block blockTestifiBucksWhiteStairs;
|
|
||||||
public static Block blockTestifiBucksGreenSlab;
|
|
||||||
public static Block blockTestifiBucksWhiteSlab;
|
|
||||||
public static Block blockTestifiBucksGreenFence;
|
|
||||||
public static Block blockTestifiBucksWhiteFence;
|
|
||||||
public static Block blockColoredLamp;
|
|
||||||
public static Block blockColoredLampOn;
|
|
||||||
public static Block blockLampPowerer;
|
|
||||||
public static Block blockTreasureChest;
|
|
||||||
public static Block blockXPSolidifier;
|
|
||||||
public static Block blockSmileyCloud;
|
|
||||||
public static Block blockLeafGenerator;
|
|
||||||
public static Block blockDirectionalBreaker;
|
|
||||||
public static Block blockRangedCollector;
|
|
||||||
public static Block blockLaserRelay;
|
|
||||||
public static Block blockLaserRelayAdvanced;
|
|
||||||
public static Block blockLaserRelayExtreme;
|
|
||||||
public static Block blockLaserRelayFluids;
|
|
||||||
public static Block blockLaserRelayItem;
|
|
||||||
public static Block blockLaserRelayItemWhitelist;
|
|
||||||
public static Block blockItemViewer;
|
|
||||||
public static Block blockItemViewerHopping;
|
|
||||||
public static Block blockBlackLotus;
|
|
||||||
public static Block blockCrystal;
|
|
||||||
public static Block blockCrystalEmpowered;
|
|
||||||
public static Block blockAtomicReconstructor;
|
|
||||||
public static Block blockMiner;
|
|
||||||
public static Block blockFireworkBox;
|
|
||||||
public static Block blockQuartzWall;
|
|
||||||
public static Block blockQuartzStair;
|
|
||||||
public static Block blockQuartzSlab;
|
|
||||||
public static Block blockChiseledQuartzWall;
|
|
||||||
public static Block blockChiseledQuartzStair;
|
|
||||||
public static Block blockChiseledQuartzSlab;
|
|
||||||
public static Block blockPillarQuartzWall;
|
|
||||||
public static Block blockPillarQuartzStair;
|
|
||||||
public static Block blockPillarQuartzSlab;
|
|
||||||
public static Block blockDisplayStand;
|
|
||||||
public static Block blockShockSuppressor;
|
|
||||||
public static Block blockEmpowerer;
|
|
||||||
public static Block blockBioReactor;
|
|
||||||
public static Block blockTinyTorch;
|
|
||||||
public static Block blockFarmer;
|
|
||||||
public static Block blockBatteryBox;
|
|
||||||
public static Block blockCrystalClusterRedstone;
|
|
||||||
public static Block blockCrystalClusterLapis;
|
|
||||||
public static Block blockCrystalClusterDiamond;
|
|
||||||
public static Block blockCrystalClusterCoal;
|
|
||||||
public static Block blockCrystalClusterEmerald;
|
|
||||||
public static Block blockCrystalClusterIron;
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
ActuallyAdditions.LOGGER.info("Initializing Blocks...");
|
|
||||||
|
|
||||||
blockCrystalClusterRedstone = new BlockCrystalCluster("block_crystal_cluster_redstone", TheCrystals.REDSTONE);
|
|
||||||
blockCrystalClusterLapis = new BlockCrystalCluster("block_crystal_cluster_lapis", TheCrystals.LAPIS);
|
|
||||||
blockCrystalClusterDiamond = new BlockCrystalCluster("block_crystal_cluster_diamond", TheCrystals.DIAMOND);
|
|
||||||
blockCrystalClusterCoal = new BlockCrystalCluster("block_crystal_cluster_coal", TheCrystals.COAL);
|
|
||||||
blockCrystalClusterEmerald = new BlockCrystalCluster("block_crystal_cluster_emerald", TheCrystals.EMERALD);
|
|
||||||
blockCrystalClusterIron = new BlockCrystalCluster("block_crystal_cluster_iron", TheCrystals.IRON);
|
|
||||||
blockBatteryBox = new BlockBatteryBox("block_battery_box");
|
|
||||||
blockItemViewerHopping = new BlockItemViewerHopping("block_item_viewer_hopping");
|
|
||||||
blockFarmer = new BlockFarmer("block_farmer");
|
|
||||||
blockBioReactor = new BlockBioReactor("block_bio_reactor");
|
|
||||||
blockEmpowerer = new BlockEmpowerer("block_empowerer");
|
|
||||||
blockTinyTorch = new BlockTinyTorch("block_tiny_torch");
|
|
||||||
blockShockSuppressor = new BlockShockSuppressor("block_shock_suppressor");
|
|
||||||
blockDisplayStand = new BlockDisplayStand("block_display_stand");
|
|
||||||
blockPlayerInterface = new BlockPlayerInterface("block_player_interface");
|
|
||||||
blockItemViewer = new BlockItemViewer("block_item_viewer");
|
|
||||||
blockFireworkBox = new BlockFireworkBox("block_firework_box");
|
|
||||||
blockMiner = new BlockMiner("block_miner");
|
|
||||||
blockAtomicReconstructor = new BlockAtomicReconstructor("block_atomic_reconstructor");
|
|
||||||
blockCrystal = new BlockCrystal("block_crystal", false);
|
|
||||||
blockCrystalEmpowered = new BlockCrystal("block_crystal_empowered", true);
|
|
||||||
blockBlackLotus = new BlockBlackLotus("block_black_lotus");
|
|
||||||
blockLaserRelay = new BlockLaserRelay("block_laser_relay", Type.ENERGY_BASIC);
|
|
||||||
blockLaserRelayAdvanced = new BlockLaserRelay("block_laser_relay_advanced", Type.ENERGY_ADVANCED);
|
|
||||||
blockLaserRelayExtreme = new BlockLaserRelay("block_laser_relay_extreme", Type.ENERGY_EXTREME);
|
|
||||||
blockLaserRelayFluids = new BlockLaserRelay("block_laser_relay_fluids", Type.FLUIDS);
|
|
||||||
blockLaserRelayItem = new BlockLaserRelay("block_laser_relay_item", Type.ITEM);
|
|
||||||
blockLaserRelayItemWhitelist = new BlockLaserRelay("block_laser_relay_item_whitelist", Type.ITEM_WHITELIST);
|
|
||||||
blockRangedCollector = new BlockRangedCollector("block_ranged_collector");
|
|
||||||
blockDirectionalBreaker = new BlockDirectionalBreaker("block_directional_breaker");
|
|
||||||
blockLeafGenerator = new BlockLeafGenerator("block_leaf_generator");
|
|
||||||
blockSmileyCloud = new BlockSmileyCloud("block_smiley_cloud");
|
|
||||||
blockXPSolidifier = new BlockXPSolidifier("block_xp_solidifier");
|
|
||||||
blockTestifiBucksGreenWall = new BlockGeneric("block_testifi_bucks_green_wall");
|
|
||||||
blockTestifiBucksWhiteWall = new BlockGeneric("block_testifi_bucks_white_wall");
|
|
||||||
blockTestifiBucksGreenStairs = new BlockStair(blockTestifiBucksGreenWall, "block_testifi_bucks_green_stairs");
|
|
||||||
blockTestifiBucksWhiteStairs = new BlockStair(blockTestifiBucksWhiteWall, "block_testifi_bucks_white_stairs");
|
|
||||||
blockTestifiBucksGreenSlab = new BlockSlabs("block_testifi_bucks_green_slab", blockTestifiBucksGreenWall);
|
|
||||||
blockTestifiBucksWhiteSlab = new BlockSlabs("block_testifi_bucks_white_slab", blockTestifiBucksWhiteWall);
|
|
||||||
blockTestifiBucksGreenFence = new BlockWallAA("block_testifi_bucks_green_fence", blockTestifiBucksGreenWall);
|
|
||||||
blockTestifiBucksWhiteFence = new BlockWallAA("block_testifi_bucks_white_fence", blockTestifiBucksWhiteWall);
|
|
||||||
blockColoredLamp = new BlockColoredLamp(false, "block_colored_lamp");
|
|
||||||
blockColoredLampOn = new BlockColoredLamp(true, "block_colored_lamp_on");
|
|
||||||
blockLampPowerer = new BlockLampPowerer("block_lamp_powerer");
|
|
||||||
blockTreasureChest = new BlockTreasureChest("block_treasure_chest");
|
|
||||||
blockEnergizer = new BlockEnergizer(true, "block_energizer");
|
|
||||||
blockEnervator = new BlockEnergizer(false, "block_enervator");
|
|
||||||
blockLavaFactoryController = new BlockLavaFactoryController("block_lava_factory_controller");
|
|
||||||
blockCanolaPress = new BlockCanolaPress("block_canola_press");
|
|
||||||
blockPhantomface = new BlockPhantom(BlockPhantom.Type.FACE, "block_phantomface");
|
|
||||||
blockPhantomPlacer = new BlockPhantom(BlockPhantom.Type.PLACER, "block_phantom_placer");
|
|
||||||
blockPhantomLiquiface = new BlockPhantom(BlockPhantom.Type.LIQUIFACE, "block_phantom_liquiface");
|
|
||||||
blockPhantomEnergyface = new BlockPhantom(BlockPhantom.Type.ENERGYFACE, "block_phantom_energyface");
|
|
||||||
blockPhantomRedstoneface = new BlockPhantom(BlockPhantom.Type.REDSTONEFACE, "block_phantom_redstoneface");
|
|
||||||
blockPhantomBreaker = new BlockPhantom(BlockPhantom.Type.BREAKER, "block_phantom_breaker");
|
|
||||||
blockCoalGenerator = new BlockCoalGenerator("block_coal_generator");
|
|
||||||
blockOilGenerator = new BlockOilGenerator("block_oil_generator");
|
|
||||||
blockFermentingBarrel = new BlockFermentingBarrel("block_fermenting_barrel");
|
|
||||||
blockRice = new BlockPlant("block_rice", 1, 2);
|
|
||||||
blockCanola = new BlockPlant("block_canola", 2, 3);
|
|
||||||
blockFlax = new BlockPlant("block_flax", 2, 4);
|
|
||||||
blockCoffee = new BlockPlant("block_coffee", 2, 2);
|
|
||||||
blockCompost = new BlockCompost("block_compost");
|
|
||||||
blockMisc = new BlockMisc("block_misc");
|
|
||||||
blockFeeder = new BlockFeeder("block_feeder");
|
|
||||||
blockGiantChest = new BlockGiantChest("block_giant_chest", 0);
|
|
||||||
blockGiantChestMedium = new BlockGiantChest("block_giant_chest_medium", 1);
|
|
||||||
blockGiantChestLarge = new BlockGiantChest("block_giant_chest_large", 2);
|
|
||||||
blockGrinder = new BlockGrinder(false, "block_grinder");
|
|
||||||
blockGrinderDouble = new BlockGrinder(true, "block_grinder_double");
|
|
||||||
blockFurnaceDouble = new BlockFurnaceDouble("block_furnace_double");
|
|
||||||
blockInputter = new BlockInputter(false, "block_inputter");
|
|
||||||
blockInputterAdvanced = new BlockInputter(true, "block_inputter_advanced");
|
|
||||||
blockFishingNet = new BlockFishingNet("block_fishing_net");
|
|
||||||
blockFurnaceSolar = new BlockFurnaceSolar("block_furnace_solar");
|
|
||||||
blockHeatCollector = new BlockHeatCollector("block_heat_collector");
|
|
||||||
blockItemRepairer = new BlockItemRepairer("block_item_repairer");
|
|
||||||
blockGreenhouseGlass = new BlockGreenhouseGlass("block_greenhouse_glass");
|
|
||||||
blockBreaker = new BlockBreaker(false, "block_breaker");
|
|
||||||
blockPlacer = new BlockBreaker(true, "block_placer");
|
|
||||||
blockDropper = new BlockDropper("block_dropper");
|
|
||||||
blockFluidPlacer = new BlockFluidCollector(true, "block_fluid_placer");
|
|
||||||
blockFluidCollector = new BlockFluidCollector(false, "block_fluid_collector");
|
|
||||||
blockCoffeeMachine = new BlockCoffeeMachine("block_coffee_machine");
|
|
||||||
blockPhantomBooster = new BlockPhantomBooster("block_phantom_booster");
|
|
||||||
blockWildPlant = new BlockWildPlant("block_wild");
|
|
||||||
blockQuartzWall = new BlockWallAA("block_quartz_wall", blockMisc);
|
|
||||||
blockChiseledQuartzWall = new BlockWallAA("block_chiseled_quartz_wall", blockMisc);
|
|
||||||
blockPillarQuartzWall = new BlockWallAA("block_pillar_quartz_wall", blockMisc);
|
|
||||||
blockQuartzStair = new BlockStair(blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ), "block_quartz_stair");
|
|
||||||
blockChiseledQuartzStair = new BlockStair(blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED), "block_chiseled_quartz_stair");
|
|
||||||
blockPillarQuartzStair = new BlockStair(blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR), "block_pillar_quartz_stair");
|
|
||||||
blockQuartzSlab = new BlockSlabs("block_quartz_slab", blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ));
|
|
||||||
blockChiseledQuartzSlab = new BlockSlabs("block_chiseled_quartz_slab", blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED));
|
|
||||||
blockPillarQuartzSlab = new BlockSlabs("block_pillar_quartz_slab", blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockBase.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
public BlockBase(Material material, String name) {
|
|
||||||
super(material);
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getBaseName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new ItemBlockBase(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.COMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockBushBase.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import net.minecraft.block.BlockBush;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
public BlockBushBase(String name) {
|
|
||||||
this.name = name;
|
|
||||||
this.setSoundType(SoundType.PLANT);
|
|
||||||
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getBaseName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new ItemBlockBase(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.COMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,304 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockContainerBase.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
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.blocks.render.IHasModel;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockContainer;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagInt;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.Style;
|
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
|
||||||
|
|
||||||
public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity, IHasModel {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
public BlockContainerBase(Material material, String name) {
|
|
||||||
super(material);
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getBaseName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new ItemBlockBase(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRendering() {
|
|
||||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.COMMON;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dropInventory(World world, BlockPos position) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity aTile = world.getTileEntity(position);
|
|
||||||
if (aTile instanceof TileEntityInventoryBase) {
|
|
||||||
TileEntityInventoryBase tile = (TileEntityInventoryBase) aTile;
|
|
||||||
if (tile.inv.getSlots() > 0) {
|
|
||||||
for (int i = 0; i < tile.inv.getSlots(); i++) {
|
|
||||||
this.dropSlotFromInventory(i, tile, world, position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) {
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(i);
|
|
||||||
if (StackUtil.isValid(stack)) {
|
|
||||||
float dX = 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;
|
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
|
||||||
float factor = 0.05F;
|
|
||||||
entityItem.motionX = world.rand.nextGaussian() * factor;
|
|
||||||
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
|
||||||
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntity(entityItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player) {
|
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
|
||||||
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) {
|
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
|
||||||
if (!world.isRemote && base.isRedstoneToggle()) {
|
|
||||||
base.isPulseMode = !base.isPulseMode;
|
|
||||||
base.markDirty();
|
|
||||||
base.sendUpdate();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) {
|
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
|
||||||
if (base.respondsToPulses()) {
|
|
||||||
base.activateOnPulse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void neighborsChangedCustom(World world, BlockPos pos) {
|
|
||||||
this.updateRedstoneState(world, pos);
|
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) {
|
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
|
||||||
if (base.shouldSaveDataOnChangeOrWorldStart()) {
|
|
||||||
base.saveDataOnChangeOrWorldStart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
|
||||||
this.neighborsChangedCustom(worldIn, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
|
||||||
super.onNeighborChange(world, pos, neighbor);
|
|
||||||
if (world instanceof World) {
|
|
||||||
this.neighborsChangedCustom((World) world, pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateRedstoneState(World world, BlockPos pos) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) {
|
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
|
||||||
boolean powered = world.getRedstonePowerFromNeighbors(pos) > 0;
|
|
||||||
boolean wasPowered = base.isRedstonePowered;
|
|
||||||
if (powered && !wasPowered) {
|
|
||||||
if (base.respondsToPulses()) {
|
|
||||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
|
||||||
}
|
|
||||||
base.setRedstonePowered(true);
|
|
||||||
} else if (!powered && wasPowered) {
|
|
||||||
base.setRedstonePowered(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank) {
|
|
||||||
ItemStack heldItem = player.getHeldItem(hand);
|
|
||||||
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
|
||||||
this.updateRedstoneState(world, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
|
||||||
if (stack.hasTagCompound()) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) {
|
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
|
||||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
|
||||||
if (compound != null) {
|
|
||||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
|
||||||
if (!player.capabilities.isCreativeMode) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
|
||||||
player.sendMessage(new TextComponentTranslation("info." + ActuallyAdditions.MODID + ".machineBroke").setStyle(new Style().setColor(TextFormatting.RED)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); }
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
if (tile instanceof TileEntityBase) {
|
|
||||||
TileEntityBase base = (TileEntityBase) tile;
|
|
||||||
if (!base.stopFromDropping) {
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
|
||||||
|
|
||||||
//Remove unnecessarily saved default values to avoid unstackability
|
|
||||||
List<String> keysToRemove = new ArrayList<>();
|
|
||||||
for (String key : data.getKeySet()) {
|
|
||||||
NBTBase tag = data.getTag(key);
|
|
||||||
//Remove only ints because they are the most common ones
|
|
||||||
//Add else if below here to remove more types
|
|
||||||
if (tag instanceof NBTTagInt) {
|
|
||||||
if (((NBTTagInt) tag).getInt() == 0) {
|
|
||||||
keysToRemove.add(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String key : keysToRemove) {
|
|
||||||
data.removeTag(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
|
||||||
if (!data.isEmpty()) {
|
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
|
||||||
stack.getTagCompound().setTag("Data", data);
|
|
||||||
}
|
|
||||||
|
|
||||||
drops.add(stack);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.getDrops(drops, world, pos, state, fortune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
|
||||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
|
||||||
super.harvestBlock(worldIn, player, pos, state, te, stack);
|
|
||||||
worldIn.setBlockToAir(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
|
||||||
return EnumBlockRenderType.MODEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
|
||||||
if (this.shouldDropInventory(world, pos)) {
|
|
||||||
this.dropInventory(world, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldDropInventory(World world, BlockPos pos) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockFluidFlowing.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
|
|
||||||
public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName) {
|
|
||||||
super(fluid, material);
|
|
||||||
this.name = unlocalizedName;
|
|
||||||
this.displacements.put(this, false);
|
|
||||||
|
|
||||||
this.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void register() {
|
|
||||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getBaseName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemBlockBase getItemBlock() {
|
|
||||||
return new ItemBlockBase(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDisplace(IBlockAccess world, BlockPos pos) {
|
|
||||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean displaceIfPossible(World world, BlockPos pos) {
|
|
||||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack) {
|
|
||||||
return EnumRarity.EPIC;
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue