Minor cleanup and fixes

This commit is contained in:
mezz committed 2017-04-19 01:57:02 -07:00
1 parent 3bb678258f
commit 14c107ab71
30 files changed
+87 -117

No files matched your search

@@ -160,9 +160,9 @@ public abstract class BlockETDecorativeLeaves extends Block implements IItemMode
*/
@Override
public int getMetaFromState(IBlockState state) {
/**
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It returns
* the metadata of the dropped item based on the old metadata of the block.
/*
Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It returns
the metadata of the dropped item based on the old metadata of the block.
*/
return damageDropped(state);
}
@@ -20,7 +20,7 @@ public class MultiFenceRecipeSize implements IRecipe {
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
String recipePattern = "";
StringBuilder recipePattern = new StringBuilder();
List<IPlankType> types = new ArrayList<>();
for (int i = 0; i < inv.getSizeInventory(); ++i) {
ItemStack stack = inv.getStackInSlot(i);
@@ -35,7 +35,7 @@ public class MultiFenceRecipeSize implements IRecipe {
return false;
}
if (isEmpty) {
recipePattern += " ";
recipePattern.append(" ");
} else {
if (!types.contains(type)) {
types.add(type);
@@ -43,14 +43,14 @@ public class MultiFenceRecipeSize implements IRecipe {
return false;
}
}
recipePattern += types.indexOf(type);
recipePattern.append(types.indexOf(type));
}
}
if (types.isEmpty()) {
return false;
}
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
if(pattern.matches(recipePattern)){
if(pattern.matches(recipePattern.toString())){
cached = pattern.createFence(types.get(0), types.get(pattern.getTypeCount() - 1));
return true;
}
@@ -18,7 +18,6 @@ import forestry.arboriculture.IWoodTyped;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@@ -204,7 +203,7 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
Random rand = world instanceof World ? ((World)world).rand : RANDOM;
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
List<ItemStack> ret = new java.util.ArrayList<>();
float chance = 0.75F;
int amount = 2;
while(chance >= rand.nextFloat()){
@@ -272,7 +271,7 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] { NORTH, EAST, WEST, SOUTH, FIREPROOF });
return new BlockStateContainer(this, NORTH, EAST, WEST, SOUTH, FIREPROOF);
}
@Override
@@ -46,13 +46,9 @@ public class ModuleCore implements IInitializable {
final Queue<IDesignMaterial> plankQueue = new LinkedList<>();
Collections.addAll(plankQueue, PlankType.ExtraTreePlanks.values());
final Queue<AlleleETFruit> fruitQueue = new LinkedList<>();
for (final AlleleETFruit wood3 : AlleleETFruit.values()) {
fruitQueue.add(wood3);
}
fruitQueue.addAll(AlleleETFruit.values());
final Queue<IDesign> designQueue = new LinkedList<>();
for (final IDesign wood4 : CarpentryManager.carpentryInterface.getSortedDesigns()) {
designQueue.add(wood4);
}
designQueue.addAll(CarpentryManager.carpentryInterface.getSortedDesigns());
fruitQueue.remove(AlleleETFruit.Apple);
outputSpecies.println("<table style=\"width: 100%;\">");
while (!speciesQueue.isEmpty()) {
@@ -370,10 +370,9 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
@Override
public boolean trySpawnFruitBlock(ITreeGenome genome, World world, Random rand, BlockPos pos) {
if (this.pod != null && world.rand.nextFloat() <= genome.getSappiness()) {
return TreeManager.treeRoot.setFruitBlock(world, genome, this, genome.getSappiness(), pos);
}
return false;
return this.pod != null &&
world.rand.nextFloat() <= genome.getSappiness() &&
TreeManager.treeRoot.setFruitBlock(world, genome, this, genome.getSappiness(), pos);
}
@Override
@@ -20,7 +20,7 @@ public enum FruitSprite {
public static final FruitSprite[] VALUES = values();
private final ResourceLocation location;
private FruitSprite() {
FruitSprite() {
location = new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/fruit/" + name().toLowerCase(Locale.ENGLISH));
}
@@ -142,7 +142,7 @@ public class ModuleItems implements IInitializable {
try {
final Item minium = (Item) Class.forName("com.pahimar.ee3.lib.ItemIds").getField("minium_shard").get(null);
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(Food.PAPAYIMAR.get(1), minium, "cropPapaya"));
} catch (Exception ex) {
} catch (Exception ignored) {
}
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), ItemStack.EMPTY, new ItemStack(items.itemDictionary), "X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', "ingotCopper", 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD);
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), ItemStack.EMPTY, new ItemStack(items.itemDictionaryLepi), "X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', "ingotBronze", 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD);
@@ -35,9 +35,4 @@ public class ControlTankSlot extends ControlSlotFluid {
this.itemDisplay.setCroppedZone(this.itemDisplay, new Area(0, 16 - height, 16, 16));
super.onUpdateClient();
}
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
}
}
@@ -55,15 +55,15 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
if (type != null) {
desc = type.getDescription();
}
String descBody = "§o";
StringBuilder descBody = new StringBuilder("§o");
String descSig = "";
if (desc == null || desc.length() == 0) {
descBody += BinnieCore.getBinnieProxy().localise("gui.database.nodescription");
descBody.append(BinnieCore.getBinnieProxy().localise("gui.database.nodescription"));
} else {
final String[] descStrings = desc.split("\\|");
descBody += descStrings[0];
descBody.append(descStrings[0]);
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody = descBody + " " + descStrings[i];
descBody.append(" ").append(descStrings[i]);
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
@@ -102,9 +102,7 @@ public class PageSpeciesTreeGenome extends PageSpecies {
new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFTt);
y += th;
List<ItemStack> fruits = new ArrayList<>();
for (ItemStack stack : products.keySet()) {
fruits.add(stack);
}
fruits.addAll(products.keySet());
if (!fruits.isEmpty()) {
new ControlText(contents, new Area(0, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MiddleRight);
for (ItemStack fruitw : fruits) {
@@ -19,6 +19,7 @@ import binnie.core.craftgui.geometry.Area;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.genetics.TreeBreedingSystem;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.api.IDesignMaterial;
import binnie.extratrees.block.WoodManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -54,37 +55,43 @@ public class WindowArboristDatabase extends WindowAbstractDatabase {
this.createMode(TreeMode.FRUIT, new ModeWidgets(TreeMode.FRUIT, this) {
@Override
public void createListBox(final Area area) {
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
ControlListBox<ItemStack> controlListBox = new ControlListBox<ItemStack>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
@Override
@SideOnly(Side.CLIENT)
public IWidget createOption(final ItemStack value, final int y) {
return new ControlItemStackOption(this.getContent(), value, y);
}
}).setOptions(((TreeBreedingSystem) WindowArboristDatabase.this.getBreedingSystem()).allFruits);
};
controlListBox.setOptions(((TreeBreedingSystem) WindowArboristDatabase.this.getBreedingSystem()).allFruits);
this.listBox = controlListBox;
}
});
this.createMode(TreeMode.WOOD, new ModeWidgets(TreeMode.WOOD, this) {
@Override
public void createListBox(final Area area) {
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
ControlListBox<ItemStack> controlListBox = new ControlListBox<ItemStack>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
@Override
@SideOnly(Side.CLIENT)
public IWidget createOption(final ItemStack value, final int y) {
return new ControlItemStackOption(this.getContent(), value, y);
}
}).setOptions(((TreeBreedingSystem) WindowArboristDatabase.this.getBreedingSystem()).allWoods);
};
controlListBox.setOptions(((TreeBreedingSystem) WindowArboristDatabase.this.getBreedingSystem()).allWoods);
this.listBox = controlListBox;
}
});
this.createMode(TreeMode.PLANKS, new ModeWidgets(TreeMode.PLANKS, this) {
@Override
public void createListBox(final Area area) {
(this.listBox = new ControlListBox<ItemStack>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
ControlListBox<ItemStack> controlListBox = new ControlListBox<ItemStack>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
@Override
@SideOnly(Side.CLIENT)
public IWidget createOption(final ItemStack value, final int y) {
return new ControlItemStackOption(this.getContent(), value, y);
}
}).setOptions(WoodManager.getAllPlankTypes().stream().<ItemStack>map(type -> type.getStack()).collect(Collectors.toList()));
};
controlListBox.setOptions(WoodManager.getAllPlankTypes().stream().map(IDesignMaterial::getStack).collect(Collectors.toList()));
this.listBox = controlListBox;
}
});
new PageFruit(this.getInfoPages(TreeMode.FRUIT), new DatabaseTab(ExtraTrees.instance, "fruit.natural", 0), true);