Go suck a dick now.
This commit is contained in:
Ellpeck 2016-05-19 20:05:12 +02:00
parent cddb514382
commit b00e214217
264 changed files with 1109 additions and 964 deletions

View file

@ -7,20 +7,23 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
} }
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
//I'm doing this because people made me do it. Even though it never worked properly when I tried it. Sigh.
apply plugin: 'idea'
version = "1.9-r33" version = "1.9-r33"
group = "de.ellpeck.actuallyadditions" group = "de.ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions" archivesBaseName = "ActuallyAdditions"
minecraft { minecraft {
version = "1.9-12.16.1.1887" version = "1.9.4-12.17.0.1909-1.9.4"
runDir = "idea" runDir = "idea"
mappings = "snapshot_20160420" mappings = "snapshot_20160519"
makeObfSourceJar = false makeObfSourceJar = false
//useDepAts = true //useDepAts = true
@ -61,10 +64,13 @@ processResources {
} }
} }
jar {} jar {
}
task deobfJar(type: Jar) { task deobfJar(type: Jar) {
from sourceSets.main.output from sourceSets.main.output
from sourceSets.main.java
classifier = 'dev' classifier = 'dev'
} }

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip

View file

@ -1,67 +0,0 @@
package cofh.api.energy;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
/**
* Reference implementation of {@link IEnergyReceiver} and {@link IEnergyProvider}. Use/extend this or implement your own.
*
* This class is really meant to summarize how each interface is properly used.
*
* @author King Lemming
*
*/
public class TileEnergyHandler extends TileEntity implements IEnergyReceiver, IEnergyProvider {
protected EnergyStorage storage = new EnergyStorage(32000);
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
storage.readFromNBT(nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
storage.writeToNBT(nbt);
}
/* IEnergyConnection */
@Override
public boolean canConnectEnergy(EnumFacing from) {
return true;
}
/* IEnergyReceiver */
@Override
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
return storage.receiveEnergy(maxReceive, simulate);
}
/* IEnergyProvider */
@Override
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) {
return storage.extractEnergy(maxExtract, simulate);
}
/* IEnergyHandler */
@Override
public int getEnergyStored(EnumFacing from) {
return storage.getEnergyStored();
}
@Override
public int getMaxEnergyStored(EnumFacing from) {
return storage.getMaxEnergyStored();
}
}

View file

@ -29,7 +29,7 @@ public class ActuallyAdditionsAPI{
public static final String MOD_ID = "actuallyadditions"; public static final String MOD_ID = "actuallyadditions";
public static final String API_ID = MOD_ID+"api"; public static final String API_ID = MOD_ID+"api";
public static final String API_VERSION = "13"; public static final String API_VERSION = "14";
/** /**
* Use this to handle things that aren't based in the API itself * Use this to handle things that aren't based in the API itself
@ -38,15 +38,15 @@ public class ActuallyAdditionsAPI{
*/ */
public static IMethodHandler methodHandler; public static IMethodHandler methodHandler;
public static List<CrusherRecipe> crusherRecipes = new ArrayList<CrusherRecipe>(); public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<CrusherRecipe>();
public static List<BallOfFurReturn> ballOfFurReturnItems = new ArrayList<BallOfFurReturn>(); public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<BallOfFurReturn>();
public static List<TreasureChestLoot> treasureChestLoot = new ArrayList<TreasureChestLoot>(); public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<TreasureChestLoot>();
public static List<LensConversionRecipe> reconstructorLensConversionRecipes = new ArrayList<LensConversionRecipe>(); public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<LensConversionRecipe>();
public static Map<Item, IColorLensChanger> reconstructorLensColorChangers = new HashMap<Item, IColorLensChanger>(); public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<Item, IColorLensChanger>();
public static List<CoffeeIngredient> coffeeMachineIngredients = new ArrayList<CoffeeIngredient>(); public static final List<CoffeeIngredient> COFFEE_MACHINE_INGREDIENTS = new ArrayList<CoffeeIngredient>();
public static List<IBookletEntry> bookletEntries = new ArrayList<IBookletEntry>(); public static final List<IBookletEntry> BOOKLET_ENTRIES = new ArrayList<IBookletEntry>();
public static List<BookletPage> bookletPagesWithItemStackData = new ArrayList<BookletPage>(); public static final List<BookletPage> BOOKLET_PAGES_WITH_ITEM_DATA = new ArrayList<BookletPage>();
//These are getting initialized in Actually Additions' PreInit phase //These are getting initialized in Actually Additions' PreInit phase
//DO NOT CHANGE/OVERRIDE THESE!! //DO NOT CHANGE/OVERRIDE THESE!!
@ -92,7 +92,7 @@ public class ActuallyAdditionsAPI{
*/ */
public static void addCrusherRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){ public static void addCrusherRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){
if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){ if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){
crusherRecipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance)); CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
} }
} }
@ -117,7 +117,7 @@ public class ActuallyAdditionsAPI{
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/ */
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){ public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
crusherRecipes.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance)); CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance));
} }
/** /**
@ -130,7 +130,7 @@ public class ActuallyAdditionsAPI{
*/ */
public static void addCrusherRecipe(ItemStack input, String outputOne, int outputOneAmount){ public static void addCrusherRecipe(ItemStack input, String outputOne, int outputOneAmount){
if(!OreDictionary.getOres(outputOne, false).isEmpty()){ if(!OreDictionary.getOres(outputOne, false).isEmpty()){
crusherRecipes.add(new CrusherRecipe(input, outputOne, outputOneAmount)); CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputOneAmount));
} }
} }
@ -141,7 +141,7 @@ public class ActuallyAdditionsAPI{
* @param chance The chance (this is from WeightedRandom.Item) * @param chance The chance (this is from WeightedRandom.Item)
*/ */
public static void addBallOfFurReturnItem(ItemStack stack, int chance){ public static void addBallOfFurReturnItem(ItemStack stack, int chance){
ballOfFurReturnItems.add(new BallOfFurReturn(stack, chance)); BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
} }
/** /**
@ -153,7 +153,7 @@ public class ActuallyAdditionsAPI{
* @param maxAmount The maximum stacksize of the returned stack * @param maxAmount The maximum stacksize of the returned stack
*/ */
public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount){ public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount){
treasureChestLoot.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount)); TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
} }
/** /**
@ -167,7 +167,7 @@ public class ActuallyAdditionsAPI{
* Note how this always has to be the same instance of the lens type that the item also has for it to work! * Note how this always has to be the same instance of the lens type that the item also has for it to work!
*/ */
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){ public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse, type)); RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
} }
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){ public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
@ -184,7 +184,7 @@ public class ActuallyAdditionsAPI{
* Note how this always has to be the same instance of the lens type that the item also has for it to work! * Note how this always has to be the same instance of the lens type that the item also has for it to work!
*/ */
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse, LensConversion type){ public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse, LensConversion type){
reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse, type)); RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
} }
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){ public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){
@ -201,7 +201,7 @@ public class ActuallyAdditionsAPI{
* @param changer The change mechanism * @param changer The change mechanism
*/ */
public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer){ public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer){
reconstructorLensColorChangers.put(item, changer); RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
} }
/** /**
@ -210,7 +210,7 @@ public class ActuallyAdditionsAPI{
* @param ingredient The ingredient to add * @param ingredient The ingredient to add
*/ */
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient){ public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient){
coffeeMachineIngredients.add(ingredient); COFFEE_MACHINE_INGREDIENTS.add(ingredient);
} }
/** /**
@ -219,7 +219,7 @@ public class ActuallyAdditionsAPI{
* @param entry The entry to add * @param entry The entry to add
*/ */
public static void addBookletEntry(IBookletEntry entry){ public static void addBookletEntry(IBookletEntry entry){
bookletEntries.add(entry); BOOKLET_ENTRIES.add(entry);
} }
/** /**
@ -229,6 +229,6 @@ public class ActuallyAdditionsAPI{
* @param page The page to add * @param page The page to add
*/ */
public static void addPageWithItemStackData(BookletPage page){ public static void addPageWithItemStackData(BookletPage page){
bookletPagesWithItemStackData.add(page); BOOKLET_PAGES_WITH_ITEM_DATA.add(page);
} }
} }

View file

@ -18,7 +18,7 @@ import net.minecraft.util.math.BlockPos;
/** /**
* This is the base class for a Reconstructor Lens Type that converts two items * This is the base class for a Reconstructor Lens Type that converts two items
* via the ActuallyAdditionsAPI.reconstructorLensConversionRecipes list. * via the ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES list.
* *
* If you want to make a new type of conversion, just use your type in the recipe * If you want to make a new type of conversion, just use your type in the recipe
* If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion. * If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion.

View file

@ -15,7 +15,7 @@ import net.minecraft.util.WeightedRandom;
public class BallOfFurReturn extends WeightedRandom.Item{ public class BallOfFurReturn extends WeightedRandom.Item{
public ItemStack returnItem; public final ItemStack returnItem;
public BallOfFurReturn(ItemStack returnItem, int chance){ public BallOfFurReturn(ItemStack returnItem, int chance){
super(chance); super(chance);

View file

@ -20,8 +20,8 @@ import java.util.List;
public class LensConversionRecipe{ public class LensConversionRecipe{
public int energyUse; public final int energyUse;
public LensConversion type; public final LensConversion type;
private String input; private String input;
private String output; private String output;
private ItemStack inputStack; private ItemStack inputStack;

View file

@ -15,9 +15,9 @@ import net.minecraft.util.WeightedRandom;
public class TreasureChestLoot extends WeightedRandom.Item{ public class TreasureChestLoot extends WeightedRandom.Item{
public ItemStack returnItem; public final ItemStack returnItem;
public int minAmount; public final int minAmount;
public int maxAmount; public final int maxAmount;
public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount){ public TreasureChestLoot(ItemStack returnItem, int chance, int minAmount, int maxAmount){
super(chance); super(chance);

View file

@ -21,7 +21,7 @@ public class InitAchievements{
public static int pageNumber; public static int pageNumber;
public static AchievementPage theAchievementPage; public static AchievementPage theAchievementPage;
public static ArrayList<Achievement> achievementList = new ArrayList<Achievement>(); public static final ArrayList<Achievement> achievementList = new ArrayList<Achievement>();
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Achievements..."); ModUtil.LOGGER.info("Initializing Achievements...");

View file

@ -40,6 +40,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{ public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{
@ -84,8 +85,9 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
} }
} }
else{ else{
if(reconstructor.getStackInSlot(0) != null){ ItemStack slot = reconstructor.getStackInSlot(0);
player.inventory.setInventorySlotContents(player.inventory.currentItem, reconstructor.getStackInSlot(0).copy()); if(slot != null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, slot.copy());
reconstructor.setInventorySlotContents(0, null); reconstructor.setInventorySlotContents(0, null);
} }
} }
@ -94,13 +96,14 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
return true; return true;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int i){ public TileEntity createNewTileEntity(@Nonnull World world, int i){
return new TileEntityAtomicReconstructor(); return new TileEntityAtomicReconstructor();
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }
@ -159,6 +162,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName(); return this.getUnlocalizedName();
@ -170,7 +174,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
} }
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean bool){ public void addInformation(@Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull List<String> list, boolean bool){
long sysTime = System.currentTimeMillis(); long sysTime = System.currentTimeMillis();
if(this.lastSysTime+3000 < sysTime){ if(this.lastSysTime+3000 < sysTime){

View file

@ -32,10 +32,12 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockBreaker extends BlockContainerBase{ public class BlockBreaker extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
private boolean isPlacer; private final boolean isPlacer;
public BlockBreaker(boolean isPlacer, String name){ public BlockBreaker(boolean isPlacer, String name){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -46,8 +48,9 @@ public class BlockBreaker extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker(); return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker();
} }
@ -85,7 +88,7 @@ public class BlockBreaker extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -26,6 +26,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockCanolaPress extends BlockContainerBase{ public class BlockCanolaPress extends BlockContainerBase{
public BlockCanolaPress(String name){ public BlockCanolaPress(String name){
@ -36,8 +38,9 @@ public class BlockCanolaPress extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityCanolaPress(); return new TileEntityCanolaPress();
} }
@ -46,7 +49,7 @@ public class BlockCanolaPress extends BlockContainerBase{
if(!world.isRemote){ if(!world.isRemote){
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos); TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos);
if(press != null){ if(press != null){
if(!this.tryUseItemOnTank(player, stack, side, press)){ if(this.checkFailUseItemOnTank(player, stack, side, press)){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
} }
} }
@ -61,7 +64,7 @@ public class BlockCanolaPress extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -33,6 +33,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class BlockCoalGenerator extends BlockContainerBase{ public class BlockCoalGenerator extends BlockContainerBase{
@ -48,8 +49,9 @@ public class BlockCoalGenerator extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityCoalGenerator(); return new TileEntityCoalGenerator();
} }
@ -88,7 +90,7 @@ public class BlockCoalGenerator extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -32,6 +32,8 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockCoffeeMachine extends BlockContainerBase{ public class BlockCoffeeMachine extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625, 1-0.0625*2, 1-0.0625); private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625, 1-0.0625*2, 1-0.0625);
@ -46,6 +48,7 @@ public class BlockCoffeeMachine extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB; return AABB;
@ -66,7 +69,7 @@ public class BlockCoffeeMachine extends BlockContainerBase{
if(!world.isRemote){ if(!world.isRemote){
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos); TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos);
if(machine != null){ if(machine != null){
if(!this.tryUseItemOnTank(player, stack, f6, machine)){ if(this.checkFailUseItemOnTank(player, stack, f6, machine)){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
} }
} }
@ -75,13 +78,14 @@ public class BlockCoffeeMachine extends BlockContainerBase{
return true; return true;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int meta){ public TileEntity createNewTileEntity(@Nonnull World world, int meta){
return new TileEntityCoffeeMachine(); return new TileEntityCoffeeMachine();
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -37,14 +37,15 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockColoredLamp extends BlockBase{ public class BlockColoredLamp extends BlockBase{
public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values(); public static final TheColoredLampColors[] allLampTypes = TheColoredLampColors.values();
private static final PropertyInteger META = PropertyInteger.create("meta", 0, allLampTypes.length-1); private static final PropertyInteger META = PropertyInteger.create("meta", 0, allLampTypes.length-1);
public boolean isOn; public final boolean isOn;
public BlockColoredLamp(boolean isOn, String name){ public BlockColoredLamp(boolean isOn, String name){
super(Material.REDSTONE_LIGHT, name); super(Material.REDSTONE_LIGHT, name);
@ -100,7 +101,7 @@ public class BlockColoredLamp extends BlockBase{
} }
@Override @Override
public ItemStack createStackedBlock(IBlockState state){ public ItemStack createStackedBlock(@Nonnull IBlockState state){
return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state)); return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state));
} }
@ -113,7 +114,7 @@ public class BlockColoredLamp extends BlockBase{
} }
@Override @Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ public int getLightValue(@Nonnull IBlockState state, IBlockAccess world, @Nonnull BlockPos pos){
return this.isOn ? 15 : 0; return this.isOn ? 15 : 0;
} }
@ -147,14 +148,16 @@ public class BlockColoredLamp extends BlockBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getItemStackDisplayName(ItemStack stack){ public String getItemStackDisplayName(@Nonnull ItemStack stack){
if(stack.getItemDamage() >= allLampTypes.length){ if(stack.getItemDamage() >= allLampTypes.length){
return null; return StringUtil.BUGGED_ITEM_NAME;
} }
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".onSuffix.desc")+")" : ""); return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".onSuffix.desc")+")" : "");
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return InitBlocks.blockColoredLamp.getUnlocalizedName()+allLampTypes[stack.getItemDamage()].name; return InitBlocks.blockColoredLamp.getUnlocalizedName()+allLampTypes[stack.getItemDamage()].name;

View file

@ -39,6 +39,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class BlockCompost extends BlockContainerBase implements IHudDisplay{ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
@ -60,13 +61,14 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
//this.setBlockBoundsForItemRender(); //this.setBlockBoundsForItemRender();
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB; return AABB;
} }
@Override @Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn){ public void addCollisionBoxToList(IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox, @Nonnull List<AxisAlignedBB> collidingBoxes, Entity entityIn){
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
@ -88,42 +90,45 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stackPlayer, EnumFacing f6, float f7, float f8, float f9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stackPlayer, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos); TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos);
//Add items to be composted if(tile != null){
if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){ //Add items to be composted
if(tile.slots[0] == null){ if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){
tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal()); if(tile.slots[0] == null){
tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal());
}
else{
tile.slots[0].stackSize++;
}
if(!player.capabilities.isCreativeMode){
stackPlayer.stackSize--;
}
tile.markDirty();
} }
else{
tile.slots[0].stackSize++;
}
if(!player.capabilities.isCreativeMode){
player.inventory.getCurrentItem().stackSize--;
}
tile.markDirty();
}
//Add Fertilizer to player's inventory //Add Fertilizer to player's inventory
else if(tile.slots[0] != null && (stackPlayer == null || (stackPlayer.getItem() instanceof ItemFertilizer && stackPlayer.stackSize <= stackPlayer.getMaxStackSize()-tile.slots[0].stackSize)) && tile.slots[0].getItem() instanceof ItemFertilizer){ else if(tile.slots[0] != null && (stackPlayer == null || (stackPlayer.getItem() instanceof ItemFertilizer && stackPlayer.stackSize <= stackPlayer.getMaxStackSize()-tile.slots[0].stackSize)) && tile.slots[0].getItem() instanceof ItemFertilizer){
if(stackPlayer == null){ if(stackPlayer == null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy()); player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
}
else{
stackPlayer.stackSize += tile.slots[0].stackSize;
}
tile.slots[0] = null;
tile.markDirty();
} }
else{
stackPlayer.stackSize += tile.slots[0].stackSize;
}
tile.slots[0] = null;
tile.markDirty();
} }
} }
return true; return true;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int meta){ public TileEntity createNewTileEntity(@Nonnull World world, int meta){
return new TileEntityCompost(); return new TileEntityCompost();
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -27,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class BlockCrystal extends BlockBase{ public class BlockCrystal extends BlockBase{
@ -84,6 +85,7 @@ public class BlockCrystal extends BlockBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allCrystals[stack.getItemDamage()].name; return stack.getItemDamage() >= allCrystals.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allCrystals[stack.getItemDamage()].name;

View file

@ -31,6 +31,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockDirectionalBreaker extends BlockContainerBase{ public class BlockDirectionalBreaker extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
@ -43,8 +45,9 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityDirectionalBreaker(); return new TileEntityDirectionalBreaker();
} }
@ -82,7 +85,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -30,6 +30,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockDropper extends BlockContainerBase{ public class BlockDropper extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
@ -42,8 +44,9 @@ public class BlockDropper extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityDropper(); return new TileEntityDropper();
} }
@ -81,7 +84,7 @@ public class BlockDropper extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -27,9 +27,11 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockEnergizer extends BlockContainerBase{ public class BlockEnergizer extends BlockContainerBase{
private boolean isEnergizer; private final boolean isEnergizer;
public BlockEnergizer(boolean isEnergizer, String name){ public BlockEnergizer(boolean isEnergizer, String name){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -40,8 +42,9 @@ public class BlockEnergizer extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator(); return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
} }
@ -71,7 +74,7 @@ public class BlockEnergizer extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -26,6 +26,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockFeeder extends BlockContainerBase{ public class BlockFeeder extends BlockContainerBase{
public BlockFeeder(String name){ public BlockFeeder(String name){
@ -36,8 +38,9 @@ public class BlockFeeder extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityFeeder(); return new TileEntityFeeder();
} }
@ -59,7 +62,7 @@ public class BlockFeeder extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -26,6 +26,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockFermentingBarrel extends BlockContainerBase{ public class BlockFermentingBarrel extends BlockContainerBase{
public BlockFermentingBarrel(String name){ public BlockFermentingBarrel(String name){
@ -36,13 +38,14 @@ public class BlockFermentingBarrel extends BlockContainerBase{
this.setSoundType(SoundType.WOOD); this.setSoundType(SoundType.WOOD);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityFermentingBarrel(); return new TileEntityFermentingBarrel();
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }
@ -52,7 +55,7 @@ public class BlockFermentingBarrel extends BlockContainerBase{
if(!world.isRemote){ if(!world.isRemote){
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos); TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos);
if(press != null){ if(press != null){
if(!this.tryUseItemOnTank(player, heldItem, par6, press)){ if(this.checkFailUseItemOnTank(player, heldItem, par6, press)){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
} }
} }

View file

@ -25,6 +25,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockFireworkBox extends BlockContainerBase{ public class BlockFireworkBox extends BlockContainerBase{
public BlockFireworkBox(String name){ public BlockFireworkBox(String name){
@ -35,8 +37,9 @@ public class BlockFireworkBox extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityFireworkBox(); return new TileEntityFireworkBox();
} }
@ -51,7 +54,7 @@ public class BlockFireworkBox extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -23,6 +23,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockFishingNet extends BlockContainerBase{ public class BlockFishingNet extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1); private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
@ -35,13 +37,15 @@ public class BlockFishingNet extends BlockContainerBase{
this.setSoundType(SoundType.WOOD); this.setSoundType(SoundType.WOOD);
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB; return AABB;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityFishingNet(); return new TileEntityFishingNet();
} }

View file

@ -32,11 +32,13 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockFluidCollector extends BlockContainerBase{ public class BlockFluidCollector extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
private boolean isPlacer; private final boolean isPlacer;
public BlockFluidCollector(boolean isPlacer, String name){ public BlockFluidCollector(boolean isPlacer, String name){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -47,8 +49,9 @@ public class BlockFluidCollector extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector(); return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector();
} }
@ -60,7 +63,7 @@ public class BlockFluidCollector extends BlockContainerBase{
if(!world.isRemote){ if(!world.isRemote){
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(pos); TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(pos);
if(collector != null){ if(collector != null){
if(!this.tryUseItemOnTank(player, stack, par6, collector)){ if(this.checkFailUseItemOnTank(player, stack, par6, collector)){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
} }
} }
@ -88,7 +91,7 @@ public class BlockFluidCollector extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -35,6 +35,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class BlockFurnaceDouble extends BlockContainerBase{ public class BlockFurnaceDouble extends BlockContainerBase{
@ -50,8 +51,9 @@ public class BlockFurnaceDouble extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityFurnaceDouble(); return new TileEntityFurnaceDouble();
} }
@ -103,7 +105,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
} }
@Override @Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ public int getLightValue(@Nonnull IBlockState state, IBlockAccess world, @Nonnull BlockPos pos){
return PosUtil.getMetadata(state) > 3 ? 12 : 0; return PosUtil.getMetadata(state) > 3 ? 12 : 0;
} }
@ -138,7 +140,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -23,6 +23,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockFurnaceSolar extends BlockContainerBase{ public class BlockFurnaceSolar extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6*0.0625, 1); private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6*0.0625, 1);
@ -35,13 +37,15 @@ public class BlockFurnaceSolar extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB; return AABB;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityFurnaceSolar(); return new TileEntityFurnaceSolar();
} }

View file

@ -32,6 +32,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
public class BlockGiantChest extends BlockContainerBase{ public class BlockGiantChest extends BlockContainerBase{
@ -44,8 +45,9 @@ public class BlockGiantChest extends BlockContainerBase{
this.setSoundType(SoundType.WOOD); this.setSoundType(SoundType.WOOD);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityGiantChest(); return new TileEntityGiantChest();
} }
@ -83,8 +85,9 @@ public class BlockGiantChest extends BlockContainerBase{
super.onBlockPlacedBy(world, pos, state, entity, stack); super.onBlockPlacedBy(world, pos, state, entity, stack);
} }
@Nonnull
@Override @Override
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune){
ArrayList<ItemStack> drops = super.getDrops(world, pos, state, fortune); ArrayList<ItemStack> drops = super.getDrops(world, pos, state, fortune);
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
@ -118,7 +121,7 @@ public class BlockGiantChest extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityGiantChest){ if(tile instanceof TileEntityGiantChest){
if(!ItemUtil.contains(((TileEntityGiantChest)tile).slots, new ItemStack(InitItems.itemCrateKeeper), false)){ if(!ItemUtil.contains(((TileEntityGiantChest)tile).slots, new ItemStack(InitItems.itemCrateKeeper), false)){

View file

@ -27,6 +27,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockGreenhouseGlass extends BlockContainerBase{ public class BlockGreenhouseGlass extends BlockContainerBase{
public BlockGreenhouseGlass(String name){ public BlockGreenhouseGlass(String name){
@ -44,7 +46,7 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess worldIn, BlockPos pos, EnumFacing side){ public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos, EnumFacing side){
Block block = state.getBlock(); Block block = state.getBlock();
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(state, worldIn, pos, side); return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(state, worldIn, pos, side);
@ -55,6 +57,7 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
return false; return false;
} }
@Nonnull
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer(){ public BlockRenderLayer getBlockLayer(){
@ -66,8 +69,9 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityGreenhouseGlass(); return new TileEntityGreenhouseGlass();
} }
} }

View file

@ -34,6 +34,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class BlockGrinder extends BlockContainerBase{ public class BlockGrinder extends BlockContainerBase{
@ -51,8 +52,9 @@ public class BlockGrinder extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder(); return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder();
} }
@ -84,7 +86,7 @@ public class BlockGrinder extends BlockContainerBase{
} }
@Override @Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ public int getLightValue(@Nonnull IBlockState state, IBlockAccess world, @Nonnull BlockPos pos){
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0; return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
} }
@ -99,7 +101,7 @@ public class BlockGrinder extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -19,6 +19,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockHeatCollector extends BlockContainerBase{ public class BlockHeatCollector extends BlockContainerBase{
public BlockHeatCollector(String name){ public BlockHeatCollector(String name){
@ -29,8 +31,9 @@ public class BlockHeatCollector extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityHeatCollector(); return new TileEntityHeatCollector();
} }

View file

@ -25,6 +25,8 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import javax.annotation.Nonnull;
public class BlockImpureIron extends BlockGeneric{ public class BlockImpureIron extends BlockGeneric{
public BlockImpureIron(String name){ public BlockImpureIron(String name){
@ -44,6 +46,7 @@ public class BlockImpureIron extends BlockGeneric{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName(); return this.getUnlocalizedName();

View file

@ -34,11 +34,13 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockInputter extends BlockContainerBase{ public class BlockInputter extends BlockContainerBase{
public static final int NAME_FLAVOR_AMOUNTS = 15; public static final int NAME_FLAVOR_AMOUNTS = 15;
public boolean isAdvanced; public final boolean isAdvanced;
public BlockInputter(boolean isAdvanced, String name){ public BlockInputter(boolean isAdvanced, String name){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -50,8 +52,9 @@ public class BlockInputter extends BlockContainerBase{
this.isAdvanced = isAdvanced; this.isAdvanced = isAdvanced;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter(); return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter();
} }
@ -68,7 +71,7 @@ public class BlockInputter extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
if(!world.isRemote){ if(!world.isRemote){
TileEntity aTile = world.getTileEntity(pos); TileEntity aTile = world.getTileEntity(pos);
if(aTile instanceof TileEntityInventoryBase){ if(aTile instanceof TileEntityInventoryBase){
@ -100,6 +103,7 @@ public class BlockInputter extends BlockContainerBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName(); return this.getUnlocalizedName();
@ -110,8 +114,9 @@ public class BlockInputter extends BlockContainerBase{
return damage; return damage;
} }
@Nonnull
@Override @Override
public String getItemStackDisplayName(ItemStack stack){ public String getItemStackDisplayName(@Nonnull ItemStack stack){
long sysTime = System.currentTimeMillis(); long sysTime = System.currentTimeMillis();
if(this.lastSysTime+5000 < sysTime){ if(this.lastSysTime+5000 < sysTime){

View file

@ -29,6 +29,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockItemRepairer extends BlockContainerBase{ public class BlockItemRepairer extends BlockContainerBase{
public BlockItemRepairer(String name){ public BlockItemRepairer(String name){
@ -40,8 +42,9 @@ public class BlockItemRepairer extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityItemRepairer(); return new TileEntityItemRepairer();
} }
@ -58,7 +61,7 @@ public class BlockItemRepairer extends BlockContainerBase{
} }
@Override @Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ public int getLightValue(@Nonnull IBlockState state, IBlockAccess world, @Nonnull BlockPos pos){
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0; return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
} }
@ -68,7 +71,7 @@ public class BlockItemRepairer extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -19,6 +19,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockItemViewer extends BlockContainerBase{ public class BlockItemViewer extends BlockContainerBase{
public BlockItemViewer(String name){ public BlockItemViewer(String name){
@ -29,8 +31,9 @@ public class BlockItemViewer extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World worldIn, int meta){ public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta){
return new TileEntityItemViewer(); return new TileEntityItemViewer();
} }

View file

@ -39,8 +39,8 @@ public class BlockLampPowerer extends BlockBase{
} }
@Override @Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){ public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn){
this.updateLamp(world, pos); this.updateLamp(worldIn, pos);
} }
@Override @Override

View file

@ -31,10 +31,12 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockLaserRelay extends BlockContainerBase{ public class BlockLaserRelay extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
private Type type; private final Type type;
public BlockLaserRelay(String name, Type type){ public BlockLaserRelay(String name, Type type){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -56,6 +58,7 @@ public class BlockLaserRelay extends BlockContainerBase{
return false; return false;
} }
@Nonnull
@Override @Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){ public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base){
return this.getStateFromMeta(side.ordinal()); return this.getStateFromMeta(side.ordinal());
@ -85,8 +88,9 @@ public class BlockLaserRelay extends BlockContainerBase{
return false; return false;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int i){ public TileEntity createNewTileEntity(@Nonnull World world, int i){
switch(this.type){ switch(this.type){
case ITEM: case ITEM:
return new TileEntityLaserRelayItem(); return new TileEntityLaserRelayItem();

View file

@ -28,6 +28,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay{ public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay{
public BlockLavaFactoryController(String name){ public BlockLavaFactoryController(String name){
@ -38,8 +40,9 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityLavaFactoryController(); return new TileEntityLavaFactoryController();
} }

View file

@ -21,6 +21,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockLeafGenerator extends BlockContainerBase{ public class BlockLeafGenerator extends BlockContainerBase{
public BlockLeafGenerator(String name){ public BlockLeafGenerator(String name){
@ -31,8 +33,9 @@ public class BlockLeafGenerator extends BlockContainerBase{
this.setSoundType(SoundType.METAL); this.setSoundType(SoundType.METAL);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityLeafGenerator(); return new TileEntityLeafGenerator();
} }
@ -42,7 +45,7 @@ public class BlockLeafGenerator extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -34,6 +34,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockMiner extends BlockContainerBase implements IHudDisplay{ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
public BlockMiner(String name){ public BlockMiner(String name){
@ -65,13 +67,14 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int i){ public TileEntity createNewTileEntity(@Nonnull World world, int i){
return new TileEntityMiner(); return new TileEntityMiner();
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -27,12 +27,13 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class BlockMisc extends BlockBase{ public class BlockMisc extends BlockBase{
public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values(); public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
private static final PropertyInteger META = PropertyInteger.create("meta", 0, allMiscBlocks.length-1); private static final PropertyInteger META = PropertyInteger.create("meta", 0, ALL_MISC_BLOCKS.length-1);
public BlockMisc(String name){ public BlockMisc(String name){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -49,7 +50,7 @@ public class BlockMisc extends BlockBase{
@SuppressWarnings("all") @SuppressWarnings("all")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){ public void getSubBlocks(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allMiscBlocks.length; j++){ for(int j = 0; j < ALL_MISC_BLOCKS.length; j++){
list.add(new ItemStack(item, 1, j)); list.add(new ItemStack(item, 1, j));
} }
} }
@ -61,14 +62,14 @@ public class BlockMisc extends BlockBase{
@Override @Override
protected void registerRendering(){ protected void registerRendering(){
for(int i = 0; i < allMiscBlocks.length; i++){ for(int i = 0; i < ALL_MISC_BLOCKS.length; i++){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ModelResourceLocation(this.getRegistryName(), META.getName()+"="+i)); ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ModelResourceLocation(this.getRegistryName(), META.getName()+"="+i));
} }
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity; return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? EnumRarity.COMMON : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
} }
@Override @Override
@ -84,9 +85,10 @@ public class BlockMisc extends BlockBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= allMiscBlocks.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allMiscBlocks[stack.getItemDamage()].name; return stack.getItemDamage() >= ALL_MISC_BLOCKS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+ALL_MISC_BLOCKS[stack.getItemDamage()].name;
} }
} }
} }

View file

@ -33,6 +33,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class BlockOilGenerator extends BlockContainerBase{ public class BlockOilGenerator extends BlockContainerBase{
@ -48,8 +49,9 @@ public class BlockOilGenerator extends BlockContainerBase{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityOilGenerator(); return new TileEntityOilGenerator();
} }
@ -68,7 +70,7 @@ public class BlockOilGenerator extends BlockContainerBase{
if(!world.isRemote){ if(!world.isRemote){
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos); TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
if(generator != null){ if(generator != null){
if(!this.tryUseItemOnTank(player, stack, par6, generator)){ if(this.checkFailUseItemOnTank(player, stack, par6, generator)){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
} }
} }
@ -88,7 +90,7 @@ public class BlockOilGenerator extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -39,9 +39,11 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockPhantom extends BlockContainerBase implements IHudDisplay{ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
public Type type; public final Type type;
public BlockPhantom(Type type, String name){ public BlockPhantom(Type type, String name){
super(Material.ROCK, name); super(Material.ROCK, name);
@ -80,15 +82,16 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
if(this.type == Type.PLACER || this.type == Type.BREAKER){ if(this.type == Type.PLACER || this.type == Type.BREAKER){
this.dropInventory(world, pos); this.dropInventory(world, pos);
} }
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
switch(this.type){ switch(this.type){
case PLACER: case PLACER:
return new TileEntityPhantomPlacer(); return new TileEntityPhantomPlacer();

View file

@ -23,6 +23,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockPhantomBooster extends BlockContainerBase{ public class BlockPhantomBooster extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(2*0.0625, 0, 2*0.0625, 1-2*0.0625, 1, 1-2*0.0625); private static final AxisAlignedBB AABB = new AxisAlignedBB(2*0.0625, 0, 2*0.0625, 1-2*0.0625, 1, 1-2*0.0625);
@ -35,6 +37,7 @@ public class BlockPhantomBooster extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB; return AABB;
@ -55,8 +58,9 @@ public class BlockPhantomBooster extends BlockContainerBase{
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int i){ public TileEntity createNewTileEntity(@Nonnull World world, int i){
return new TileEntityPhantomBooster(); return new TileEntityPhantomBooster();
} }
} }

View file

@ -26,6 +26,8 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockRangedCollector extends BlockContainerBase{ public class BlockRangedCollector extends BlockContainerBase{
public BlockRangedCollector(String name){ public BlockRangedCollector(String name){
@ -36,8 +38,9 @@ public class BlockRangedCollector extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityRangedCollector(); return new TileEntityRangedCollector();
} }
@ -59,7 +62,7 @@ public class BlockRangedCollector extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
if(!world.isRemote){ if(!world.isRemote){
TileEntity aTile = world.getTileEntity(pos); TileEntity aTile = world.getTileEntity(pos);
if(aTile instanceof TileEntityRangedCollector){ if(aTile instanceof TileEntityRangedCollector){

View file

@ -31,14 +31,16 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockSlabs extends BlockBase{ public class BlockSlabs extends BlockBase{
private static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D); private static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D); private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1);
private Block fullBlock; private final Block fullBlock;
private int meta; private final int meta;
public BlockSlabs(String name, Block fullBlock){ public BlockSlabs(String name, Block fullBlock){
this(name, fullBlock, 0); this(name, fullBlock, 0);
@ -76,6 +78,7 @@ public class BlockSlabs extends BlockBase{
return false; return false;
} }
@Nonnull
@Override @Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){ public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
if(facing.ordinal() == 1){ if(facing.ordinal() == 1){
@ -87,6 +90,7 @@ public class BlockSlabs extends BlockBase{
return this.getStateFromMeta(meta); return this.getStateFromMeta(meta);
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return state.getValue(META) == 1 ? AABB_TOP_HALF : AABB_BOTTOM_HALF; return state.getValue(META) == 1 ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
@ -115,8 +119,9 @@ public class BlockSlabs extends BlockBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){ public EnumActionResult onItemUse(ItemStack stack, @Nonnull EntityPlayer playerIn, World worldIn, @Nonnull BlockPos pos, EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ){
if(stack.stackSize != 0 && playerIn.canPlayerEdit(pos.offset(facing), facing, stack)){ if(stack.stackSize != 0 && playerIn.canPlayerEdit(pos.offset(facing), facing, stack)){
IBlockState state = worldIn.getBlockState(pos); IBlockState state = worldIn.getBlockState(pos);
@ -145,7 +150,7 @@ public class BlockSlabs extends BlockBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack){ public boolean canPlaceBlockOnSide(World worldIn, @Nonnull BlockPos pos, @Nonnull EnumFacing side, EntityPlayer player, @Nonnull ItemStack stack){
IBlockState state = worldIn.getBlockState(pos); IBlockState state = worldIn.getBlockState(pos);
if(state.getBlock() == this.block){ if(state.getBlock() == this.block){
@ -177,6 +182,7 @@ public class BlockSlabs extends BlockBase{
return false; return false;
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName(); return this.getUnlocalizedName();

View file

@ -36,6 +36,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class BlockSmileyCloud extends BlockContainerBase{ public class BlockSmileyCloud extends BlockContainerBase{
@ -86,13 +87,14 @@ public class BlockSmileyCloud extends BlockContainerBase{
return true; return true;
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int meta){ public TileEntity createNewTileEntity(@Nonnull World world, int meta){
return new TileEntitySmileyCloud(); return new TileEntitySmileyCloud();
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
super.breakBlock(world, pos, state); super.breakBlock(world, pos, state);
} }

View file

@ -27,7 +27,6 @@ import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -35,6 +34,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class BlockTreasureChest extends BlockBase{ public class BlockTreasureChest extends BlockBase{
@ -98,13 +98,13 @@ public class BlockTreasureChest extends BlockBase{
} }
@Override @Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){ public boolean canSilkHarvest(World world, BlockPos pos, @Nonnull IBlockState state, EntityPlayer player){
return false; return false;
} }
private void dropItems(World world, BlockPos pos){ private void dropItems(World world, BlockPos pos){
for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){ for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot); TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.TREASURE_CHEST_LOOT);
ItemStack itemStack = theReturn.returnItem.copy(); ItemStack itemStack = theReturn.returnItem.copy();
itemStack.stackSize = MathHelper.getRandomIntegerInRange(Util.RANDOM, theReturn.minAmount, theReturn.maxAmount); itemStack.stackSize = MathHelper.getRandomIntegerInRange(Util.RANDOM, theReturn.minAmount, theReturn.maxAmount);
@ -112,9 +112,6 @@ public class BlockTreasureChest extends BlockBase{
float dY = Util.RANDOM.nextFloat()*0.8F+0.1F; float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F; float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, itemStack.copy()); EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, itemStack.copy());
if(itemStack.hasTagCompound()){
entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
}
float factor = 0.05F; float factor = 0.05F;
entityItem.motionX = Util.RANDOM.nextGaussian()*factor; entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F; entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;

View file

@ -30,6 +30,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class BlockWallAA extends BlockBase{ public class BlockWallAA extends BlockBase{
@ -37,7 +38,7 @@ public class BlockWallAA extends BlockBase{
protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[]{new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[]{new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[]{AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)}; protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[]{AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)};
private int meta; private final int meta;
public BlockWallAA(String name, Block base){ public BlockWallAA(String name, Block base){
this(name, base, 0); this(name, base, 0);
@ -77,8 +78,9 @@ public class BlockWallAA extends BlockBase{
return i; return i;
} }
@Nonnull
@Override @Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){ public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos){
boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag = this.canConnectTo(worldIn, pos.north());
boolean flag1 = this.canConnectTo(worldIn, pos.east()); boolean flag1 = this.canConnectTo(worldIn, pos.east());
boolean flag2 = this.canConnectTo(worldIn, pos.south()); boolean flag2 = this.canConnectTo(worldIn, pos.south());
@ -99,10 +101,11 @@ public class BlockWallAA extends BlockBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){ public boolean shouldSideBeRendered(IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side); return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
} }
@Nonnull
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
state = this.getActualState(state, source, pos); state = this.getActualState(state, source, pos);
@ -110,7 +113,7 @@ public class BlockWallAA extends BlockBase{
} }
@Override @Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos){ public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, @Nonnull World worldIn, @Nonnull BlockPos pos){
blockState = this.getActualState(blockState, worldIn, pos); blockState = this.getActualState(blockState, worldIn, pos);
return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)]; return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)];
} }
@ -128,7 +131,7 @@ public class BlockWallAA extends BlockBase{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){ public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List list){
list.add(new ItemStack(item, 1, 0)); list.add(new ItemStack(item, 1, 0));
} }
@ -138,6 +141,7 @@ public class BlockWallAA extends BlockBase{
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.GOURD)); return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.GOURD));
} }
@Nonnull
@Override @Override
public IBlockState getStateFromMeta(int meta){ public IBlockState getStateFromMeta(int meta){
return this.getDefaultState(); return this.getDefaultState();
@ -148,6 +152,7 @@ public class BlockWallAA extends BlockBase{
return 0; return 0;
} }
@Nonnull
@Override @Override
protected BlockStateContainer createBlockState(){ protected BlockStateContainer createBlockState(){
return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH); return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);

View file

@ -37,6 +37,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class BlockWildPlant extends BlockBushBase{ public class BlockWildPlant extends BlockBushBase{
@ -55,9 +56,10 @@ public class BlockWildPlant extends BlockBushBase{
return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.WATER : PosUtil.getBlock(offset, world).canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this); return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.WATER : PosUtil.getBlock(offset, world).canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this);
} }
@Nonnull
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){ public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player){
int metadata = PosUtil.getMetadata(pos, world); int metadata = PosUtil.getMetadata(pos, world);
return metadata >= allWildPlants.length ? null : new ItemStack(((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem); return metadata >= allWildPlants.length ? null : new ItemStack(((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem);
} }
@ -70,14 +72,15 @@ public class BlockWildPlant extends BlockBushBase{
} }
} }
@Nonnull
@Override @Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune){
int metadata = PosUtil.getMetadata(state); int metadata = PosUtil.getMetadata(state);
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune); return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
} }
@Override @Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){ public boolean canSilkHarvest(World world, BlockPos pos, @Nonnull IBlockState state, EntityPlayer player){
return false; return false;
} }
@ -116,6 +119,7 @@ public class BlockWildPlant extends BlockBushBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allWildPlants[stack.getItemDamage()].name; return stack.getItemDamage() >= allWildPlants.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allWildPlants[stack.getItemDamage()].name;

View file

@ -34,6 +34,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockXPSolidifier extends BlockContainerBase{ public class BlockXPSolidifier extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
@ -46,8 +48,9 @@ public class BlockXPSolidifier extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Nonnull
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(@Nonnull World world, int par2){
return new TileEntityXPSolidifier(); return new TileEntityXPSolidifier();
} }
@ -94,7 +97,7 @@ public class BlockXPSolidifier extends BlockContainerBase{
} }
@Override @Override
public void breakBlock(World world, BlockPos pos, IBlockState state){ public void breakBlock(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state){
this.dropInventory(world, pos); this.dropInventory(world, pos);
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityXPSolidifier){ if(tile instanceof TileEntityXPSolidifier){

View file

@ -17,8 +17,6 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.util.CompatUtil; import de.ellpeck.actuallyadditions.mod.util.CompatUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
public class InitBlocks{ public class InitBlocks{

View file

@ -21,9 +21,11 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class BlockBase extends Block{ public class BlockBase extends Block{
private String name; private final String name;
public BlockBase(Material material, String name){ public BlockBase(Material material, String name){
super(material); super(material);
@ -58,6 +60,7 @@ public class BlockBase extends Block{
return EnumRarity.COMMON; return EnumRarity.COMMON;
} }
@Nonnull
@Override @Override
public IBlockState getStateFromMeta(int meta){ public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta); return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
@ -68,6 +71,7 @@ public class BlockBase extends Block{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
} }
@Nonnull
@Override @Override
protected BlockStateContainer createBlockState(){ protected BlockStateContainer createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty()); return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());

View file

@ -21,9 +21,11 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class BlockBushBase extends BlockBush{ public class BlockBushBase extends BlockBush{
private String name; private final String name;
public BlockBushBase(String name){ public BlockBushBase(String name){
this.name = name; this.name = name;
@ -58,6 +60,7 @@ public class BlockBushBase extends BlockBush{
return EnumRarity.COMMON; return EnumRarity.COMMON;
} }
@Nonnull
@Override @Override
public IBlockState getStateFromMeta(int meta){ public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta); return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
@ -68,6 +71,7 @@ public class BlockBushBase extends BlockBush{
return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty());
} }
@Nonnull
@Override @Override
protected BlockStateContainer createBlockState(){ protected BlockStateContainer createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty()); return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());

View file

@ -40,12 +40,13 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
public abstract class BlockContainerBase extends BlockContainer{ public abstract class BlockContainerBase extends BlockContainer{
private String name; private final String name;
public BlockContainerBase(Material material, String name){ public BlockContainerBase(Material material, String name){
super(material); super(material);
@ -101,9 +102,6 @@ public abstract class BlockContainerBase extends BlockContainer{
float dY = Util.RANDOM.nextFloat()*0.8F+0.1F; float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F; float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, stack.copy()); EntityItem entityItem = new EntityItem(world, pos.getX()+dX, pos.getY()+dY, pos.getZ()+dZ, stack.copy());
if(stack.hasTagCompound()){
entityItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
}
float factor = 0.05F; float factor = 0.05F;
entityItem.motionX = Util.RANDOM.nextGaussian()*factor; entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F; entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;
@ -131,6 +129,7 @@ public abstract class BlockContainerBase extends BlockContainer{
return false; return false;
} }
@Nonnull
@Override @Override
public IBlockState getStateFromMeta(int meta){ public IBlockState getStateFromMeta(int meta){
return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta); return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta);
@ -152,8 +151,8 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
@Override @Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){ public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn){
this.updateRedstoneState(world, pos); this.updateRedstoneState(worldIn, pos);
} }
public void updateRedstoneState(World world, BlockPos pos){ public void updateRedstoneState(World world, BlockPos pos){
@ -175,8 +174,8 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
} }
protected boolean tryUseItemOnTank(EntityPlayer player, ItemStack heldItem, EnumFacing sideHit, IFluidHandler tank){ protected boolean checkFailUseItemOnTank(EntityPlayer player, ItemStack heldItem, EnumFacing sideHit, IFluidHandler tank){
return heldItem != null && FluidUtil.interactWithTank(heldItem, player, tank, sideHit); return heldItem == null || !FluidUtil.interactWithTank(heldItem, player, tank, sideHit);
} }
@Override @Override
@ -238,13 +237,15 @@ public abstract class BlockContainerBase extends BlockContainer{
return 0; return 0;
} }
@Nonnull
@Override @Override
protected BlockStateContainer createBlockState(){ protected BlockStateContainer createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty()); return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
} }
@Nonnull
@Override @Override
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
@ -290,6 +291,7 @@ public abstract class BlockContainerBase extends BlockContainer{
return null; return null;
} }
@Nonnull
@Override @Override
public EnumBlockRenderType getRenderType(IBlockState state){ public EnumBlockRenderType getRenderType(IBlockState state){
return EnumBlockRenderType.MODEL; return EnumBlockRenderType.MODEL;

View file

@ -24,7 +24,7 @@ import net.minecraftforge.fluids.Fluid;
public class BlockFluidFlowing extends BlockFluidClassic{ public class BlockFluidFlowing extends BlockFluidClassic{
private String name; private final String name;
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){ public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){
super(fluid, material); super(fluid, material);

View file

@ -27,6 +27,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -35,9 +36,9 @@ public class BlockPlant extends BlockCrops{
public Item seedItem; public Item seedItem;
public Item returnItem; public Item returnItem;
public int returnMeta; public int returnMeta;
private String name; private final String name;
private int minDropAmount; private final int minDropAmount;
private int addDropAmount; private final int addDropAmount;
public BlockPlant(String name, int minDropAmount, int addDropAmount){ public BlockPlant(String name, int minDropAmount, int addDropAmount){
this.name = name; this.name = name;
@ -72,6 +73,7 @@ public class BlockPlant extends BlockCrops{
return EnumRarity.RARE; return EnumRarity.RARE;
} }
@Nonnull
@Override @Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){ public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos){
return EnumPlantType.Crop; return EnumPlantType.Crop;
@ -110,16 +112,18 @@ public class BlockPlant extends BlockCrops{
return false; return false;
} }
@Nonnull
@Override @Override
public Item getSeed(){ public Item getSeed(){
return this.seedItem; return this.seedItem;
} }
@Override @Override
public int quantityDropped(IBlockState state, int fortune, Random random){ public int quantityDropped(IBlockState state, int fortune, @Nonnull Random random){
return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount)+this.minDropAmount : super.quantityDropped(state, fortune, random); return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount)+this.minDropAmount : super.quantityDropped(state, fortune, random);
} }
@Nonnull
@Override @Override
public Item getCrop(){ public Item getCrop(){
return this.returnItem; return this.returnItem;
@ -127,7 +131,7 @@ public class BlockPlant extends BlockCrops{
@Override @Override
public Item getItemDropped(IBlockState state, Random rand, int par3){ public Item getItemDropped(@Nonnull IBlockState state, Random rand, int par3){
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed(); return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
} }

View file

@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack;
public class BlockStair extends BlockStairs{ public class BlockStair extends BlockStairs{
private String name; private final String name;
public BlockStair(Block block, String name){ public BlockStair(Block block, String name){
this(block, name, 0); this(block, name, 0);

View file

@ -16,6 +16,8 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ItemBlockBase extends ItemBlock{ public class ItemBlockBase extends ItemBlock{
public ItemBlockBase(Block block){ public ItemBlockBase(Block block){
@ -24,6 +26,7 @@ public class ItemBlockBase extends ItemBlock{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName(); return this.getUnlocalizedName();
@ -34,6 +37,7 @@ public class ItemBlockBase extends ItemBlock{
return damage; return damage;
} }
@Nonnull
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
if(this.block instanceof BlockBase){ if(this.block instanceof BlockBase){

View file

@ -31,7 +31,7 @@ public enum TheColoredLampColors{
RED("Red"), RED("Red"),
BLACK("Black"); BLACK("Black");
public String name; public final String name;
TheColoredLampColors(String name){ TheColoredLampColors(String name){
this.name = name; this.name = name;

View file

@ -19,10 +19,12 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import javax.annotation.Nonnull;
public class RenderCompost extends TileEntitySpecialRenderer{ public class RenderCompost extends TileEntitySpecialRenderer{
@Override @Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage){ public void renderTileEntityAt(@Nonnull TileEntity te, double x, double y, double z, float partialTicks, int destroyStage){
if(te instanceof TileEntityCompost){ if(te instanceof TileEntityCompost){
TileEntityCompost compost = (TileEntityCompost)te; TileEntityCompost compost = (TileEntityCompost)te;
if(compost.getStackInSlot(0) != null){ if(compost.getStackInSlot(0) != null){

View file

@ -20,10 +20,12 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import javax.annotation.Nonnull;
public class RenderReconstructorLens extends TileEntitySpecialRenderer{ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
@Override @Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){ public void renderTileEntityAt(@Nonnull TileEntity tile, double x, double y, double z, float par5, int par6){
if(!(tile instanceof TileEntityAtomicReconstructor)){ if(!(tile instanceof TileEntityAtomicReconstructor)){
return; return;
} }

View file

@ -21,12 +21,13 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import javax.annotation.Nonnull;
import java.util.Locale; import java.util.Locale;
public class RenderSmileyCloud extends TileEntitySpecialRenderer{ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
@Override @Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){ public void renderTileEntityAt(@Nonnull TileEntity tile, double x, double y, double z, float par5, int partial){
if(tile instanceof TileEntitySmileyCloud){ if(tile instanceof TileEntitySmileyCloud){
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile; TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;

View file

@ -270,10 +270,10 @@ public class BookletUtils{
IndexButton button = (IndexButton)booklet.chapterButtons[i]; IndexButton button = (IndexButton)booklet.chapterButtons[i];
if(entry == null){ if(entry == null){
if(i >= GuiBooklet.INDEX_BUTTONS_OFFSET){ if(i >= GuiBooklet.INDEX_BUTTONS_OFFSET){
boolean entryExists = ActuallyAdditionsAPI.bookletEntries.size() > i-GuiBooklet.INDEX_BUTTONS_OFFSET; boolean entryExists = ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > i-GuiBooklet.INDEX_BUTTONS_OFFSET;
button.visible = entryExists; button.visible = entryExists;
if(entryExists){ if(entryExists){
button.displayString = ""+ActuallyAdditionsAPI.bookletEntries.get(i-GuiBooklet.INDEX_BUTTONS_OFFSET).getLocalizedNameWithFormatting(); button.displayString = ""+ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(i-GuiBooklet.INDEX_BUTTONS_OFFSET).getLocalizedNameWithFormatting();
button.chap = null; button.chap = null;
} }
} }
@ -308,8 +308,8 @@ public class BookletUtils{
} }
} }
else{ else{
if(place-GuiBooklet.INDEX_BUTTONS_OFFSET < ActuallyAdditionsAPI.bookletEntries.size()){ if(place-GuiBooklet.INDEX_BUTTONS_OFFSET < ActuallyAdditionsAPI.BOOKLET_ENTRIES.size()){
openIndexEntry(booklet, ActuallyAdditionsAPI.bookletEntries.get(place-GuiBooklet.INDEX_BUTTONS_OFFSET), 1, true); openIndexEntry(booklet, ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(place-GuiBooklet.INDEX_BUTTONS_OFFSET), 1, true);
} }
} }
} }
@ -431,7 +431,7 @@ public class BookletUtils{
public static ArrayList<BookletPage> getPagesForStack(ItemStack stack){ public static ArrayList<BookletPage> getPagesForStack(ItemStack stack){
ArrayList<BookletPage> possiblePages = new ArrayList<BookletPage>(); ArrayList<BookletPage> possiblePages = new ArrayList<BookletPage>();
for(BookletPage page : ActuallyAdditionsAPI.bookletPagesWithItemStackData){ for(BookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_DATA){
if(ItemUtil.contains(page.getItemStacksForPage(), stack, page.arePageStacksWildcard)){ if(ItemUtil.contains(page.getItemStacksForPage(), stack, page.arePageStacksWildcard)){
possiblePages.add(page); possiblePages.add(page);
} }

View file

@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.achievement.InitAchievements;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.achievement.GuiAchievements; import net.minecraft.client.gui.achievement.GuiAchievements;
import net.minecraft.stats.StatFileWriter; import net.minecraft.stats.StatisticsManager;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
/** /**
@ -22,8 +22,8 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
*/ */
public class GuiAAAchievements extends GuiAchievements{ public class GuiAAAchievements extends GuiAchievements{
public GuiAAAchievements(GuiScreen screen, StatFileWriter writer){ public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){
super(screen, writer); super(screen, statistics);
try{ try{
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, InitAchievements.pageNumber, 20); ReflectionHelper.setPrivateValue(GuiAchievements.class, this, InitAchievements.pageNumber, 20);
} }

View file

@ -45,6 +45,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import javax.annotation.Nonnull;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -61,11 +62,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public static final int CHAPTER_BUTTONS_AMOUNT = 13; public static final int CHAPTER_BUTTONS_AMOUNT = 13;
public static final int INDEX_BUTTONS_OFFSET = 3; public static final int INDEX_BUTTONS_OFFSET = 3;
private static final int[] AND_HIS_NAME_IS = new int[]{Keyboard.KEY_C, Keyboard.KEY_E, Keyboard.KEY_N, Keyboard.KEY_A}; private static final int[] AND_HIS_NAME_IS = new int[]{Keyboard.KEY_C, Keyboard.KEY_E, Keyboard.KEY_N, Keyboard.KEY_A};
public int xSize; public final int xSize;
public int ySize; public final int ySize;
public int guiLeft; public int guiLeft;
public int guiTop; public int guiTop;
public IEntrySet currentEntrySet = new EntrySet(null); public final IEntrySet currentEntrySet = new EntrySet(null);
public int indexPageAmount; public int indexPageAmount;
public GuiButton buttonForward; public GuiButton buttonForward;
public GuiButton buttonBackward; public GuiButton buttonBackward;
@ -77,14 +78,14 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public GuiButton buttonConfig; public GuiButton buttonConfig;
public GuiButton buttonWebsite; public GuiButton buttonWebsite;
public GuiButton buttonPatreon; public GuiButton buttonPatreon;
public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT]; public final GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
public GuiButton[] bookmarkButtons = new GuiButton[8]; public final GuiButton[] bookmarkButtons = new GuiButton[8];
public GuiTextField searchField; public GuiTextField searchField;
public GuiScreen parentScreen; public final GuiScreen parentScreen;
private int ticksElapsed; private int ticksElapsed;
private boolean mousePressed; private boolean mousePressed;
private boolean tryOpenMainPage; private final boolean tryOpenMainPage;
private boolean saveOnClose; private final boolean saveOnClose;
private int hisNameIsAt; private int hisNameIsAt;
public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){ public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){
@ -197,7 +198,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
} }
@Override @Override
public void drawHoveringText(List list, int x, int y){ public void drawHoveringText(@Nonnull List list, int x, int y){
super.drawHoveringText(list, x, y); super.drawHoveringText(list, x, y);
} }
@ -440,7 +441,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
list.add(from.getClickToSeeRecipeString()); list.add(from.getClickToSeeRecipeString());
if(mousePressed){ if(mousePressed){
BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.BOOKLET_ENTRIES.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
BookletUtils.openChapter(this, page.getChapter(), page); BookletUtils.openChapter(this, page.getChapter(), page);
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
} }

View file

@ -31,7 +31,6 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;

View file

@ -22,13 +22,14 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
public class BookmarkButton extends GuiButton{ public class BookmarkButton extends GuiButton{
public EntrySet assignedEntry = new EntrySet(null); public EntrySet assignedEntry = new EntrySet(null);
private GuiBooklet booklet; private final GuiBooklet booklet;
public BookmarkButton(int id, int x, int y, GuiBooklet booklet){ public BookmarkButton(int id, int x, int y, GuiBooklet booklet){
super(id, x, y, 16, 16, ""); super(id, x, y, 16, 16, "");
@ -53,7 +54,7 @@ public class BookmarkButton extends GuiButton{
} }
@Override @Override
public void drawButton(Minecraft minecraft, int x, int y){ public void drawButton(@Nonnull Minecraft minecraft, int x, int y){
if(this.visible){ if(this.visible){
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc); minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -21,10 +21,12 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import javax.annotation.Nonnull;
public class IndexButton extends GuiButton{ public class IndexButton extends GuiButton{
public IBookletChapter chap; public IBookletChapter chap;
private GuiBooklet gui; private final GuiBooklet gui;
public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){ public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){
super(id, x, y, width, height, text); super(id, x, y, width, height, text);
@ -32,7 +34,7 @@ public class IndexButton extends GuiButton{
} }
@Override @Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){ public void drawButton(@Nonnull Minecraft minecraft, int mouseX, int mouseY){
if(this.visible){ if(this.visible){
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition+this.width && mouseY < this.yPosition+this.height; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition+this.width && mouseY < this.yPosition+this.height;

View file

@ -15,6 +15,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -23,7 +24,7 @@ public class TexturedButton extends GuiButton{
public int texturePosX; public int texturePosX;
public int texturePosY; public int texturePosY;
public List textList = new ArrayList(); public final List textList = new ArrayList();
public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height){ public TexturedButton(int id, int x, int y, int texturePosX, int texturePosY, int width, int height){
this(id, x, y, texturePosX, texturePosY, width, height, new ArrayList()); this(id, x, y, texturePosX, texturePosY, width, height, new ArrayList());
@ -43,7 +44,7 @@ public class TexturedButton extends GuiButton{
} }
@Override @Override
public void drawButton(Minecraft minecraft, int x, int y){ public void drawButton(@Nonnull Minecraft minecraft, int x, int y){
if(this.visible){ if(this.visible){
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc); minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -75,14 +75,12 @@ public class BookletChapter implements IBookletChapter{
return this.displayStack; return this.displayStack;
} }
public BookletChapter setIncomplete(){ public void setIncomplete(){
this.isIncomplete = true; this.isIncomplete = true;
return this;
} }
public BookletChapter setImportant(){ public void setImportant(){
this.color = TextFormatting.DARK_GREEN; this.color = TextFormatting.DARK_GREEN;
return this;
} }
public BookletChapter setSpecial(){ public BookletChapter setSpecial(){

View file

@ -33,7 +33,7 @@ public class BookletChapterCoffee extends BookletChapter{
ArrayList<BookletPage> allPages = new ArrayList<BookletPage>(); ArrayList<BookletPage> allPages = new ArrayList<BookletPage>();
allPages.addAll(Arrays.asList(pages)); allPages.addAll(Arrays.asList(pages));
for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.coffeeMachineIngredients){ for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
BookletPageAA page = new PageCoffeeRecipe(allPages.size()+1, ingredient); BookletPageAA page = new PageCoffeeRecipe(allPages.size()+1, ingredient);
if(!(ingredient instanceof ItemCoffee.MilkIngredient)){ if(!(ingredient instanceof ItemCoffee.MilkIngredient)){
page.setNoText(); page.setNoText();

View file

@ -39,7 +39,7 @@ public class EntrySet implements IEntrySet{
int chapter = compound.getInteger("Chapter"); int chapter = compound.getInteger("Chapter");
int page = compound.getInteger("Page"); int page = compound.getInteger("Page");
IBookletEntry currentEntry = entry == -1 ? null : ActuallyAdditionsAPI.bookletEntries.get(entry); IBookletEntry currentEntry = entry == -1 ? null : ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(entry);
IBookletChapter currentChapter = chapter == -1 || entry == -1 || currentEntry.getChapters().size() <= chapter ? null : currentEntry.getChapters().get(chapter); IBookletChapter currentChapter = chapter == -1 || entry == -1 || currentEntry.getChapters().size() <= chapter ? null : currentEntry.getChapters().get(chapter);
BookletPage currentPage = chapter == -1 || currentChapter == null || currentChapter.getPages().length <= page-1 ? null : currentChapter.getPages()[page-1]; BookletPage currentPage = chapter == -1 || currentChapter == null || currentChapter.getPages().length <= page-1 ? null : currentChapter.getPages()[page-1];
int pageInIndex = compound.getInteger("PageInIndex"); int pageInIndex = compound.getInteger("PageInIndex");
@ -66,7 +66,7 @@ public class EntrySet implements IEntrySet{
@Override @Override
public NBTTagCompound writeToNBT(){ public NBTTagCompound writeToNBT(){
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("Entry", this.entry == null ? -1 : ActuallyAdditionsAPI.bookletEntries.indexOf(this.entry)); compound.setInteger("Entry", this.entry == null ? -1 : ActuallyAdditionsAPI.BOOKLET_ENTRIES.indexOf(this.entry));
compound.setInteger("Chapter", this.entry == null || this.chapter == null ? -1 : this.entry.getChapters().indexOf(this.chapter)); compound.setInteger("Chapter", this.entry == null || this.chapter == null ? -1 : this.entry.getChapters().indexOf(this.chapter));
compound.setInteger("Page", this.page == null ? -1 : this.page.getID()); compound.setInteger("Page", this.page == null ? -1 : this.page.getID());
compound.setInteger("PageInIndex", this.pageInIndex); compound.setInteger("PageInIndex", this.pageInIndex);

View file

@ -24,8 +24,8 @@ import java.util.Map;
public class BookletPageAA extends BookletPage{ public class BookletPageAA extends BookletPage{
protected int localizationKey; protected final int localizationKey;
private HashMap<String, String> textReplacements = new HashMap<String, String>(); private final HashMap<String, String> textReplacements = new HashMap<String, String>();
private boolean hasNoText; private boolean hasNoText;
public BookletPageAA(int localizationKey){ public BookletPageAA(int localizationKey){
@ -98,7 +98,7 @@ public class BookletPageAA extends BookletPage{
} }
public void addToPagesWithItemStackData(){ public void addToPagesWithItemStackData(){
if(!ActuallyAdditionsAPI.bookletPagesWithItemStackData.contains(this)){ if(!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_DATA.contains(this)){
ItemStack[] stacks = this.getItemStacksForPage(); ItemStack[] stacks = this.getItemStacksForPage();
if(stacks != null && stacks.length > 0){ if(stacks != null && stacks.length > 0){
//Ensure that there is at least one ItemStack //Ensure that there is at least one ItemStack

View file

@ -27,7 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class PageCoffeeRecipe extends BookletPageAA{ public class PageCoffeeRecipe extends BookletPageAA{
public CoffeeIngredient ingredient; public final CoffeeIngredient ingredient;
public PageCoffeeRecipe(int id, CoffeeIngredient ingredient){ public PageCoffeeRecipe(int id, CoffeeIngredient ingredient){
super(id); super(id);

View file

@ -29,7 +29,7 @@ import java.util.List;
public class PageCrusherRecipe extends BookletPageAA{ public class PageCrusherRecipe extends BookletPageAA{
public CrusherRecipe recipe; public final CrusherRecipe recipe;
private int recipePos; private int recipePos;

View file

@ -20,8 +20,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class PagePicture extends PageTextOnly{ public class PagePicture extends PageTextOnly{
private ResourceLocation resLoc; private final ResourceLocation resLoc;
private int textStartY; private final int textStartY;
public PagePicture(int id, String resLocName, int textStartY){ public PagePicture(int id, String resLocName, int textStartY){
super(id); super(id);

View file

@ -30,7 +30,7 @@ import java.util.List;
public class PageReconstructor extends BookletPageAA{ public class PageReconstructor extends BookletPageAA{
private LensConversionRecipe[] recipes; private final LensConversionRecipe[] recipes;
private int recipePos; private int recipePos;
public PageReconstructor(int id, ArrayList<LensConversionRecipe> recipes){ public PageReconstructor(int id, ArrayList<LensConversionRecipe> recipes){

View file

@ -17,9 +17,9 @@ import net.minecraftforge.common.config.Configuration;
public class ConfigValues{ public class ConfigValues{
public static ConfigCrafting[] craftingConfig = ConfigCrafting.values(); public static final ConfigCrafting[] CRAFTING_CONFIG = ConfigCrafting.values();
public static ConfigIntValues[] intConfig = ConfigIntValues.values(); public static final ConfigIntValues[] INT_CONFIG = ConfigIntValues.values();
public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values(); public static final ConfigBoolValues[] BOOL_CONFIG = ConfigBoolValues.values();
public static String[] crusherRecipeExceptions; public static String[] crusherRecipeExceptions;
public static String[] mashedFoodCraftingExceptions; public static String[] mashedFoodCraftingExceptions;
@ -45,13 +45,13 @@ public class ConfigValues{
public static void defineConfigValues(Configuration config){ public static void defineConfigValues(Configuration config){
for(ConfigCrafting currConf : craftingConfig){ for(ConfigCrafting currConf : CRAFTING_CONFIG){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, "If the Recipe for the "+currConf.name+" is Enabled").getBoolean(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, "If the Recipe for the "+currConf.name+" is Enabled").getBoolean();
} }
for(ConfigIntValues currConf : intConfig){ for(ConfigIntValues currConf : INT_CONFIG){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
} }
for(ConfigBoolValues currConf : boolConfig){ for(ConfigBoolValues currConf : BOOL_CONFIG){
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean(); currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getBoolean();
} }

View file

@ -71,7 +71,7 @@ public class BlockCrafting{
public static IRecipe recipeCrate; public static IRecipe recipeCrate;
public static IRecipe recipeFermentingBarrel; public static IRecipe recipeFermentingBarrel;
public static IRecipe recipeCanolaPress; public static IRecipe recipeCanolaPress;
public static IRecipe[] recipesLamps = new IRecipe[BlockColoredLamp.allLampTypes.length]; public static final IRecipe[] recipesLamps = new IRecipe[BlockColoredLamp.allLampTypes.length];
public static IRecipe recipePowerer; public static IRecipe recipePowerer;
public static IRecipe recipeLeafGen; public static IRecipe recipeLeafGen;
public static IRecipe recipeDirectionalBreaker; public static IRecipe recipeDirectionalBreaker;

View file

@ -32,7 +32,7 @@ public class CrusherCrafting{
public static CrusherRecipe recipeIronHorseArmor; public static CrusherRecipe recipeIronHorseArmor;
public static CrusherRecipe recipeGoldHorseArmor; public static CrusherRecipe recipeGoldHorseArmor;
public static CrusherRecipe recipeDiamondHorseArmor; public static CrusherRecipe recipeDiamondHorseArmor;
public static ArrayList<CrusherRecipe> miscRecipes = new ArrayList<CrusherRecipe>(); public static final ArrayList<CrusherRecipe> miscRecipes = new ArrayList<CrusherRecipe>();
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Crusher Recipes..."); ModUtil.LOGGER.info("Initializing Crusher Recipes...");

View file

@ -44,9 +44,9 @@ public class ItemCrafting{
public static IRecipe recipeBook; public static IRecipe recipeBook;
public static IRecipe recipeTinyCoal; public static IRecipe recipeTinyCoal;
public static IRecipe recipeTinyChar; public static IRecipe recipeTinyChar;
public static ArrayList<IRecipe> recipesMashedFood = new ArrayList<IRecipe>(); public static final ArrayList<IRecipe> recipesMashedFood = new ArrayList<IRecipe>();
public static IRecipe recipeDrill; public static IRecipe recipeDrill;
public static ArrayList<IRecipe> recipesDrillColoring = new ArrayList<IRecipe>(); public static final ArrayList<IRecipe> recipesDrillColoring = new ArrayList<IRecipe>();
public static IRecipe recipeDrillSpeedI; public static IRecipe recipeDrillSpeedI;
public static IRecipe recipeDrillSpeedII; public static IRecipe recipeDrillSpeedII;
public static IRecipe recipeDrillSpeedIII; public static IRecipe recipeDrillSpeedIII;
@ -75,7 +75,7 @@ public class ItemCrafting{
public static IRecipe recipeRiceDough; public static IRecipe recipeRiceDough;
public static IRecipe recipeLeafBlower; public static IRecipe recipeLeafBlower;
public static IRecipe recipeLeafBlowerAdvanced; public static IRecipe recipeLeafBlowerAdvanced;
public static ArrayList<IRecipe> recipesPotionRings = new ArrayList<IRecipe>(); public static final ArrayList<IRecipe> recipesPotionRings = new ArrayList<IRecipe>();
public static IRecipe recipeChestToCrateUpgrade; public static IRecipe recipeChestToCrateUpgrade;
public static IRecipe recipeLaserWrench; public static IRecipe recipeLaserWrench;
public static IRecipe recipeDrillCore; public static IRecipe recipeDrillCore;

View file

@ -26,8 +26,8 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
public class MiscCrafting{ public class MiscCrafting{
public static IRecipe[] recipesCrystals = new IRecipe[TheCrystals.values().length]; public static final IRecipe[] recipesCrystals = new IRecipe[TheCrystals.values().length];
public static IRecipe[] recipesCrystalBlocks = new IRecipe[TheCrystals.values().length]; public static final IRecipe[] recipesCrystalBlocks = new IRecipe[TheCrystals.values().length];
public static void init(){ public static void init(){

View file

@ -28,7 +28,7 @@ import java.util.ArrayList;
public class ToolCrafting{ public class ToolCrafting{
public static ArrayList<IRecipe> recipesPaxels = new ArrayList<IRecipe>(); public static final ArrayList<IRecipe> recipesPaxels = new ArrayList<IRecipe>();
public static void init(){ public static void init(){

View file

@ -25,22 +25,25 @@ import net.minecraftforge.fluids.UniversalBucket;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class CreativeTab extends CreativeTabs{ public class CreativeTab extends CreativeTabs{
public static CreativeTab instance = new CreativeTab(); public static final CreativeTab instance = new CreativeTab();
private List<ItemStack> list; private List<ItemStack> list;
public CreativeTab(){ public CreativeTab(){
super(ModUtil.MOD_ID); super(ModUtil.MOD_ID);
} }
@Nonnull
@Override @Override
public ItemStack getIconItemStack(){ public ItemStack getIconItemStack(){
return new ItemStack(this.getTabIconItem()); return new ItemStack(this.getTabIconItem());
} }
@Nonnull
@Override @Override
public Item getTabIconItem(){ public Item getTabIconItem(){
return InitItems.itemBooklet; return InitItems.itemBooklet;
@ -48,7 +51,7 @@ public class CreativeTab extends CreativeTabs{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> list){ public void displayAllRelevantItems(@Nonnull List<ItemStack> list){
this.list = list; this.list = list;
this.add(InitItems.itemBooklet); this.add(InitItems.itemBooklet);

View file

@ -22,7 +22,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.BiomeGenOcean; import net.minecraft.world.biome.BiomeOcean;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -48,9 +48,9 @@ public class WorldDecorationEvent{
BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8); BlockPos randomPos = new BlockPos(event.getPos().getX()+event.getRand().nextInt(16)+8, 0, event.getPos().getZ()+event.getRand().nextInt(16)+8);
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos); randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
if(event.getWorld().getBiomeGenForCoords(randomPos) instanceof BiomeGenOcean){ if(event.getWorld().getBiomeGenForCoords(randomPos) instanceof BiomeOcean){
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){ if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
if(PosUtil.getBlock(randomPos, event.getWorld()).getMaterial(event.getWorld().getBlockState(randomPos)) == Material.WATER){ if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.getWorld()).isSolid()){ if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.getWorld()).isSolid()){
PosUtil.setBlock(randomPos, event.getWorld(), InitBlocks.blockTreasureChest, event.getRand().nextInt(4), 2); PosUtil.setBlock(randomPos, event.getWorld(), InitBlocks.blockTreasureChest, event.getRand().nextInt(4), 2);
} }

View file

@ -25,7 +25,7 @@ import java.util.Random;
public class JamVillagerTradeHandler{ public class JamVillagerTradeHandler{
private ArrayList<Trade> trades = new ArrayList<Trade>(); private final ArrayList<Trade> trades = new ArrayList<Trade>();
public JamVillagerTradeHandler(){ public JamVillagerTradeHandler(){
this.addWants("ingotGold", 5, 7); this.addWants("ingotGold", 5, 7);

View file

@ -21,6 +21,7 @@ import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -48,7 +49,7 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
} }
@Override @Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ public boolean addComponentParts(@Nonnull World world, @Nonnull Random rand, @Nonnull StructureBoundingBox sbb){
if(this.averageGroundLevel < 0){ if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0){ if(this.averageGroundLevel < 0){

View file

@ -21,6 +21,7 @@ import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -48,7 +49,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
} }
@Override @Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ public boolean addComponentParts(@Nonnull World world, @Nonnull Random rand, @Nonnull StructureBoundingBox sbb){
if(this.averageGroundLevel < 0){ if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0){ if(this.averageGroundLevel < 0){
@ -186,7 +187,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
//Loot Chest //Loot Chest
this.setBlockState(world, Blocks.CHEST.getDefaultState(), 8, 1, 6, sbb); this.setBlockState(world, Blocks.CHEST.getDefaultState(), 8, 1, 6, sbb);
TileEntity chest = world.getTileEntity(new BlockPos(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6))); //TileEntity chest = world.getTileEntity(new BlockPos(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6)));
//TODO Chest content //TODO Chest content
/*if(chest != null && chest instanceof TileEntityChest){ /*if(chest != null && chest instanceof TileEntityChest){
WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(InitVillager.JAM_HOUSE_CHEST_NAME, rand), (TileEntityChest)chest, ChestGenHooks.getCount(InitVillager.JAM_HOUSE_CHEST_NAME, rand)); WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(InitVillager.JAM_HOUSE_CHEST_NAME, rand), (TileEntityChest)chest, ChestGenHooks.getCount(InitVillager.JAM_HOUSE_CHEST_NAME, rand));

View file

@ -27,6 +27,8 @@ import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import javax.annotation.Nonnull;
public class CaveWorldType extends WorldType{ public class CaveWorldType extends WorldType{
public CaveWorldType(){ public CaveWorldType(){
@ -40,13 +42,14 @@ public class CaveWorldType extends WorldType{
return ConfigValues.caveWorld && world.getWorldType() instanceof CaveWorldType; return ConfigValues.caveWorld && world.getWorldType() instanceof CaveWorldType;
} }
@Nonnull
@Override @Override
public IChunkGenerator getChunkGenerator(World world, String generatorOptions){ public IChunkGenerator getChunkGenerator(@Nonnull World world, String generatorOptions){
return new ChunkProviderCave(world); return new ChunkProviderCave(world);
} }
@Override @Override
public int getSpawnFuzz(WorldServer world, MinecraftServer server){ public int getSpawnFuzz(@Nonnull WorldServer world, MinecraftServer server){
return 1; return 1;
} }
@ -57,7 +60,7 @@ public class CaveWorldType extends WorldType{
if(isCave(player.worldObj) && !player.worldObj.isRemote){ if(isCave(player.worldObj) && !player.worldObj.isRemote){
if(player.posY >= player.worldObj.getHeight() && !player.isSpectator()){ if(player.posY >= player.worldObj.getHeight() && !player.isSpectator()){
BlockPos spawn = player.worldObj.getSpawnPoint(); BlockPos spawn = player.worldObj.getSpawnPoint();
player.playerNetServerHandler.setPlayerLocation(spawn.getX()+0.5, spawn.getY()+1, spawn.getZ()+0.5, player.rotationYaw, player.rotationPitch); player.connection.setPlayerLocation(spawn.getX()+0.5, spawn.getY()+1, spawn.getZ()+0.5, player.rotationYaw, player.rotationPitch);
} }
NBTTagCompound playerData = PersistentServerData.getDataFromPlayer(player); NBTTagCompound playerData = PersistentServerData.getDataFromPlayer(player);

View file

@ -14,22 +14,24 @@ import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class ChunkProviderCave implements IChunkGenerator{ public class ChunkProviderCave implements IChunkGenerator{
private boolean generatedSpawn; private boolean generatedSpawn;
private World world; private final World world;
private Random rand; private final Random rand;
private WorldGenerator spawnGenerator; private final WorldGenerator spawnGenerator;
public ChunkProviderCave(World world){ public ChunkProviderCave(World world){
this.world = world; this.world = world;
@ -37,6 +39,7 @@ public class ChunkProviderCave implements IChunkGenerator{
this.spawnGenerator = new WorldGenCaveSpawn(this.rand); this.spawnGenerator = new WorldGenCaveSpawn(this.rand);
} }
@Nonnull
@Override @Override
public Chunk provideChunk(int chunkX, int chunkZ){ public Chunk provideChunk(int chunkX, int chunkZ){
ChunkPrimer primer = new ChunkPrimer(); ChunkPrimer primer = new ChunkPrimer();
@ -81,22 +84,23 @@ public class ChunkProviderCave implements IChunkGenerator{
} }
@Override @Override
public boolean generateStructures(Chunk chunkIn, int x, int z){ public boolean generateStructures(@Nonnull Chunk chunkIn, int x, int z){
return false; return false;
} }
@Nonnull
@Override @Override
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos){ public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos){
return Collections.emptyList();
}
@Override
public BlockPos getStrongholdGen(@Nonnull World worldIn, @Nonnull String structureName, @Nonnull BlockPos position){
return null; return null;
} }
@Override @Override
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position){ public void recreateStructures(@Nonnull Chunk chunkIn, int x, int z){
return null;
}
@Override
public void recreateStructures(Chunk chunkIn, int x, int z){
} }
} }

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.gen.cave;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.BlockLadder; import net.minecraft.block.BlockLadder;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -25,18 +24,19 @@ import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
public class WorldGenCaveSpawn extends WorldGenerator{ public class WorldGenCaveSpawn extends WorldGenerator{
private Random rand; private final Random rand;
public WorldGenCaveSpawn(Random rand){ public WorldGenCaveSpawn(Random rand){
this.rand = rand; this.rand = rand;
} }
@Override @Override
public boolean generate(World world, Random rand, BlockPos position){ public boolean generate(@Nonnull World world, @Nonnull Random rand, @Nonnull BlockPos position){
this.generateCave(world, position); this.generateCave(world, position);
return true; return true;
} }

View file

@ -18,10 +18,12 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerBreaker extends Container{ public class ContainerBreaker extends Container{
private TileEntityBreaker breaker; private final TileEntityBreaker breaker;
public ContainerBreaker(InventoryPlayer inventory, TileEntityBase tile){ public ContainerBreaker(InventoryPlayer inventory, TileEntityBase tile){
this.breaker = (TileEntityBreaker)tile; this.breaker = (TileEntityBreaker)tile;
@ -92,7 +94,7 @@ public class ContainerBreaker extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.breaker.isUseableByPlayer(player); return this.breaker.isUseableByPlayer(player);
} }
} }

View file

@ -21,10 +21,12 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerCanolaPress extends Container{ public class ContainerCanolaPress extends Container{
private TileEntityCanolaPress press; private final TileEntityCanolaPress press;
public ContainerCanolaPress(InventoryPlayer inventory, TileEntityBase tile){ public ContainerCanolaPress(InventoryPlayer inventory, TileEntityBase tile){
this.press = (TileEntityCanolaPress)tile; this.press = (TileEntityCanolaPress)tile;
@ -95,7 +97,7 @@ public class ContainerCanolaPress extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.press.isUseableByPlayer(player); return this.press.isUseableByPlayer(player);
} }
} }

View file

@ -20,10 +20,12 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.tileentity.TileEntityFurnace;
import javax.annotation.Nonnull;
public class ContainerCoalGenerator extends Container{ public class ContainerCoalGenerator extends Container{
private TileEntityCoalGenerator generator; private final TileEntityCoalGenerator generator;
public ContainerCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){ public ContainerCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
this.generator = (TileEntityCoalGenerator)tile; this.generator = (TileEntityCoalGenerator)tile;
@ -94,7 +96,7 @@ public class ContainerCoalGenerator extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.generator.isUseableByPlayer(player); return this.generator.isUseableByPlayer(player);
} }
} }

View file

@ -23,10 +23,12 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerCoffeeMachine extends Container{ public class ContainerCoffeeMachine extends Container{
private TileEntityCoffeeMachine machine; private final TileEntityCoffeeMachine machine;
public ContainerCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile){ public ContainerCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile){
this.machine = (TileEntityCoffeeMachine)tile; this.machine = (TileEntityCoffeeMachine)tile;
@ -122,7 +124,7 @@ public class ContainerCoffeeMachine extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.machine.isUseableByPlayer(player); return this.machine.isUseableByPlayer(player);
} }
} }

View file

@ -18,23 +18,19 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class ContainerCrafter extends Container{ public class ContainerCrafter extends Container{
public final int x;
public final int y;
public final int z;
public final World world; public final World world;
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); public final InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
public IInventory craftResult = new InventoryCraftResult(); public final IInventory craftResult = new InventoryCraftResult();
public ContainerCrafter(EntityPlayer player){ public ContainerCrafter(EntityPlayer player){
InventoryPlayer inventory = player.inventory; InventoryPlayer inventory = player.inventory;
this.world = player.worldObj; this.world = player.worldObj;
this.x = (int)player.posX;
this.y = (int)player.posY;
this.z = (int)player.posZ;
this.addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, this.craftResult, 0, 124, 35)); this.addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
for(int i = 0; i < 3; i++){ for(int i = 0; i < 3; i++){
@ -116,7 +112,7 @@ public class ContainerCrafter extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return true; return true;
} }
} }

View file

@ -19,10 +19,12 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerDirectionalBreaker extends Container{ public class ContainerDirectionalBreaker extends Container{
private TileEntityDirectionalBreaker breaker; private final TileEntityDirectionalBreaker breaker;
public ContainerDirectionalBreaker(InventoryPlayer inventory, TileEntityBase tile){ public ContainerDirectionalBreaker(InventoryPlayer inventory, TileEntityBase tile){
this.breaker = (TileEntityDirectionalBreaker)tile; this.breaker = (TileEntityDirectionalBreaker)tile;
@ -93,7 +95,7 @@ public class ContainerDirectionalBreaker extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.breaker.isUseableByPlayer(player); return this.breaker.isUseableByPlayer(player);
} }
} }

View file

@ -26,13 +26,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import javax.annotation.Nonnull;
public class ContainerDrill extends Container{ public class ContainerDrill extends Container{
public static final int SLOT_AMOUNT = 5; public static final int SLOT_AMOUNT = 5;
private InventoryDrill drillInventory = new InventoryDrill(); private final InventoryDrill drillInventory = new InventoryDrill();
private InventoryPlayer inventory; private final InventoryPlayer inventory;
public ContainerDrill(InventoryPlayer inventory){ public ContainerDrill(InventoryPlayer inventory){
this.inventory = inventory; this.inventory = inventory;
@ -142,7 +144,7 @@ public class ContainerDrill extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.drillInventory.isUseableByPlayer(player); return this.drillInventory.isUseableByPlayer(player);
} }
@ -150,6 +152,7 @@ public class ContainerDrill extends Container{
public ItemStack[] slots = new ItemStack[SLOT_AMOUNT]; public ItemStack[] slots = new ItemStack[SLOT_AMOUNT];
@Nonnull
@Override @Override
public String getName(){ public String getName(){
return "drill"; return "drill";
@ -166,22 +169,22 @@ public class ContainerDrill extends Container{
} }
@Override @Override
public boolean isUseableByPlayer(EntityPlayer player){ public boolean isUseableByPlayer(@Nonnull EntityPlayer player){
return true; return true;
} }
@Override @Override
public void openInventory(EntityPlayer player){ public void openInventory(@Nonnull EntityPlayer player){
} }
@Override @Override
public void closeInventory(EntityPlayer player){ public void closeInventory(@Nonnull EntityPlayer player){
} }
@Override @Override
public boolean isItemValidForSlot(int index, ItemStack stack){ public boolean isItemValidForSlot(int index, @Nonnull ItemStack stack){
return true; return true;
} }
@ -259,6 +262,7 @@ public class ContainerDrill extends Container{
return false; return false;
} }
@Nonnull
@Override @Override
public ITextComponent getDisplayName(){ public ITextComponent getDisplayName(){
return new TextComponentString(StringUtil.localize(this.getName())); return new TextComponentString(StringUtil.localize(this.getName()));

View file

@ -19,10 +19,12 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerDropper extends Container{ public class ContainerDropper extends Container{
private TileEntityDropper dropper; private final TileEntityDropper dropper;
public ContainerDropper(InventoryPlayer inventory, TileEntityBase tile){ public ContainerDropper(InventoryPlayer inventory, TileEntityBase tile){
this.dropper = (TileEntityDropper)tile; this.dropper = (TileEntityDropper)tile;
@ -93,7 +95,7 @@ public class ContainerDropper extends Container{
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(@Nonnull EntityPlayer player){
return this.dropper.isUseableByPlayer(player); return this.dropper.isUseableByPlayer(player);
} }
} }

Some files were not shown because too many files have changed in this diff Show more