Some reformat code for 1.11.2 source (#84)

* Optimized imports

* Some code reformat

* Some refactoring and code reformat

* Some code reformat
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-06-01 00:48:08 -07:00
1 parent 886c36a308
commit c3809fbc27
508 files changed
+6677 -6238

No files matched your search

+45 -48
View File
@@ -59,7 +59,7 @@ public class ExtraTrees extends AbstractMod {
@SuppressWarnings("NullableProblems")
@SidedProxy(clientSide = "binnie.extratrees.proxy.ProxyClient", serverSide = "binnie.extratrees.proxy.ProxyServer")
public static Proxy proxy;
@Nullable
private static ModuleBlocks blocks;
@Nullable
@@ -72,11 +72,41 @@ public class ExtraTrees extends AbstractMod {
private static ModuleMachine machine;
@Nullable
private static ModuleKitchen kitchen;
public ExtraTrees() {
MinecraftForge.EVENT_BUS.register(ModuleGenetics.class);
}
public static ModuleItems items() {
Preconditions.checkState(items != null);
return items;
}
public static ModuleBlocks blocks() {
Preconditions.checkState(blocks != null);
return blocks;
}
public static ModuleAlcohol alcohol() {
Preconditions.checkState(alcohol != null);
return alcohol;
}
public static ModuleCarpentry carpentry() {
Preconditions.checkState(carpentry != null);
return carpentry;
}
public static ModuleMachine machine() {
Preconditions.checkState(machine != null);
return machine;
}
public static ModuleKitchen getKitchen() {
Preconditions.checkState(kitchen != null);
return kitchen;
}
@Mod.EventHandler
public void onConstruction(FMLConstructionEvent e) {
MinecraftForge.EVENT_BUS.register(this);
@@ -97,37 +127,6 @@ public class ExtraTrees extends AbstractMod {
this.postInit();
}
public static ModuleItems items() {
Preconditions.checkState(items != null);
return items;
}
public static ModuleBlocks blocks() {
Preconditions.checkState(blocks != null);
return blocks;
}
public static ModuleAlcohol alcohol() {
Preconditions.checkState(alcohol != null);
return alcohol;
}
public static ModuleCarpentry carpentry() {
Preconditions.checkState(carpentry != null);
return carpentry;
}
public static ModuleMachine machine() {
Preconditions.checkState(machine != null);
return machine;
}
public static ModuleKitchen getKitchen() {
Preconditions.checkState(kitchen != null);
return kitchen;
}
@Override
protected void registerModules() {
this.addModule(blocks = new ModuleBlocks());
@@ -164,13 +163,13 @@ public class ExtraTrees extends AbstractMod {
public String getModID() {
return Constants.EXTRA_TREES_MOD_ID;
}
@SubscribeEvent
public void speciesRegister(AlleleSpeciesRegisterEvent event) {
if (event.getRoot() instanceof ITreeRoot) {
ETTreeDefinition.preInitTrees();
PlankType.ExtraTreePlanks.initWoodTypes();
}else if(event.getRoot() instanceof IButterflyRoot && BinnieCore.isLepidopteryActive()) {
} else if (event.getRoot() instanceof IButterflyRoot && BinnieCore.isLepidopteryActive()) {
ButterflySpecies.preInit();
}
}
@@ -185,19 +184,13 @@ public class ExtraTrees extends AbstractMod {
return BinnieCore.isExtraTreesActive();
}
public static class PacketHandler extends BinniePacketHandler {
public PacketHandler() {
super(ExtraTrees.instance);
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onBakedEvent(ModelBakeEvent e) {
//Find all ExtraTrees saplings
List<ModelResourceLocation> models = e.getModelRegistry().getKeys().stream()
.filter(mrl -> mrl.getResourceDomain().startsWith(Constants.EXTRA_TREES_MOD_ID))
.filter(mrl -> mrl.getResourcePath().startsWith("germlings")).collect(Collectors.toList());
.filter(mrl -> mrl.getResourceDomain().startsWith(Constants.EXTRA_TREES_MOD_ID))
.filter(mrl -> mrl.getResourcePath().startsWith("germlings")).collect(Collectors.toList());
//Replace model
Map<String, ETTreeDefinition> map = Arrays.stream(ETTreeDefinition.values()).collect(Collectors.toMap(o -> o.name().toLowerCase(), o -> o));
models.forEach(model -> {
@@ -207,9 +200,8 @@ public class ExtraTrees extends AbstractMod {
int secondaryColor = treeSpecies.getWoodColor().getRGB();
e.getModelRegistry().putObject(model, new DoublePassBakedModel(e.getModelRegistry().getObject(model), primaryColor, secondaryColor));
});
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerSprites(TextureStitchEvent.Pre event) {
@@ -217,15 +209,20 @@ public class ExtraTrees extends AbstractMod {
sprite.registerSprites();
}
TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
for(IPlankType type : PlankType.ExtraTreePlanks.VALUES){
for (IPlankType type : PlankType.ExtraTreePlanks.VALUES) {
type.registerSprites(map);
}
for(IPlankType type : PlankType.ForestryPlanks.values()){
for (IPlankType type : PlankType.ForestryPlanks.values()) {
type.registerSprites(map);
}
for(IPlankType type : PlankType.VanillaPlanks.values()){
for (IPlankType type : PlankType.VanillaPlanks.values()) {
type.registerSprites(map);
}
}
public static class PacketHandler extends BinniePacketHandler {
public PacketHandler() {
super(ExtraTrees.instance);
}
}
}
@@ -42,6 +42,28 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
Rye("mash.rye", 10836007, 0.9, 0.05),
Corn("mash.corn", 13411364, 0.9, 0.05);
static {
Alcohol.Apple.setFementation(Juice.Apple);
Alcohol.Apricot.setFementation(Juice.Apricot);
Alcohol.Banana.setFementation(Juice.Banana);
Alcohol.Cherry.setFementation(Juice.Cherry);
Alcohol.Elderberry.setFementation(Juice.Elderberry);
Alcohol.Peach.setFementation(Juice.Peach);
Alcohol.Pear.setFementation(Juice.Pear);
Alcohol.Plum.setFementation(Juice.Plum);
Alcohol.Carrot.setFementation(Juice.Carrot);
Alcohol.WhiteWine.setFementation(Juice.WhiteGrape);
Alcohol.RedWine.setFementation(Juice.RedGrape);
Alcohol.Citrus.setFementation(Juice.Lemon);
Alcohol.Citrus.setFementation(Juice.Lime);
Alcohol.Citrus.setFementation(Juice.Orange);
Alcohol.Citrus.setFementation(Juice.Grapefruit);
Alcohol.Tomato.setFementation(Juice.Tomato);
Alcohol.Cranberry.setFementation(Juice.Cranberry);
Alcohol.Pineapple.setFementation(Juice.Pineapple);
Alcohol.Potato.setFementation("cropPotato");
}
List<String> fermentationLiquid;
String fermentationSolid;
String ident;
@@ -49,14 +71,6 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
float transparency;
float abv;
private void setFementation(final Juice juice) {
this.fermentationLiquid.add(juice.getIdentifier());
}
private void setFementation(final String oreDict) {
this.fermentationSolid = oreDict;
}
Alcohol(final String ident, final int colour, final double transparency, final double abv) {
this.fermentationLiquid = new ArrayList<>();
this.fermentationSolid = "";
@@ -66,6 +80,14 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
this.abv = (float) abv;
}
private void setFementation(final Juice juice) {
this.fermentationLiquid.add(juice.getIdentifier());
}
private void setFementation(final String oreDict) {
this.fermentationSolid = oreDict;
}
@Override
public String toString() {
return this.getDisplayName();
@@ -130,26 +152,4 @@ public enum Alcohol implements IFluidType, ICocktailLiquid {
public float getABV() {
return this.abv;
}
static {
Alcohol.Apple.setFementation(Juice.Apple);
Alcohol.Apricot.setFementation(Juice.Apricot);
Alcohol.Banana.setFementation(Juice.Banana);
Alcohol.Cherry.setFementation(Juice.Cherry);
Alcohol.Elderberry.setFementation(Juice.Elderberry);
Alcohol.Peach.setFementation(Juice.Peach);
Alcohol.Pear.setFementation(Juice.Pear);
Alcohol.Plum.setFementation(Juice.Plum);
Alcohol.Carrot.setFementation(Juice.Carrot);
Alcohol.WhiteWine.setFementation(Juice.WhiteGrape);
Alcohol.RedWine.setFementation(Juice.RedGrape);
Alcohol.Citrus.setFementation(Juice.Lemon);
Alcohol.Citrus.setFementation(Juice.Lime);
Alcohol.Citrus.setFementation(Juice.Orange);
Alcohol.Citrus.setFementation(Juice.Grapefruit);
Alcohol.Tomato.setFementation(Juice.Tomato);
Alcohol.Cranberry.setFementation(Juice.Cranberry);
Alcohol.Pineapple.setFementation(Juice.Pineapple);
Alcohol.Potato.setFementation("cropPotato");
}
}
@@ -40,52 +40,6 @@ public enum Cocktail {
SexOnTheBeach("Sex on the Beach", Glassware.Highball, 16677426);
static final Map<String, ICocktailIngredient> cocktailIngredients = new HashMap<>();
public String name;
public Glassware glassware;
public int colour;
public Map<ICocktailIngredient, Integer> ingredients;
Cocktail(final String name, final Glassware glassware, final int colour) {
this.ingredients = new HashMap<>();
this.name = name;
this.glassware = glassware;
this.colour = colour;
}
private void add(final ICocktailIngredient ingredient, final int ratio) {
this.ingredients.put(ingredient, ratio);
}
@Nullable
public static Cocktail get(final Map<ICocktailIngredient, Integer> ingredients) {
for (final Cocktail cocktail : values()) {
boolean is = true;
for (final Map.Entry<ICocktailIngredient, Integer> entry : ingredients.entrySet()) {
if (!Objects.equals(cocktail.ingredients.get(entry.getKey()), entry.getValue())) {
is = false;
}
}
if (is) {
return cocktail;
}
}
return null;
}
public static void registerIngredient(final ICocktailIngredient ingredient) {
String id = ingredient.getIdentifier().toLowerCase();
Cocktail.cocktailIngredients.put(id, ingredient);
DrinkLiquid liquid = new DrinkLiquid(ingredient.getDisplayName(), ingredient.getColour(), ingredient.getTransparency(), ingredient.getABV(), id);
DrinkManager.registerDrinkLiquid(liquid);
}
public static ICocktailIngredient getIngredient(final String name2) {
return Cocktail.cocktailIngredients.get(name2.toLowerCase());
}
public static boolean isIngredient(final String name) {
return Cocktail.cocktailIngredients.containsKey(name.toLowerCase());
}
static {
Cocktail.Bellini.add(Alcohol.SparklingWine, 2);
@@ -172,4 +126,51 @@ public enum Cocktail {
Cocktail.SexOnTheBeach.add(Juice.Orange, 2);
Cocktail.SexOnTheBeach.add(Juice.Cranberry, 2);
}
public String name;
public Glassware glassware;
public int colour;
public Map<ICocktailIngredient, Integer> ingredients;
Cocktail(final String name, final Glassware glassware, final int colour) {
this.ingredients = new HashMap<>();
this.name = name;
this.glassware = glassware;
this.colour = colour;
}
@Nullable
public static Cocktail get(final Map<ICocktailIngredient, Integer> ingredients) {
for (final Cocktail cocktail : values()) {
boolean is = true;
for (final Map.Entry<ICocktailIngredient, Integer> entry : ingredients.entrySet()) {
if (!Objects.equals(cocktail.ingredients.get(entry.getKey()), entry.getValue())) {
is = false;
}
}
if (is) {
return cocktail;
}
}
return null;
}
public static void registerIngredient(final ICocktailIngredient ingredient) {
String id = ingredient.getIdentifier().toLowerCase();
Cocktail.cocktailIngredients.put(id, ingredient);
DrinkLiquid liquid = new DrinkLiquid(ingredient.getDisplayName(), ingredient.getColour(), ingredient.getTransparency(), ingredient.getABV(), id);
DrinkManager.registerDrinkLiquid(liquid);
}
public static ICocktailIngredient getIngredient(final String name2) {
return Cocktail.cocktailIngredients.get(name2.toLowerCase());
}
public static boolean isIngredient(final String name) {
return Cocktail.cocktailIngredients.containsKey(name.toLowerCase());
}
private void add(final ICocktailIngredient ingredient, final int ratio) {
this.ingredients.put(ingredient, ratio);
}
}
@@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
public enum Glassware {
BeerMug(480, 10, 14),
Pint(600, 6, 20),
@@ -24,11 +23,17 @@ public enum Glassware {
Sherry(60, 17, 7),
Coupe(180, 19, 8);
private int capacity;
float contentBottom;
float contentHeight;
// public IIcon glass;
// public IIcon contents;
private int capacity;
//public IIcon glass;
//public IIcon contents;
Glassware(final int capacity, final int contentBottom, final int contentHeight) {
this.capacity = capacity;
this.contentBottom = contentBottom / 32.0f;
this.contentHeight = contentHeight / 32.0f;
}
public String getName(@Nullable final String liquid) {
if (liquid == null) {
@@ -41,16 +46,10 @@ public enum Glassware {
return this.capacity;
}
Glassware(final int capacity, final int contentBottom, final int contentHeight) {
this.capacity = capacity;
this.contentBottom = contentBottom / 32.0f;
this.contentHeight = contentHeight / 32.0f;
}
// public void registerIcons(final IIconRegister par1IconRegister) {
// this.glass = ExtraTrees.proxy.getIcon(par1IconRegister, "glassware/" + this.toString().toLowerCase() + ".glass");
// this.contents = ExtraTrees.proxy.getIcon(par1IconRegister, "glassware/" + this.toString().toLowerCase() + ".contents");
// }
/*public void registerIcons(final IIconRegister par1IconRegister) {
this.glass = ExtraTrees.proxy.getIcon(par1IconRegister, "glassware/" + this.toString().toLowerCase() + ".glass");
this.contents = ExtraTrees.proxy.getIcon(par1IconRegister, "glassware/" + this.toString().toLowerCase() + ".contents");
}*/
public ItemStack get(final int i) {
return ExtraTrees.alcohol().drink.getStack(this, null);
@@ -28,17 +28,13 @@ public enum Juice implements IFluidType, ICocktailLiquid {
WhiteGrape("White Grape Juice", "juice.white.grape", 16507769, 0.6, "WhiteGrape"),
RedGrape("Red Grape Juice", "juice.red.grape", 9775412, 0.6, "RedGrape");
public String squeezing;
String name;
String ident;
public String squeezing;
//IIcon icon;
int colour;
float transparency;
private void addSqueezing(final String oreDict) {
this.squeezing = oreDict;
}
Juice(final String name, final String ident, final int colour, final double transparency, final String squeezing) {
this.name = name;
this.ident = ident;
@@ -47,6 +43,10 @@ public enum Juice implements IFluidType, ICocktailLiquid {
this.addSqueezing("crop" + squeezing);
}
private void addSqueezing(final String oreDict) {
this.squeezing = oreDict;
}
@Override
public String toString() {
return this.name;
@@ -62,7 +62,6 @@ public enum Juice implements IFluidType, ICocktailLiquid {
return container == FluidContainerType.GLASS;
}
@Override
public ResourceLocation getFlowing() {
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid");
@@ -26,15 +26,32 @@ public enum Liqueur implements IFluidType, ICocktailLiquid {
Blackberry("Blackberry", 6837581, 0.5, 0.2),
Raspberry("Raspberry", 10158848, 0.5, 0.2);
static {
Liqueur.Almond.addFlavour("cropAlmond");
Liqueur.Orange.addFlavour("cropOrange");
Liqueur.Banana.addFlavour("cropBanana");
Liqueur.Chocolate.addFlavour("cropCocoa");
Liqueur.Mint.addFlavour("cropMint");
Liqueur.Hazelnut.addFlavour("cropHazelnut");
Liqueur.Cinnamon.addFlavour("cropCinnamon");
Liqueur.Coffee.addFlavour("cropCoffee");
Liqueur.Melon.addFlavour("cropMelon");
Liqueur.Anise.addFlavour("cropAnise");
Liqueur.Peach.addFlavour("cropPeach");
Liqueur.Lemon.addFlavour("cropLemon");
Liqueur.Herbal.addFlavour("cropHerbal");
Liqueur.Cherry.addFlavour("cropCherry");
Liqueur.Blackcurrant.addFlavour("cropBlackcurrant");
Liqueur.Blackberry.addFlavour("cropBlackberry");
Liqueur.Raspberry.addFlavour("cropRaspberry");
}
String name;
String ident;
int colour;
float transparency;
float abv;
private void addFlavour(final String oreDict) {
}
Liqueur(final String name, final int colour, final double transparency, final double abv) {
this(name + " Liqueur", "liqueur." + name.toLowerCase(), colour, transparency, abv);
}
@@ -47,6 +64,9 @@ public enum Liqueur implements IFluidType, ICocktailLiquid {
this.abv = (float) abv;
}
private void addFlavour(final String oreDict) {
}
@Override
public String toString() {
return this.name;
@@ -111,24 +131,4 @@ public enum Liqueur implements IFluidType, ICocktailLiquid {
public float getABV() {
return this.abv;
}
static {
Liqueur.Almond.addFlavour("cropAlmond");
Liqueur.Orange.addFlavour("cropOrange");
Liqueur.Banana.addFlavour("cropBanana");
Liqueur.Chocolate.addFlavour("cropCocoa");
Liqueur.Mint.addFlavour("cropMint");
Liqueur.Hazelnut.addFlavour("cropHazelnut");
Liqueur.Cinnamon.addFlavour("cropCinnamon");
Liqueur.Coffee.addFlavour("cropCoffee");
Liqueur.Melon.addFlavour("cropMelon");
Liqueur.Anise.addFlavour("cropAnise");
Liqueur.Peach.addFlavour("cropPeach");
Liqueur.Lemon.addFlavour("cropLemon");
Liqueur.Herbal.addFlavour("cropHerbal");
Liqueur.Cherry.addFlavour("cropCherry");
Liqueur.Blackcurrant.addFlavour("cropBlackcurrant");
Liqueur.Blackberry.addFlavour("cropBlackberry");
Liqueur.Raspberry.addFlavour("cropRaspberry");
}
}
@@ -19,7 +19,7 @@ public enum MiscFluid implements IFluidType, ICocktailLiquid {
String name;
String ident;
// IIcon icon;
//IIcon icon;
int colour;
float transparency;
@@ -99,17 +99,17 @@ public class ModuleAlcohol implements IInitializable {
}
BreweryRecipes.addRecipes(
new BrewedGrainRecipe(Alcohol.Ale, BreweryRecipes.GRAIN_BARLEY, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.Lager, BreweryRecipes.GRAIN_BARLEY, BreweryRecipes.HOPS, ExtraTreeItems.LagerYeast.get(1)),
new BrewedGrainRecipe(Alcohol.Stout, BreweryRecipes.GRAIN_ROASTED, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.CornBeer, BreweryRecipes.GRAIN_CORN, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.RyeBeer, BreweryRecipes.GRAIN_RYE, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.WheatBeer, BreweryRecipes.GRAIN_WHEAT, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.Ale, BreweryRecipes.GRAIN_BARLEY, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.Lager, BreweryRecipes.GRAIN_BARLEY, BreweryRecipes.HOPS, ExtraTreeItems.LagerYeast.get(1)),
new BrewedGrainRecipe(Alcohol.Stout, BreweryRecipes.GRAIN_ROASTED, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.CornBeer, BreweryRecipes.GRAIN_CORN, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.RyeBeer, BreweryRecipes.GRAIN_RYE, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.WheatBeer, BreweryRecipes.GRAIN_WHEAT, BreweryRecipes.HOPS),
new BrewedGrainRecipe(Alcohol.Barley, BreweryRecipes.GRAIN_BARLEY),
new BrewedGrainRecipe(Alcohol.Corn, BreweryRecipes.GRAIN_CORN),
new BrewedGrainRecipe(Alcohol.Rye, BreweryRecipes.GRAIN_RYE),
new BrewedGrainRecipe(Alcohol.Wheat, BreweryRecipes.GRAIN_WHEAT)
new BrewedGrainRecipe(Alcohol.Barley, BreweryRecipes.GRAIN_BARLEY),
new BrewedGrainRecipe(Alcohol.Corn, BreweryRecipes.GRAIN_CORN),
new BrewedGrainRecipe(Alcohol.Rye, BreweryRecipes.GRAIN_RYE),
new BrewedGrainRecipe(Alcohol.Wheat, BreweryRecipes.GRAIN_WHEAT)
);
this.addDistillery(Alcohol.Apple, Spirit.AppleBrandy, Spirit.AppleLiquor, Spirit.NeutralSpirit);
@@ -13,29 +13,29 @@ public class BlockDrink extends BlockContainer {
this.setCreativeTab(CreativeTabs.TOOLS);
}
// @Override
// @SideOnly(Side.CLIENT)
// public int getRenderBlockPass() {
// return 1;
// }
/*@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return 1;
}*/
@Override
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileEntityDrink();
}
// @Override
// public int getRenderType() {
// return ModuleAlcohol.drinkRendererID;
// }
//
// @Override
// public boolean isNormalCube() {
// return false;
// }
//
// @Override
// public boolean isOpaqueCube() {
// return true;
// }
/*@Override
public int getRenderType() {
return ModuleAlcohol.drinkRendererID;
}
@Override
public boolean isNormalCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return true;
}*/
}
@@ -3,38 +3,38 @@ package binnie.extratrees.alcohol.drink;
//TODO RENDERING
public class BlockDrinkRenderer //implements ISimpleBlockRenderingHandler
{
// @Override
// public void renderInventoryBlock(final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
// }
//
// @Override
// public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
// GlStateManager.pushMatrix();
// Tessellator.instance.setColorRGBA(255, 255, 255, 150);
// final Tessellator tess = Tessellator.instance;
// renderer.renderFaceYPos(block, x, y, z, Blocks.dirt.getIcon(0, 0));
// final float s = 0.0625f;
// for (int h = 0; h < 16; ++h) {
// final float d1 = 8.0f * s;
// final float d2 = 8.0f * s;
// final float h2 = h * s;
// final float h3 = h * s;
// tess.addVertexWithUV(x + 0.5f - d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
// tess.addVertexWithUV(x + 0.5f - d1, y + h3, z + 0.5f - d1, 0.0, 0.0);
// tess.addVertexWithUV(x + 0.5f + d1, y + h3, z + 0.5f - d1, 0.0, 0.0);
// tess.addVertexWithUV(x + 0.5f + d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
// }
// GlStateManager.popMatrix();
// return false;
// }
//
// @Override
// public boolean shouldRender3DInInventory(final int modelId) {
// return false;
// }
//
// @Override
// public int getRenderId() {
// return ModuleAlcohol.drinkRendererID;
// }
/*@Override
public void renderInventoryBlock(final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
}
@Override
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
GlStateManager.pushMatrix();
Tessellator.instance.setColorRGBA(255, 255, 255, 150);
final Tessellator tess = Tessellator.instance;
renderer.renderFaceYPos(block, x, y, z, Blocks.dirt.getIcon(0, 0));
final float s = 0.0625f;
for (int h = 0; h < 16; ++h) {
final float d1 = 8.0f * s;
final float d2 = 8.0f * s;
final float h2 = h * s;
final float h3 = h * s;
tess.addVertexWithUV(x + 0.5f - d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
tess.addVertexWithUV(x + 0.5f - d1, y + h3, z + 0.5f - d1, 0.0, 0.0);
tess.addVertexWithUV(x + 0.5f + d1, y + h3, z + 0.5f - d1, 0.0, 0.0);
tess.addVertexWithUV(x + 0.5f + d1, y + h2, z + 0.5f - d1, 0.0, 0.0);
}
GlStateManager.popMatrix();
return false;
}
@Override
public boolean shouldRender3DInInventory(final int modelId) {
return false;
}
@Override
public int getRenderId() {
return ModuleAlcohol.drinkRendererID;
}*/
}
@@ -2,210 +2,210 @@ package binnie.extratrees.alcohol.drink;
public class CocktailRenderer //implements IItemRenderer
{
// private void renderCocktail(final RenderBlocks renderBlocks, final ItemStack item, final float p, final float q, final float r) {
// final RenderItem renderItem = new RenderItem();
// GlStateManager.enableBlend();
// GL11.glBlendFunc(770, 771);
// final Glassware glass = ExtraTrees.drink.getGlassware(item);
// final FluidStack fluid = ExtraTrees.drink.getFluid(item);
// final IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
// this.setColor(16777215, 0.8f);
// renderItem.renderIcon(0, 0, glass.glass, 16, 16);
// if (drink != null) {
// this.setColor(drink.getColour(), 1.2f * drink.getTransparency() + 0.3f);
// final IIcon icon = glass.contents;
// final float amount = fluid.amount / glass.getVolume();
// final float level = glass.getContentHeight() * (1.0f - amount);
// final float gapAtTop = 1.0f - (glass.getContentBottom() + glass.getContentHeight());
// final float x = 0.0f;
// final float y = 16.0f * (gapAtTop + level);
// final float w = 16.0f;
// final float h = 16.0f - y;
// final float minV = icon.getInterpolatedV(y);
// final float maxV = icon.getInterpolatedV(16.0);
// final Tessellator tessellator = Tessellator.instance;
// tessellator.startDrawingQuads();
// tessellator.addVertexWithUV(x + 0.0f, y + h, renderItem.zLevel, icon.getMinU(), maxV);
// tessellator.addVertexWithUV(x + w, y + h, renderItem.zLevel, icon.getMaxU(), maxV);
// tessellator.addVertexWithUV(x + w, y + 0.0f, renderItem.zLevel, icon.getMaxU(), minV);
// tessellator.addVertexWithUV(x + 0.0f, y + 0.0f, renderItem.zLevel, icon.getMinU(), minV);
// tessellator.draw();
// }
// GlStateManager.disableBlend();
// }
//
// private void setColor(final int i1, final float alpha) {
// final float f = (i1 >> 16 & 0xFF) / 255.0f;
// final float f2 = (i1 >> 8 & 0xFF) / 255.0f;
// final float f3 = (i1 & 0xFF) / 255.0f;
// GL11.glColor4f(f, f2, f3, (alpha > 1.0f) ? 1.0f : alpha);
// }
//
// private void renderFace(final Tessellator tessellator, final ForgeDirection dir) {
// switch (dir) {
// case DOWN: {
// tessellator.addVertex(0.0, 0.0, 0.0);
// tessellator.addVertex(0.0, 0.0, 1.0);
// tessellator.addVertex(1.0, 0.0, 1.0);
// tessellator.addVertex(1.0, 0.0, 0.0);
// break;
// }
// }
// }
//
// @Override
// public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
// switch (type) {
// case ENTITY: {
// return true;
// }
// case EQUIPPED: {
// return true;
// }
// case INVENTORY: {
// return true;
// }
// case EQUIPPED_FIRST_PERSON: {
// return true;
// }
// default: {
// return false;
// }
// }
// }
//
// @Override
// public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
// return helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING;
// }
//
// @Override
// public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
// switch (type) {
// case ENTITY:
// case EQUIPPED:
// case EQUIPPED_FIRST_PERSON: {
// if (type == IItemRenderer.ItemRenderType.ENTITY) {
// GlStateManager.translate(-0.5f, -0.25f, -0.0f);
// }
// final TextureManager texturemanager = BinnieCore.proxy.getMinecraftInstance().getTextureManager();
// final Glassware glass = ExtraTrees.drink.getGlassware(item);
// final FluidStack fluid = ExtraTrees.drink.getFluid(item);
// IIcon iicon = glass.glass;
// final float f = iicon.getMinU();
// final float f2 = iicon.getMaxU();
// final float f3 = iicon.getMinV();
// final float f4 = iicon.getMaxV();
// texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
// TextureUtil.func_152777_a(false, false, 1.0f);
// this.setColor(16777215, 0.8f);
// final IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
// this.setColor(16777215, 0.8f);
// ItemRenderer.renderItemIn2D(Tessellator.instance, f2, f3, f, f4, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625f);
// if (drink != null) {
// this.setColor(drink.getColour(), 1.2f * drink.getTransparency() + 0.3f);
// iicon = glass.contents;
// final IIcon icon = glass.contents;
// final float amount = fluid.amount / glass.getVolume();
// final float level = glass.getContentHeight() * (1.0f - amount);
// final float gapAtTop = 1.0f - (glass.getContentBottom() + glass.getContentHeight());
// final float x = 0.0f;
// final float y = 1.0f * (gapAtTop + level);
// final float w = 1.0f;
// final float h = 1.0f - y;
// final float minV = icon.getInterpolatedV(y * 16.0f);
// final float maxV = icon.getInterpolatedV(16.0);
// final float minU = icon.getMinU();
// final float maxU = icon.getMaxU();
// final Tessellator tessellator = Tessellator.instance;
// tessellator.setNormal(0.0f, 0.0f, -1.0f);
// tessellator.startDrawingQuads();
// tessellator.addVertexWithUV(0.0, 1.0 - y, -0.03125, maxU, minV);
// tessellator.addVertexWithUV(1.0, 1.0 - y, -0.03125, minU, minV);
// tessellator.addVertexWithUV(1.0, 0.0, -0.03125, minU, maxV);
// tessellator.addVertexWithUV(0.0, 0.0, -0.03125, maxU, maxV);
// tessellator.draw();
// tessellator.setNormal(0.0f, 0.0f, 1.0f);
// tessellator.startDrawingQuads();
// tessellator.addVertexWithUV(0.0, 1.0 - y, -0.03125, maxU, minV);
// tessellator.addVertexWithUV(0.0, 0.0, -0.03125, maxU, maxV);
// tessellator.addVertexWithUV(1.0, 0.0, -0.03125, minU, maxV);
// tessellator.addVertexWithUV(1.0, 1.0 - y, -0.03125, minU, minV);
// tessellator.draw();
// break;
// }
// break;
// }
// case INVENTORY: {
// this.renderCocktail((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
// break;
// }
// }
// }
//
// public void renderItemIn2DPercentage(final Tessellator tesselator, final float maxU, final float minV, final float minU, float maxV, final int width, final int height, final float depth, final float percent) {
// maxV = minV + (maxV - minV) * 1.0f;
// tesselator.startDrawingQuads();
// tesselator.setNormal(0.0f, 0.0f, 1.0f);
// tesselator.addVertexWithUV(0.0, 0.0, 0.0, maxU, maxV);
// tesselator.addVertexWithUV(1.0, 0.0, 0.0, minU, maxV);
// tesselator.addVertexWithUV(1.0, 1.0, 0.0, minU, minV);
// tesselator.addVertexWithUV(0.0, 1.0, 0.0, maxU, minV);
// tesselator.draw();
// tesselator.startDrawingQuads();
// tesselator.setNormal(0.0f, 0.0f, -1.0f);
// tesselator.addVertexWithUV(0.0, percent, 0.0f - depth, maxU, minV);
// tesselator.addVertexWithUV(1.0, percent, 0.0f - depth, minU, minV);
// tesselator.addVertexWithUV(1.0, 0.0, 0.0f - depth, minU, maxV);
// tesselator.addVertexWithUV(0.0, 0.0, 0.0f - depth, maxU, maxV);
// tesselator.draw();
// final float f5 = 0.5f * (maxU - minU) / width;
// final float f6 = 0.5f * (maxV - minV) / height;
// tesselator.startDrawingQuads();
// tesselator.setNormal(-1.0f, 0.0f, 0.0f);
// for (int k = 0; k < width; ++k) {
// final float f7 = k / width;
// final float f8 = maxU + (minU - maxU) * f7 - f5;
// tesselator.addVertexWithUV(f7, 0.0, 0.0f - depth, f8, maxV);
// tesselator.addVertexWithUV(f7, 0.0, 0.0, f8, maxV);
// tesselator.addVertexWithUV(f7, 1.0, 0.0, f8, minV);
// tesselator.addVertexWithUV(f7, 1.0, 0.0f - depth, f8, minV);
// }
// tesselator.draw();
// tesselator.startDrawingQuads();
// tesselator.setNormal(1.0f, 0.0f, 0.0f);
// for (int k = 0; k < width; ++k) {
// final float f7 = k / width;
// final float f8 = maxU + (minU - maxU) * f7 - f5;
// final float f9 = f7 + 1.0f / width;
// tesselator.addVertexWithUV(f9, 1.0, 0.0f - depth, f8, minV);
// tesselator.addVertexWithUV(f9, 1.0, 0.0, f8, minV);
// tesselator.addVertexWithUV(f9, 0.0, 0.0, f8, maxV);
// tesselator.addVertexWithUV(f9, 0.0, 0.0f - depth, f8, maxV);
// }
// tesselator.draw();
// tesselator.startDrawingQuads();
// tesselator.setNormal(0.0f, 1.0f, 0.0f);
// for (int k = 0; k < height; ++k) {
// final float f7 = k / height;
// final float f8 = maxV + (minV - maxV) * f7 - f6;
// final float f9 = f7 + 1.0f / height;
// tesselator.addVertexWithUV(0.0, f9, 0.0, maxU, f8);
// tesselator.addVertexWithUV(1.0, f9, 0.0, minU, f8);
// tesselator.addVertexWithUV(1.0, f9, 0.0f - depth, minU, f8);
// tesselator.addVertexWithUV(0.0, f9, 0.0f - depth, maxU, f8);
// }
// tesselator.draw();
// tesselator.startDrawingQuads();
// tesselator.setNormal(0.0f, -1.0f, 0.0f);
// for (int k = 0; k < height; ++k) {
// final float f7 = k / height;
// final float f8 = maxV + (minV - maxV) * f7 - f6;
// tesselator.addVertexWithUV(1.0, f7, 0.0, minU, f8);
// tesselator.addVertexWithUV(0.0, f7, 0.0, maxU, f8);
// tesselator.addVertexWithUV(0.0, f7, 0.0f - depth, maxU, f8);
// tesselator.addVertexWithUV(1.0, f7, 0.0f - depth, minU, f8);
// }
// tesselator.draw();
// }
/*private void renderCocktail(final RenderBlocks renderBlocks, final ItemStack item, final float p, final float q, final float r) {
final RenderItem renderItem = new RenderItem();
GlStateManager.enableBlend();
GL11.glBlendFunc(770, 771);
final Glassware glass = ExtraTrees.drink.getGlassware(item);
final FluidStack fluid = ExtraTrees.drink.getFluid(item);
final IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
this.setColor(16777215, 0.8f);
renderItem.renderIcon(0, 0, glass.glass, 16, 16);
if (drink != null) {
this.setColor(drink.getColour(), 1.2f * drink.getTransparency() + 0.3f);
final IIcon icon = glass.contents;
final float amount = fluid.amount / glass.getVolume();
final float level = glass.getContentHeight() * (1.0f - amount);
final float gapAtTop = 1.0f - (glass.getContentBottom() + glass.getContentHeight());
final float x = 0.0f;
final float y = 16.0f * (gapAtTop + level);
final float w = 16.0f;
final float h = 16.0f - y;
final float minV = icon.getInterpolatedV(y);
final float maxV = icon.getInterpolatedV(16.0);
final Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(x + 0.0f, y + h, renderItem.zLevel, icon.getMinU(), maxV);
tessellator.addVertexWithUV(x + w, y + h, renderItem.zLevel, icon.getMaxU(), maxV);
tessellator.addVertexWithUV(x + w, y + 0.0f, renderItem.zLevel, icon.getMaxU(), minV);
tessellator.addVertexWithUV(x + 0.0f, y + 0.0f, renderItem.zLevel, icon.getMinU(), minV);
tessellator.draw();
}
GlStateManager.disableBlend();
}
private void setColor(final int i1, final float alpha) {
final float f = (i1 >> 16 & 0xFF) / 255.0f;
final float f2 = (i1 >> 8 & 0xFF) / 255.0f;
final float f3 = (i1 & 0xFF) / 255.0f;
GL11.glColor4f(f, f2, f3, (alpha > 1.0f) ? 1.0f : alpha);
}
private void renderFace(final Tessellator tessellator, final ForgeDirection dir) {
switch (dir) {
case DOWN: {
tessellator.addVertex(0.0, 0.0, 0.0);
tessellator.addVertex(0.0, 0.0, 1.0);
tessellator.addVertex(1.0, 0.0, 1.0);
tessellator.addVertex(1.0, 0.0, 0.0);
break;
}
}
}
@Override
public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
switch (type) {
case ENTITY: {
return true;
}
case EQUIPPED: {
return true;
}
case INVENTORY: {
return true;
}
case EQUIPPED_FIRST_PERSON: {
return true;
}
default: {
return false;
}
}
}
@Override
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
return helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
switch (type) {
case ENTITY:
case EQUIPPED:
case EQUIPPED_FIRST_PERSON: {
if (type == IItemRenderer.ItemRenderType.ENTITY) {
GlStateManager.translate(-0.5f, -0.25f, -0.0f);
}
final TextureManager texturemanager = BinnieCore.proxy.getMinecraftInstance().getTextureManager();
final Glassware glass = ExtraTrees.drink.getGlassware(item);
final FluidStack fluid = ExtraTrees.drink.getFluid(item);
IIcon iicon = glass.glass;
final float f = iicon.getMinU();
final float f2 = iicon.getMaxU();
final float f3 = iicon.getMinV();
final float f4 = iicon.getMaxV();
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
TextureUtil.func_152777_a(false, false, 1.0f);
this.setColor(16777215, 0.8f);
final IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
this.setColor(16777215, 0.8f);
ItemRenderer.renderItemIn2D(Tessellator.instance, f2, f3, f, f4, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625f);
if (drink != null) {
this.setColor(drink.getColour(), 1.2f * drink.getTransparency() + 0.3f);
iicon = glass.contents;
final IIcon icon = glass.contents;
final float amount = fluid.amount / glass.getVolume();
final float level = glass.getContentHeight() * (1.0f - amount);
final float gapAtTop = 1.0f - (glass.getContentBottom() + glass.getContentHeight());
final float x = 0.0f;
final float y = 1.0f * (gapAtTop + level);
final float w = 1.0f;
final float h = 1.0f - y;
final float minV = icon.getInterpolatedV(y * 16.0f);
final float maxV = icon.getInterpolatedV(16.0);
final float minU = icon.getMinU();
final float maxU = icon.getMaxU();
final Tessellator tessellator = Tessellator.instance;
tessellator.setNormal(0.0f, 0.0f, -1.0f);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0, 1.0 - y, -0.03125, maxU, minV);
tessellator.addVertexWithUV(1.0, 1.0 - y, -0.03125, minU, minV);
tessellator.addVertexWithUV(1.0, 0.0, -0.03125, minU, maxV);
tessellator.addVertexWithUV(0.0, 0.0, -0.03125, maxU, maxV);
tessellator.draw();
tessellator.setNormal(0.0f, 0.0f, 1.0f);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0, 1.0 - y, -0.03125, maxU, minV);
tessellator.addVertexWithUV(0.0, 0.0, -0.03125, maxU, maxV);
tessellator.addVertexWithUV(1.0, 0.0, -0.03125, minU, maxV);
tessellator.addVertexWithUV(1.0, 1.0 - y, -0.03125, minU, minV);
tessellator.draw();
break;
}
break;
}
case INVENTORY: {
this.renderCocktail((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
break;
}
}
}
public void renderItemIn2DPercentage(final Tessellator tesselator, final float maxU, final float minV, final float minU, float maxV, final int width, final int height, final float depth, final float percent) {
maxV = minV + (maxV - minV) * 1.0f;
tesselator.startDrawingQuads();
tesselator.setNormal(0.0f, 0.0f, 1.0f);
tesselator.addVertexWithUV(0.0, 0.0, 0.0, maxU, maxV);
tesselator.addVertexWithUV(1.0, 0.0, 0.0, minU, maxV);
tesselator.addVertexWithUV(1.0, 1.0, 0.0, minU, minV);
tesselator.addVertexWithUV(0.0, 1.0, 0.0, maxU, minV);
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.setNormal(0.0f, 0.0f, -1.0f);
tesselator.addVertexWithUV(0.0, percent, 0.0f - depth, maxU, minV);
tesselator.addVertexWithUV(1.0, percent, 0.0f - depth, minU, minV);
tesselator.addVertexWithUV(1.0, 0.0, 0.0f - depth, minU, maxV);
tesselator.addVertexWithUV(0.0, 0.0, 0.0f - depth, maxU, maxV);
tesselator.draw();
final float f5 = 0.5f * (maxU - minU) / width;
final float f6 = 0.5f * (maxV - minV) / height;
tesselator.startDrawingQuads();
tesselator.setNormal(-1.0f, 0.0f, 0.0f);
for (int k = 0; k < width; ++k) {
final float f7 = k / width;
final float f8 = maxU + (minU - maxU) * f7 - f5;
tesselator.addVertexWithUV(f7, 0.0, 0.0f - depth, f8, maxV);
tesselator.addVertexWithUV(f7, 0.0, 0.0, f8, maxV);
tesselator.addVertexWithUV(f7, 1.0, 0.0, f8, minV);
tesselator.addVertexWithUV(f7, 1.0, 0.0f - depth, f8, minV);
}
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.setNormal(1.0f, 0.0f, 0.0f);
for (int k = 0; k < width; ++k) {
final float f7 = k / width;
final float f8 = maxU + (minU - maxU) * f7 - f5;
final float f9 = f7 + 1.0f / width;
tesselator.addVertexWithUV(f9, 1.0, 0.0f - depth, f8, minV);
tesselator.addVertexWithUV(f9, 1.0, 0.0, f8, minV);
tesselator.addVertexWithUV(f9, 0.0, 0.0, f8, maxV);
tesselator.addVertexWithUV(f9, 0.0, 0.0f - depth, f8, maxV);
}
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.setNormal(0.0f, 1.0f, 0.0f);
for (int k = 0; k < height; ++k) {
final float f7 = k / height;
final float f8 = maxV + (minV - maxV) * f7 - f6;
final float f9 = f7 + 1.0f / height;
tesselator.addVertexWithUV(0.0, f9, 0.0, maxU, f8);
tesselator.addVertexWithUV(1.0, f9, 0.0, minU, f8);
tesselator.addVertexWithUV(1.0, f9, 0.0f - depth, minU, f8);
tesselator.addVertexWithUV(0.0, f9, 0.0f - depth, maxU, f8);
}
tesselator.draw();
tesselator.startDrawingQuads();
tesselator.setNormal(0.0f, -1.0f, 0.0f);
for (int k = 0; k < height; ++k) {
final float f7 = k / height;
final float f8 = maxV + (minV - maxV) * f7 - f6;
tesselator.addVertexWithUV(1.0, f7, 0.0, minU, f8);
tesselator.addVertexWithUV(0.0, f7, 0.0, maxU, f8);
tesselator.addVertexWithUV(0.0, f7, 0.0f - depth, maxU, f8);
tesselator.addVertexWithUV(1.0, f7, 0.0f - depth, minU, f8);
}
tesselator.draw();
}*/
}
@@ -28,5 +28,4 @@ public class DrinkManager {
public static IDrinkLiquid getLiquid(final FluidStack fluid) {
return getLiquid(fluid.getFluid());
}
}
@@ -103,39 +103,39 @@ public class ItemDrink extends ItemFood {
return this.getGlassware(stack).getName(liquidName);
}
// @Override
// @SideOnly(Side.CLIENT)
// public void registerIcons(final IIconRegister par1IconRegister) {
// for (final Glassware glassware : Glassware.values()) {
// glassware.registerIcons(par1IconRegister);
// }
// }
//
// @Override
// public IIcon getIcon(final ItemStack stack, final int pass) {
// final Glassware glass = this.getGlassware(stack);
// return (pass == 0) ? glass.glass : ((this.getFluid(stack) == null) ? glass.glass : glass.contents);
// }
//
// @Override
// @SideOnly(Side.CLIENT)
// public int getColorFromItemStack(final ItemStack stack, final int pass) {
// final FluidStack fluid = this.getFluid(stack);
// final IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
// return (pass == 0) ? 16777215 : ((drink == null) ? 16777215 : drink.getColour());
// }
//
// @Override
// public int getRenderPasses(final int metadata) {
// return 2;
// }
//
// @Override
// public ItemStack onEaten(final ItemStack p_77654_1_, final World p_77654_2_, final EntityPlayer p_77654_3_) {
// this.drain(p_77654_1_, 30, true);
// AlcoholEffect.makeDrunk(p_77654_3_, 2.1f);
// return p_77654_1_;
// }
/*@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister par1IconRegister) {
for (final Glassware glassware : Glassware.values()) {
glassware.registerIcons(par1IconRegister);
}
}
@Override
public IIcon getIcon(final ItemStack stack, final int pass) {
final Glassware glass = this.getGlassware(stack);
return (pass == 0) ? glass.glass : ((this.getFluid(stack) == null) ? glass.glass : glass.contents);
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(final ItemStack stack, final int pass) {
final FluidStack fluid = this.getFluid(stack);
final IDrinkLiquid drink = (fluid == null) ? null : DrinkManager.getLiquid(fluid.getFluid());
return (pass == 0) ? 16777215 : ((drink == null) ? 16777215 : drink.getColour());
}
@Override
public int getRenderPasses(final int metadata) {
return 2;
}
@Override
public ItemStack onEaten(final ItemStack p_77654_1_, final World p_77654_2_, final EntityPlayer p_77654_3_) {
this.drain(p_77654_1_, 30, true);
AlcoholEffect.makeDrunk(p_77654_3_, 2.1f);
return p_77654_1_;
}*/
@Override
public EnumAction getItemUseAction(final ItemStack itemStack) {
@@ -146,20 +146,20 @@ public class ItemDrink extends ItemFood {
}
}
// @Override
// @SideOnly(Side.CLIENT)
// public boolean requiresMultipleRenderPasses() {
// return true;
// }
/*@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
return true;
}*/
@Override
public int getMaxItemUseDuration(final ItemStack p_77626_1_) {
return 16;
}
// @Override
// public ItemStack onItemRightClick(final ItemStack p_77659_1_, final World p_77659_2_, final EntityPlayer p_77659_3_) {
// p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
// return p_77659_1_;
// }
/*@Override
public ItemStack onItemRightClick(final ItemStack p_77659_1_, final World p_77659_2_, final EntityPlayer p_77659_3_) {
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
return p_77659_1_;
}*/
}
@@ -21,7 +21,11 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -37,6 +41,19 @@ import java.util.List;
public abstract class BlockETDecorativeLeaves extends Block implements IItemModelRegister, IColoredBlock, IShearable {
private static final int VARIANTS_PER_BLOCK = 16;
private final int blockNumber;
public BlockETDecorativeLeaves(int blockNumber) {
super(Material.LEAVES);
this.blockNumber = blockNumber;
this.setCreativeTab(Tabs.tabArboriculture);
this.setHardness(0.2F);
this.setLightOpacity(1);
this.setSoundType(SoundType.PLANT);
String name = "leaves.decorative." + blockNumber;
setUnlocalizedName(name);
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
}
public static List<BlockETDecorativeLeaves> create() {
List<BlockETDecorativeLeaves> blocks = new ArrayList<>();
@@ -54,20 +71,6 @@ public abstract class BlockETDecorativeLeaves extends Block implements IItemMode
return blocks;
}
private final int blockNumber;
public BlockETDecorativeLeaves(int blockNumber) {
super(Material.LEAVES);
this.blockNumber = blockNumber;
this.setCreativeTab(Tabs.tabArboriculture);
this.setHardness(0.2F);
this.setLightOpacity(1);
this.setSoundType(SoundType.PLANT);
String name = "leaves.decorative." + blockNumber;
setUnlocalizedName(name);
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
}
public int getBlockNumber() {
return blockNumber;
}
@@ -156,7 +159,7 @@ 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.
*/
@@ -164,8 +167,8 @@ public abstract class BlockETDecorativeLeaves extends Block implements IItemMode
}
/**
* 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.
*/
@Override
public int damageDropped(IBlockState state) {
@@ -28,18 +28,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class BlockETDoor extends BlockDoor implements IBlockMetadata, ITileEntityProvider {
// private IIcon getFlippedIcon(final boolean upper, final boolean flip, final int tileMeta) {
// final DoorType type = getDoorType(tileMeta);
// return upper ? (flip ? type.iconDoorUpperFlip : type.iconDoorUpper) : (flip ? type.iconDoorLowerFlip : type.iconDoorLower);
// }
public static DoorType getDoorType(final int tileMeta) {
final int type = (tileMeta & 0xF00) >> 8;
if (type >= 0 && type < DoorType.values().length) {
return DoorType.values()[type];
}
return DoorType.Standard;
}
/*private IIcon getFlippedIcon(final boolean upper, final boolean flip, final int tileMeta) {
final DoorType type = getDoorType(tileMeta);
return upper ? (flip ? type.iconDoorUpperFlip : type.iconDoorUpper) : (flip ? type.iconDoorLowerFlip : type.iconDoorLower);
}*/
protected BlockETDoor() {
super(Material.WOOD);
@@ -49,144 +41,152 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata, ITileEntit
this.setRegistryName("door");
}
// @Override
// public IIcon getIcon(final int side, final int meta) {
// return DoorType.Standard.iconDoorLower;
// }
//
// @Override
// @SideOnly(Side.CLIENT)
// public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4, final int par5) {
// if (par5 != 1 && par5 != 0) {
// final int i1 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4);
// final int j1 = i1 & 0x3;
// final boolean flag = (i1 & 0x4) != 0x0;
// boolean flag2 = false;
// final boolean flag3 = (i1 & 0x8) != 0x0;
// if (flag) {
// if (j1 == 0 && par5 == 2) {
// flag2 = !flag2;
// }
// else if (j1 == 1 && par5 == 5) {
// flag2 = !flag2;
// }
// else if (j1 == 2 && par5 == 3) {
// flag2 = !flag2;
// }
// else if (j1 == 3 && par5 == 4) {
// flag2 = !flag2;
// }
// }
// else {
// if (j1 == 0 && par5 == 5) {
// flag2 = !flag2;
// }
// else if (j1 == 1 && par5 == 3) {
// flag2 = !flag2;
// }
// else if (j1 == 2 && par5 == 4) {
// flag2 = !flag2;
// }
// else if (j1 == 3 && par5 == 2) {
// flag2 = !flag2;
// }
// if ((i1 & 0x10) != 0x0) {
// flag2 = !flag2;
// }
// }
// int tileMeta = 0;
// if (flag3) {
// tileMeta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3 - 1, par4);
// }
// else {
// tileMeta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
// }
// return this.getFlippedIcon(flag3, flag2, tileMeta);
// }
// return DoorType.Standard.iconDoorLower;
// }
public static DoorType getDoorType(final int tileMeta) {
final int type = (tileMeta & 0xF00) >> 8;
if (type >= 0 && type < DoorType.values().length) {
return DoorType.values()[type];
}
return DoorType.Standard;
}
// @Override
// @SideOnly(Side.CLIENT)
// public void registerBlockIcons(final IIconRegister register) {
// for (final DoorType type : DoorType.values()) {
// type.iconDoorLower = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".lower");
// type.iconDoorUpper = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".upper");
// type.iconDoorLowerFlip = new IconFlipped(type.iconDoorLower, true, false);
// type.iconDoorUpperFlip = new IconFlipped(type.iconDoorUpper, true, false);
// }
// }
//
// @Override
// public int getRenderType() {
// return ExtraTrees.doorRenderId;
// }
//
// @Override
// @SideOnly(Side.CLIENT)
// public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
// final int par5 = 2;
// final int i1 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4);
// final int j1 = i1 & 0x3;
// final boolean flag = (i1 & 0x4) != 0x0;
// boolean flag2 = false;
// final boolean flag3 = (i1 & 0x8) != 0x0;
// if (flag) {
// if (j1 == 0 && par5 == 2) {
// flag2 = !flag2;
// }
// else if (j1 == 1 && par5 == 5) {
// flag2 = !flag2;
// }
// else if (j1 == 2 && par5 == 3) {
// flag2 = !flag2;
// }
// else if (j1 == 3 && par5 == 4) {
// flag2 = !flag2;
// }
// }
// else {
// if (j1 == 0 && par5 == 5) {
// flag2 = !flag2;
// }
// else if (j1 == 1 && par5 == 3) {
// flag2 = !flag2;
// }
// else if (j1 == 2 && par5 == 4) {
// flag2 = !flag2;
// }
// else if (j1 == 3 && par5 == 2) {
// flag2 = !flag2;
// }
// if ((i1 & 0x10) != 0x0) {
// flag2 = !flag2;
// }
// }
// if (flag3) {
// final int meta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3 - 1, par4);
// return WoodManager.getPlankType(meta & 0xFF).getColour();
// }
// final int meta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
// return WoodManager.getPlankType(meta & 0xFF).getColour();
// }
/*@Override
public IIcon getIcon(final int side, final int meta) {
return DoorType.Standard.iconDoorLower;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4, final int par5) {
if (par5 != 1 && par5 != 0) {
final int i1 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4);
final int j1 = i1 & 0x3;
final boolean flag = (i1 & 0x4) != 0x0;
boolean flag2 = false;
final boolean flag3 = (i1 & 0x8) != 0x0;
if (flag) {
if (j1 == 0 && par5 == 2) {
flag2 = !flag2;
}
else if (j1 == 1 && par5 == 5) {
flag2 = !flag2;
}
else if (j1 == 2 && par5 == 3) {
flag2 = !flag2;
}
else if (j1 == 3 && par5 == 4) {
flag2 = !flag2;
}
}
else {
if (j1 == 0 && par5 == 5) {
flag2 = !flag2;
}
else if (j1 == 1 && par5 == 3) {
flag2 = !flag2;
}
else if (j1 == 2 && par5 == 4) {
flag2 = !flag2;
}
else if (j1 == 3 && par5 == 2) {
flag2 = !flag2;
}
if ((i1 & 0x10) != 0x0) {
flag2 = !flag2;
}
}
int tileMeta = 0;
if (flag3) {
tileMeta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3 - 1, par4);
}
else {
tileMeta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
}
return this.getFlippedIcon(flag3, flag2, tileMeta);
}
return DoorType.Standard.iconDoorLower;
}*/
/*@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister register) {
for (final DoorType type : DoorType.values()) {
type.iconDoorLower = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".lower");
type.iconDoorUpper = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".upper");
type.iconDoorLowerFlip = new IconFlipped(type.iconDoorLower, true, false);
type.iconDoorUpperFlip = new IconFlipped(type.iconDoorUpper, true, false);
}
}
@Override
public int getRenderType() {
return ExtraTrees.doorRenderId;
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
final int par5 = 2;
final int i1 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4);
final int j1 = i1 & 0x3;
final boolean flag = (i1 & 0x4) != 0x0;
boolean flag2 = false;
final boolean flag3 = (i1 & 0x8) != 0x0;
if (flag) {
if (j1 == 0 && par5 == 2) {
flag2 = !flag2;
}
else if (j1 == 1 && par5 == 5) {
flag2 = !flag2;
}
else if (j1 == 2 && par5 == 3) {
flag2 = !flag2;
}
else if (j1 == 3 && par5 == 4) {
flag2 = !flag2;
}
}
else {
if (j1 == 0 && par5 == 5) {
flag2 = !flag2;
}
else if (j1 == 1 && par5 == 3) {
flag2 = !flag2;
}
else if (j1 == 2 && par5 == 4) {
flag2 = !flag2;
}
else if (j1 == 3 && par5 == 2) {
flag2 = !flag2;
}
if ((i1 & 0x10) != 0x0) {
flag2 = !flag2;
}
}
if (flag3) {
final int meta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3 - 1, par4);
return WoodManager.getPlankType(meta & 0xFF).getColour();
}
final int meta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
return WoodManager.getPlankType(meta & 0xFF).getColour();
}*/
/*public int getFullMetadata(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
final int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
final boolean flag = (l & 0x8) != 0x0;
int i1;
int j1;
if (flag) {
i1 = par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4);
j1 = l;
}
else {
i1 = l;
j1 = par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4);
}
final boolean flag2 = (j1 & 0x1) != 0x0;
return (i1 & 0x7) | (flag ? 8 : 0) | (flag2 ? 16 : 0);
}*/
// public int getFullMetadata(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
// final int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
// final boolean flag = (l & 0x8) != 0x0;
// int i1;
// int j1;
// if (flag) {
// i1 = par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4);
// j1 = l;
// }
// else {
// i1 = l;
// j1 = par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4);
// }
// final boolean flag2 = (j1 & 0x1) != 0x0;
// return (i1 & 0x7) | (flag ? 8 : 0) | (flag2 ? 16 : 0);
// }
@SideOnly(Side.CLIENT)
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
@@ -257,7 +257,6 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata, ITileEntit
}
}
@Override
public boolean isWood(IBlockAccess world, BlockPos pos) {
return true;
@@ -282,5 +281,4 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata, ITileEntit
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return BlockMetadata.getPickBlock(world, pos);
}
}
@@ -2,74 +2,74 @@ package binnie.extratrees.block;
public class DoorBlockRenderer //implements ISimpleBlockRenderingHandler
{
// @Override
// public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
// }
//
// @Override
// public boolean renderWorldBlock(final IBlockAccess world, final int par2, final int par3, final int par4, final Block par1Block, final int modelId, final RenderBlocks renderer) {
// final int c = par1Block.colorMultiplier(renderer.blockAccess, par2, par3, par4);
// final float c2 = (c >> 16 & 0xFF) / 255.0f;
// final float c3 = (c >> 8 & 0xFF) / 255.0f;
// final float c4 = (c & 0xFF) / 255.0f;
// final Tessellator tessellator = Tessellator.instance;
// final int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4);
// if ((l & 0x8) != 0x0) {
// if (renderer.blockAccess.getBlock(par2, par3 - 1, par4) != par1Block) {
// return false;
// }
// }
// else if (renderer.blockAccess.getBlock(par2, par3 + 1, par4) != par1Block) {
// return false;
// }
// boolean flag = false;
// final float f = 0.5f;
// final float f2 = 1.0f;
// final float f3 = 0.8f;
// final float f4 = 0.6f;
// final int i1 = par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4);
// tessellator.setBrightness((renderer.renderMinY > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3 - 1, par4));
// tessellator.setColorOpaque_F(f * c2, f * c3, f * c4);
// renderer.renderFaceYNeg(par1Block, par2, par3, par4, renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 0));
// flag = true;
// tessellator.setBrightness((renderer.renderMaxY < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3 + 1, par4));
// tessellator.setColorOpaque_F(f2 * c2, f2 * c3, f2 * c4);
// renderer.renderFaceYPos(par1Block, par2, par3, par4, renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 1));
// flag = true;
// tessellator.setBrightness((renderer.renderMinZ > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4 - 1));
// tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
// IIcon icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 2);
// renderer.renderFaceZNeg(par1Block, par2, par3, par4, icon);
// flag = true;
// renderer.flipTexture = false;
// tessellator.setBrightness((renderer.renderMaxZ < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4 + 1));
// tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
// icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 3);
// renderer.renderFaceZPos(par1Block, par2, par3, par4, icon);
// flag = true;
// renderer.flipTexture = false;
// tessellator.setBrightness((renderer.renderMinX > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2 - 1, par3, par4));
// tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
// icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 4);
// renderer.renderFaceXNeg(par1Block, par2, par3, par4, icon);
// flag = true;
// renderer.flipTexture = false;
// tessellator.setBrightness((renderer.renderMaxX < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2 + 1, par3, par4));
// tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
// icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 5);
// renderer.renderFaceXPos(par1Block, par2, par3, par4, icon);
// flag = true;
// renderer.flipTexture = false;
// return flag;
// }
//
// @Override
// public boolean shouldRender3DInInventory(final int i) {
// return false;
// }
//
// @Override
// public int getRenderId() {
// return ExtraTrees.doorRenderId;
// }
/*@Override
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
}
@Override
public boolean renderWorldBlock(final IBlockAccess world, final int par2, final int par3, final int par4, final Block par1Block, final int modelId, final RenderBlocks renderer) {
final int c = par1Block.colorMultiplier(renderer.blockAccess, par2, par3, par4);
final float c2 = (c >> 16 & 0xFF) / 255.0f;
final float c3 = (c >> 8 & 0xFF) / 255.0f;
final float c4 = (c & 0xFF) / 255.0f;
final Tessellator tessellator = Tessellator.instance;
final int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4);
if ((l & 0x8) != 0x0) {
if (renderer.blockAccess.getBlock(par2, par3 - 1, par4) != par1Block) {
return false;
}
}
else if (renderer.blockAccess.getBlock(par2, par3 + 1, par4) != par1Block) {
return false;
}
boolean flag = false;
final float f = 0.5f;
final float f2 = 1.0f;
final float f3 = 0.8f;
final float f4 = 0.6f;
final int i1 = par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4);
tessellator.setBrightness((renderer.renderMinY > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3 - 1, par4));
tessellator.setColorOpaque_F(f * c2, f * c3, f * c4);
renderer.renderFaceYNeg(par1Block, par2, par3, par4, renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 0));
flag = true;
tessellator.setBrightness((renderer.renderMaxY < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3 + 1, par4));
tessellator.setColorOpaque_F(f2 * c2, f2 * c3, f2 * c4);
renderer.renderFaceYPos(par1Block, par2, par3, par4, renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 1));
flag = true;
tessellator.setBrightness((renderer.renderMinZ > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4 - 1));
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
IIcon icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 2);
renderer.renderFaceZNeg(par1Block, par2, par3, par4, icon);
flag = true;
renderer.flipTexture = false;
tessellator.setBrightness((renderer.renderMaxZ < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4 + 1));
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 3);
renderer.renderFaceZPos(par1Block, par2, par3, par4, icon);
flag = true;
renderer.flipTexture = false;
tessellator.setBrightness((renderer.renderMinX > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2 - 1, par3, par4));
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 4);
renderer.renderFaceXNeg(par1Block, par2, par3, par4, icon);
flag = true;
renderer.flipTexture = false;
tessellator.setBrightness((renderer.renderMaxX < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2 + 1, par3, par4));
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 5);
renderer.renderFaceXPos(par1Block, par2, par3, par4, icon);
flag = true;
renderer.flipTexture = false;
return flag;
}
@Override
public boolean shouldRender3DInInventory(final int i) {
return false;
}
@Override
public int getRenderId() {
return ExtraTrees.doorRenderId;
}*/
}
@@ -9,11 +9,11 @@ public enum DoorType {
Full("full");
String id;
// IIcon iconDoorLower;
// IIcon iconDoorUpper;
// IIcon iconDoorLowerFlip;
// IIcon iconDoorUpperFlip;
// IIcon iconItem;
//IIcon iconDoorLower;
//IIcon iconDoorUpper;
//IIcon iconDoorLowerFlip;
//IIcon iconDoorUpperFlip;
//IIcon iconItem;
DoorType(final String iconName) {
this.id = iconName;
@@ -61,6 +61,13 @@ public enum EnumETLog implements IWoodType {
this.plank = plank;
}
public static EnumETLog byMetadata(int meta) {
if (meta < 0 || meta >= VALUES.length) {
meta = 0;
}
return VALUES[meta];
}
@Override
public String getName() {
return name().toLowerCase();
@@ -147,12 +154,5 @@ public enum EnumETLog implements IWoodType {
public int getMetadata() {
return ordinal();
}
public static EnumETLog byMetadata(int meta) {
if (meta < 0 || meta >= VALUES.length) {
meta = 0;
}
return VALUES[meta];
}
}
@@ -38,7 +38,7 @@ public enum EnumShrubLog implements IWoodType {
}
return 0.15F;
}
@Override
public String getPlankTexture() {
return "blocks/planks_oak";
@@ -12,7 +12,7 @@ public enum FruitPod {
FruitPod() {
}
public String getModelName() {
return name().toLowerCase(Locale.ENGLISH);
}
@@ -2,89 +2,89 @@ package binnie.extratrees.block;
public class GateItemRenderer //implements IItemRenderer
{
// private void renderStairBlock(final RenderBlocks renderBlocks, final ItemStack item, final float f, final float g, final float h) {
// final Tessellator tessellator = Tessellator.instance;
// final Block block = ((ItemBlock) item.getItem()).field_150939_a;
// final IIcon textureIndex = WoodManager.getPlankType(item.getItemDamage()).getIcon();
// for (int k = 0; k < 3; ++k) {
// float f2 = 0.0625f;
// if (k == 0) {
// renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 0.0, 0.5f + f2, 1.0, f2 * 2.0f);
// }
// if (k == 1) {
// renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 1.0f - f2 * 2.0f, 0.5f + f2, 1.0, 1.0);
// }
// f2 = 0.0625f;
// if (k == 2) {
// renderBlocks.setRenderBounds(0.5f - f2, 0.5, 0.0, 0.5f + f2, 1.0f - f2, 1.0);
// }
// GlStateManager.translate(-0.5f, -0.5f, -0.5f);
// tessellator.startDrawingQuads();
// tessellator.setNormal(0.0f, -1.0f, 0.0f);
// renderBlocks.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 0, item.getItemDamage()));
// tessellator.draw();
// tessellator.startDrawingQuads();
// tessellator.setNormal(0.0f, 1.0f, 0.0f);
// renderBlocks.renderFaceYPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 1, item.getItemDamage()));
// tessellator.draw();
// tessellator.startDrawingQuads();
// tessellator.setNormal(0.0f, 0.0f, -1.0f);
// renderBlocks.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 2, item.getItemDamage()));
// tessellator.draw();
// tessellator.startDrawingQuads();
// tessellator.setNormal(0.0f, 0.0f, 1.0f);
// renderBlocks.renderFaceZPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 3, item.getItemDamage()));
// tessellator.draw();
// tessellator.startDrawingQuads();
// tessellator.setNormal(-1.0f, 0.0f, 0.0f);
// renderBlocks.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 4, item.getItemDamage()));
// tessellator.draw();
// tessellator.startDrawingQuads();
// tessellator.setNormal(1.0f, 0.0f, 0.0f);
// renderBlocks.renderFaceXPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 5, item.getItemDamage()));
// tessellator.draw();
// GlStateManager.translate(0.5f, 0.5f, 0.5f);
// }
// }
/*private void renderStairBlock(final RenderBlocks renderBlocks, final ItemStack item, final float f, final float g, final float h) {
final Tessellator tessellator = Tessellator.instance;
final Block block = ((ItemBlock) item.getItem()).field_150939_a;
final IIcon textureIndex = WoodManager.getPlankType(item.getItemDamage()).getIcon();
for (int k = 0; k < 3; ++k) {
float f2 = 0.0625f;
if (k == 0) {
renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 0.0, 0.5f + f2, 1.0, f2 * 2.0f);
}
if (k == 1) {
renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 1.0f - f2 * 2.0f, 0.5f + f2, 1.0, 1.0);
}
f2 = 0.0625f;
if (k == 2) {
renderBlocks.setRenderBounds(0.5f - f2, 0.5, 0.0, 0.5f + f2, 1.0f - f2, 1.0);
}
GlStateManager.translate(-0.5f, -0.5f, -0.5f);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0f, -1.0f, 0.0f);
renderBlocks.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 0, item.getItemDamage()));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0f, 1.0f, 0.0f);
renderBlocks.renderFaceYPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 1, item.getItemDamage()));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0f, 0.0f, -1.0f);
renderBlocks.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 2, item.getItemDamage()));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0f, 0.0f, 1.0f);
renderBlocks.renderFaceZPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 3, item.getItemDamage()));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
renderBlocks.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 4, item.getItemDamage()));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0f, 0.0f, 0.0f);
renderBlocks.renderFaceXPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 5, item.getItemDamage()));
tessellator.draw();
GlStateManager.translate(0.5f, 0.5f, 0.5f);
}
}
// @Override
// public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
// switch (type) {
// case ENTITY: {
// return true;
// }
// case EQUIPPED: {
// return true;
// }
// case INVENTORY: {
// return true;
// }
// default: {
// return false;
// }
// }
// }
@Override
public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
switch (type) {
case ENTITY: {
return true;
}
case EQUIPPED: {
return true;
}
case INVENTORY: {
return true;
}
default: {
return false;
}
}
}
// @Override
// public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
// return true;
// }
//
// @Override
// public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
// switch (type) {
// case ENTITY: {
// this.renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
// break;
// }
// case EQUIPPED: {
// this.renderStairBlock((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
// break;
// }
// case INVENTORY: {
// this.renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
// break;
// }
// }
// }
@Override
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
switch (type) {
case ENTITY: {
this.renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
break;
}
case EQUIPPED: {
this.renderStairBlock((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
break;
}
case INVENTORY: {
this.renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
break;
}
}
}*/
}
@@ -13,10 +13,10 @@ public interface IPlankType extends IDesignMaterial {
String getDescription();
IWoodType getWoodType();
@SideOnly(Side.CLIENT)
TextureAtlasSprite getSprite();
@SideOnly(Side.CLIENT)
void registerSprites(TextureMap map);
}
@@ -12,13 +12,13 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemETDoor extends ItemMetadata {
// @Override
// @SideOnly(Side.CLIENT)
// public void registerIcons(final IIconRegister register) {
// for (final DoorType type : DoorType.values()) {
// type.iconItem = ExtraTrees.proxy.getIcon(register, "door." + type.id);
// }
// }
/*@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister register) {
for (final DoorType type : DoorType.values()) {
type.iconItem = ExtraTrees.proxy.getIcon(register, "door." + type.id);
}
}*/
public ItemETDoor(final Block block) {
super(block);
@@ -26,82 +26,82 @@ public class ItemETDoor extends ItemMetadata {
this.setCreativeTab(CreativeTabs.REDSTONE);
}
public static void placeDoorBlock(final World par0World, final int par1, final int par2, final int par3, final int par4, final Block par5Block, final ItemStack item, final EntityPlayer player) {
/*byte b0 = 0;
byte b2 = 0;
if (par4 == 0) {
b2 = 1;
}
if (par4 == 1) {
b0 = -1;
}
if (par4 == 2) {
b2 = -1;
}
if (par4 == 3) {
b0 = 1;
}
final int i1 = (par0World.isBlockNormalCubeDefault(par1 - b0, par2, par3 - b2, false) ? 1 : 0) + (par0World.isBlockNormalCubeDefault(par1 - b0, par2 + 1, par3 - b2, false) ? 1 : 0);
final int j1 = (par0World.isBlockNormalCubeDefault(par1 + b0, par2, par3 + b2, false) ? 1 : 0) + (par0World.isBlockNormalCubeDefault(par1 + b0, par2 + 1, par3 + b2, false) ? 1 : 0);
final boolean flag = par0World.getBlock(par1 - b0, par2, par3 - b2) == par5Block || par0World.getBlock(par1 - b0, par2 + 1, par3 - b2) == par5Block;
final boolean flag2 = par0World.getBlock(par1 + b0, par2, par3 + b2) == par5Block || par0World.getBlock(par1 + b0, par2 + 1, par3 + b2) == par5Block;
boolean flag3 = false;
if (flag && !flag2) {
flag3 = true;
}
else if (j1 > i1) {
flag3 = true;
}
par0World.setBlock(par1, par2, par3, par5Block, par4, 2);
par0World.setBlock(par1, par2 + 1, par3, par5Block, 0x8 | (flag3 ? 1 : 0), 2);
if (par0World.getBlock(par1, par2, par3) == par5Block) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(par0World, par1, par2, par3);
if (tile != null) {
tile.setTileMetadata(TileEntityMetadata.getItemDamage(item), false);
}
par5Block.onBlockPlacedBy(par0World, par1, par2, par3, player, item);
par5Block.onPostBlockPlaced(par0World, par1, par2, par3, par4);
}
par0World.notifyBlocksOfNeighborChange(par1, par2, par3, par5Block);
par0World.notifyBlocksOfNeighborChange(par1, par2 + 1, par3, par5Block);*/
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
// if (par7 != 1) {
// return false;
// }
// ++par5;
// final Block block = ExtraTrees.blockDoor;
// if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) {
// return false;
// }
// if (!block.canPlaceBlockAt(par3World, pos)) {
// return false;
// }
// final int i1 = MathHelper.floor((par2EntityPlayer.rotationYaw + 180.0f) * 4.0f / 360.0f - 0.5) & 0x3;
// placeDoorBlock(par3World, par4, par5, par6, i1, block, par1ItemStack, par2EntityPlayer);
// par1ItemStack.shrink(1);
/*if (par7 != 1) {
return false;
}
++par5;
final Block block = ExtraTrees.blockDoor;
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) {
return false;
}
if (!block.canPlaceBlockAt(par3World, pos)) {
return false;
}
final int i1 = MathHelper.floor((par2EntityPlayer.rotationYaw + 180.0f) * 4.0f / 360.0f - 0.5) & 0x3;
placeDoorBlock(par3World, par4, par5, par6, i1, block, par1ItemStack, par2EntityPlayer);
par1ItemStack.shrink(1);*/
return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
public static void placeDoorBlock(final World par0World, final int par1, final int par2, final int par3, final int par4, final Block par5Block, final ItemStack item, final EntityPlayer player) {
// byte b0 = 0;
// byte b2 = 0;
// if (par4 == 0) {
// b2 = 1;
// }
// if (par4 == 1) {
// b0 = -1;
// }
// if (par4 == 2) {
// b2 = -1;
// }
// if (par4 == 3) {
// b0 = 1;
// }
//
// final int i1 = (par0World.isBlockNormalCubeDefault(par1 - b0, par2, par3 - b2, false) ? 1 : 0) + (par0World.isBlockNormalCubeDefault(par1 - b0, par2 + 1, par3 - b2, false) ? 1 : 0);
// final int j1 = (par0World.isBlockNormalCubeDefault(par1 + b0, par2, par3 + b2, false) ? 1 : 0) + (par0World.isBlockNormalCubeDefault(par1 + b0, par2 + 1, par3 + b2, false) ? 1 : 0);
// final boolean flag = par0World.getBlock(par1 - b0, par2, par3 - b2) == par5Block || par0World.getBlock(par1 - b0, par2 + 1, par3 - b2) == par5Block;
// final boolean flag2 = par0World.getBlock(par1 + b0, par2, par3 + b2) == par5Block || par0World.getBlock(par1 + b0, par2 + 1, par3 + b2) == par5Block;
// boolean flag3 = false;
// if (flag && !flag2) {
// flag3 = true;
// }
// else if (j1 > i1) {
// flag3 = true;
// }
// par0World.setBlock(par1, par2, par3, par5Block, par4, 2);
// par0World.setBlock(par1, par2 + 1, par3, par5Block, 0x8 | (flag3 ? 1 : 0), 2);
// if (par0World.getBlock(par1, par2, par3) == par5Block) {
// final TileEntityMetadata tile = TileEntityMetadata.getTile(par0World, par1, par2, par3);
// if (tile != null) {
// tile.setTileMetadata(TileEntityMetadata.getItemDamage(item), false);
// }
// par5Block.onBlockPlacedBy(par0World, par1, par2, par3, player, item);
// par5Block.onPostBlockPlaced(par0World, par1, par2, par3, par4);
// }
// par0World.notifyBlocksOfNeighborChange(par1, par2, par3, par5Block);
// par0World.notifyBlocksOfNeighborChange(par1, par2 + 1, par3, par5Block);
/*@Override
@SideOnly(Side.CLIENT)
public int getSpriteNumber() {
return 1;
}
// @Override
// @SideOnly(Side.CLIENT)
// public int getSpriteNumber() {
// return 1;
// }
//
// @SideOnly(Side.CLIENT)
// @Override
// public IIcon getIconFromDamage(final int par1) {
// final DoorType type = BlockETDoor.getDoorType(par1);
// return type.iconItem;
// }
//
// @Override
// @SideOnly(Side.CLIENT)
// public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) {
// return WoodManager.getPlankType((par1ItemStack.isEmpty()) ? 0 : (par1ItemStack.getItemDamage() & 0xFF)).getColour();
// }
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconFromDamage(final int par1) {
final DoorType type = BlockETDoor.getDoorType(par1);
return type.iconItem;
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) {
return WoodManager.getPlankType((par1ItemStack.isEmpty()) ? 0 : (par1ItemStack.getItemDamage() & 0xFF)).getColour();
}*/
}
@@ -6,11 +6,26 @@ import binnie.core.Mods;
import binnie.core.block.ItemMetadata;
import binnie.core.liquid.ILiquidType;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.block.decor.*;
import binnie.extratrees.block.wood.*;
import binnie.extratrees.block.decor.BlockHedge;
import binnie.extratrees.block.decor.BlockMultiFence;
import binnie.extratrees.block.decor.FenceType;
import binnie.extratrees.block.decor.MultiFenceRecipeEmbedded;
import binnie.extratrees.block.decor.MultiFenceRecipeSize;
import binnie.extratrees.block.decor.MultiFenceRecipeSolid;
import binnie.extratrees.block.wood.BlockETFence;
import binnie.extratrees.block.wood.BlockETLog;
import binnie.extratrees.block.wood.BlockETPlank;
import binnie.extratrees.block.wood.BlockETSlab;
import binnie.extratrees.block.wood.BlockShrubLog;
import binnie.extratrees.block.wood.ItemBlockETWood;
import binnie.extratrees.block.wood.ItemETSlab;
import binnie.extratrees.genetics.ETTreeDefinition;
import binnie.extratrees.item.ExtraTreeLiquid;
import forestry.api.arboriculture.*;
import forestry.api.arboriculture.EnumVanillaWoodType;
import forestry.api.arboriculture.IWoodAccess;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.recipes.RecipeManagers;
import forestry.arboriculture.WoodAccess;
import forestry.arboriculture.blocks.BlockForestryFenceGate;
@@ -35,9 +50,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ModuleBlocks implements IInitializable {
// public static int hedgeRenderID;
//public static int hedgeRenderID;
public List<BlockETLog> logs;
public List<BlockETLog> logsFireproof;
@@ -62,6 +76,20 @@ public class ModuleBlocks implements IInitializable {
//????
public Block blockBranch;
private static void addRecipeAtPosition(int position, IRecipe recipe) {
CraftingManager manager = CraftingManager.getInstance();
manager.getRecipeList().add(position, recipe);
}
private static void registerOreDictWildcard(String oreDictName, Block block) {
OreDictionary.registerOre(oreDictName, new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
}
public static ItemStack getDecorativeLeaves(String speciesUid) {
ItemStack itemStack = ExtraTrees.blocks().speciesToLeavesDecorative.get(speciesUid);
return itemStack.copy();
}
@Override
public void preInit() {
PlankType.setup();
@@ -227,7 +255,7 @@ public class ModuleBlocks implements IInitializable {
speciesToLeavesDecorative.put(speciesUid, new ItemStack(leaves, 1, meta));
}
}
shrubLog = new BlockShrubLog();
ExtraTrees.proxy.registerBlock(shrubLog, new ItemBlockETWood(shrubLog));
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, false, shrubLog.getStateFromMeta(0), new ItemStack(shrubLog, 1, 0));
@@ -236,9 +264,9 @@ public class ModuleBlocks implements IInitializable {
@Override
public void init() {
// ExtraTrees.doorRenderId = RenderingRegistry.getNextAvailableRenderId();
// RenderingRegistry.registerBlockHandler(new DoorBlockRenderer());
// RenderingRegistry.registerBlockHandler(new HedgeRenderer());
// ExtraTrees.doorRenderId = RenderingRegistry.getNextAvailableRenderId();
// RenderingRegistry.registerBlockHandler(new DoorBlockRenderer());
// RenderingRegistry.registerBlockHandler(new HedgeRenderer());
RecipeSorter.register("extratrees:multifence", MultiFenceRecipeSize.class, RecipeSorter.Category.SHAPED, "");
RecipeSorter.register("extratrees:multifence2", MultiFenceRecipeEmbedded.class, RecipeSorter.Category.SHAPED, "");
RecipeSorter.register("extratrees:multifence3", MultiFenceRecipeSolid.class, RecipeSorter.Category.SHAPED, "");
@@ -255,10 +283,11 @@ public class ModuleBlocks implements IInitializable {
stairs.setCount(4);
RecipeUtil.addPriorityRecipe(stairs.copy(),
"# ",
"## ",
"###",
'#', planks.copy());
"# ",
"## ",
"###",
'#', planks.copy()
);
slabs.setCount(6);
RecipeUtil.addPriorityRecipe(slabs.copy(), "###", '#', planks.copy());
@@ -298,18 +327,4 @@ public class ModuleBlocks implements IInitializable {
public void addSqueezer(final IWoodType log, final ILiquidType liquid, final int amount) {
this.addSqueezer(log, liquid, amount, 0.5f);
}
private static void addRecipeAtPosition(int position, IRecipe recipe) {
CraftingManager manager = CraftingManager.getInstance();
manager.getRecipeList().add(position, recipe);
}
private static void registerOreDictWildcard(String oreDictName, Block block) {
OreDictionary.registerOre(oreDictName, new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
}
public static ItemStack getDecorativeLeaves(String speciesUid) {
ItemStack itemStack = ExtraTrees.blocks().speciesToLeavesDecorative.get(speciesUid);
return itemStack.copy();
}
}
@@ -3,7 +3,11 @@ package binnie.extratrees.block;
import binnie.Constants;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.api.CarpentryManager;
import forestry.api.arboriculture.*;
import forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumVanillaWoodType;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
@@ -69,9 +73,8 @@ public class PlankType {
Banana(0);
public static final ExtraTreePlanks[] VALUES = values();
private EnumETLog woodType;
private final int color;
private EnumETLog woodType;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite sprite;
@@ -118,15 +121,15 @@ public class PlankType {
Banana.setWoodType(EnumETLog.Banana);
}
public void setWoodType(EnumETLog woodType) {
this.woodType = woodType;
}
@Override
public EnumETLog getWoodType() {
return woodType;
}
public void setWoodType(EnumETLog woodType) {
this.woodType = woodType;
}
@Override
public String getName() {
return ExtraTrees.proxy.localise("block.planks." + this.toString().toLowerCase());
@@ -156,13 +159,13 @@ public class PlankType {
public ItemStack getStack() {
return getStack(true);
}
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getSprite() {
return sprite;
}
@SideOnly(Side.CLIENT)
@Override
public void registerSprites(TextureMap map) {
@@ -207,13 +210,13 @@ public class PlankType {
public String getPlankTextureName() {
return "minecraft:blocks/planks_" + name().toLowerCase();
}
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getSprite() {
return sprite;
}
@SideOnly(Side.CLIENT)
@Override
public void registerSprites(TextureMap map) {
@@ -240,15 +243,15 @@ public class PlankType {
return TreeManager.woodAccess.getStack(woodType, WoodBlockKind.PLANKS, fireproof);
}
// @Override
// public IIcon getIcon() {
// if (this.getStack() != null) {
// final int meta = this.getStack().getItemDamage();
// final Block block = Blocks.planks;
// return block.getIcon(2, meta);
// }
// return null;
// }
/*@Override
public IIcon getIcon() {
if (this.getStack() != null) {
final int meta = this.getStack().getItemDamage();
final Block block = Blocks.planks;
return block.getIcon(2, meta);
}
return null;
}*/
}
public enum ForestryPlanks implements IPlankType, IFenceProvider {
@@ -306,13 +309,13 @@ public class PlankType {
public String getDescription() {
return ExtraTrees.proxy.localise("block.planks.forestry." + this.toString().toLowerCase() + ".desc");
}
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getSprite() {
return sprite;
}
@SideOnly(Side.CLIENT)
@Override
public void registerSprites(TextureMap map) {
@@ -339,15 +342,15 @@ public class PlankType {
return getStack(true);
}
// @Override
// public IIcon getIcon() {
// if (this.getStack() != null) {
// final int meta = this.getStack().getItemDamage();
// final Block block = ((ItemBlock) this.getStack().getItem()).field_150939_a;
// return block.getIcon(2, meta);
// }
// return null;
// }
/*@Override
public IIcon getIcon() {
if (this.getStack() != null) {
final int meta = this.getStack().getItemDamage();
final Block block = ((ItemBlock) this.getStack().getItem()).field_150939_a;
return block.getIcon(2, meta);
}
return null;
}*/
@Override
public ItemStack getFence() {
@@ -410,14 +413,14 @@ public class PlankType {
}
}
// @Override
// public IIcon getIcon() {
// if (this.getStack() != null) {
// final int meta = this.getStack().getItemDamage();
// final Block block = ((ItemBlock) this.getStack().getItem()).field_150939_a;
// return block.getIcon(2, meta);
// }
// return null;
// }
@Override
public IIcon getIcon() {
if (this.getStack() != null) {
final int meta = this.getStack().getItemDamage();
final Block block = ((ItemBlock) this.getStack().getItem()).field_150939_a;
return block.getIcon(2, meta);
}
return null;
}
}*/
}
@@ -16,10 +16,16 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WoodManager {
public static Map<IPlankType, ItemStack> PLANKS;
public static String getDisplayName(IWoodTyped wood, IWoodType woodType) {
WoodBlockKind blockKind = wood.getBlockKind();
@@ -133,18 +139,18 @@ public class WoodManager {
Collections.addAll(list, PlankType.VanillaPlanks.values());
return list;
}
public static Map<IPlankType, ItemStack> getAllPlankStacks(){
if(PLANKS == null){
public static Map<IPlankType, ItemStack> getAllPlankStacks() {
if (PLANKS == null) {
PLANKS = new HashMap<>();
for(IPlankType type : getAllPlankTypes()){
for (IPlankType type : getAllPlankTypes()) {
PLANKS.put(type, type.getStack(false));
}
}
return PLANKS;
}
public static Collection<ItemStack> getAllPlankStacks(IPlankType type){
public static Collection<ItemStack> getAllPlankStacks(IPlankType type) {
Map<IPlankType, ItemStack> planks = new HashMap<>(getAllPlankStacks());
planks.remove(type);
return planks.values();
@@ -34,6 +34,17 @@ public class BlockHedge extends Block implements IBlockFence, IColoredBlock {
this.setRegistryName("hedge");
}
@SideOnly(Side.CLIENT)
public static int getColor(int meta) {
EnumLeafType type = EnumLeafType.values()[meta % 6];
if (type == EnumLeafType.CONIFERS) {
return ColorizerFoliage.getFoliageColorPine();
}
final double d0 = 0.5;
final double d2 = 1.0;
return ColorizerFoliage.getFoliageColor(d0, d2);
}
@Override
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
final boolean connectNegZ = this.canConnectFenceTo(world, pos.north());
@@ -108,16 +119,16 @@ public class BlockHedge extends Block implements IBlockFence, IColoredBlock {
return false;
}
@Override
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
return false;
}
/*@Override
public int getRenderType() {
return ModuleBlocks.hedgeRenderID;
}*/
@Override
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
return false;
}
public boolean canConnectFenceTo(IBlockAccess world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
@@ -153,10 +164,6 @@ public class BlockHedge extends Block implements IBlockFence, IColoredBlock {
return EnumLeafType.values()[meta % 8];
}
private boolean isFull(final int meta) {
return meta / 8 > 0;
}
/*@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int p_149691_1_, final int meta) {
@@ -164,6 +171,10 @@ public class BlockHedge extends Block implements IBlockFence, IColoredBlock {
return ForestryAPI.textureManager.getIcon(this.isFull(meta) ? type.plainUID : type.fancyUID);
}*/
private boolean isFull(final int meta) {
return meta / 8 > 0;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final Item item, final CreativeTabs tab, final NonNullList<ItemStack> list) {
@@ -179,15 +190,4 @@ public class BlockHedge extends Block implements IBlockFence, IColoredBlock {
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
return getColor(getMetaFromState(state));
}
@SideOnly(Side.CLIENT)
public static int getColor(int meta) {
EnumLeafType type = EnumLeafType.values()[meta % 6];
if (type == EnumLeafType.CONIFERS) {
return ColorizerFoliage.getFoliageColorPine();
}
final double d0 = 0.5;
final double d2 = 1.0;
return ColorizerFoliage.getFoliageColor(d0, d2);
}
}
@@ -158,7 +158,7 @@ public class BlockMultiFence extends BlockFence implements IBlockMetadata, IStat
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return BlockMetadata.getPickBlock(world, pos);
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, new IProperty[]{NORTH, EAST, WEST, SOUTH}, new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS});
@@ -176,19 +176,18 @@ public class BlockMultiFence extends BlockFence implements IBlockMetadata, IStat
itemList.add(WoodManager.getFence(PlankType.VanillaPlanks.SPRUCE, PlankType.VanillaPlanks.BIRCH, type, 1));
}
}
@SideOnly(Side.CLIENT)
@Nullable
public TextureAtlasSprite getSprite(int meta, boolean secondary){
public TextureAtlasSprite getSprite(int meta, boolean secondary) {
FenceDescription desc = getDescription(meta);
if(desc != null){
if (desc != null) {
IPlankType type = secondary ? desc.getSecondaryPlankType() : desc.getPlankType();
return type.getSprite();
}
return null;
}
@Override
public String getDisplayName(ItemStack itemStack) {
int meta = TileEntityMetadata.getItemDamage(itemStack);
@@ -210,9 +209,10 @@ public class BlockMultiFence extends BlockFence implements IBlockMetadata, IStat
ResourceLocation registryName = getRegistryName();
ModelLoader.setCustomStateMapper(this, new DefaultStateMapper(registryName));
ModelManager.registerCustomBlockModel(new BlockModelEntry(
new ModelResourceLocation(registryName, "normal"),
new ModelResourceLocation(registryName, "inventory"),
new ModelMultiFence(), this));
new ModelResourceLocation(registryName, "normal"),
new ModelResourceLocation(registryName, "inventory"),
new ModelMultiFence(), this
));
}
@SideOnly(Side.CLIENT)
@@ -227,6 +227,5 @@ public class BlockMultiFence extends BlockFence implements IBlockMetadata, IStat
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(getRegistryName(), "inventory");
}
}
}
@@ -2,7 +2,7 @@ package binnie.extratrees.block.decor;
public class FenceRenderer //implements ISimpleBlockRenderingHandler
{
/*public static int layer;
/*public static int layer;
@Override
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
@@ -8,7 +8,7 @@ import java.util.List;
public class FenceType {
public static List<FenceType> VALUES;
public int size;
public boolean solid;
public boolean embossed;
@@ -19,35 +19,6 @@ public class FenceType {
this.embossed = embedded;
}
public String getPrefix() {
String prefix = "";
if(size == 1){
prefix+=ExtraTrees.proxy.localise("multifence.low.type");
}else if(size == 2){
prefix+=ExtraTrees.proxy.localise("multifence.full.type");
}
if(solid){
if(!prefix.isEmpty()){
prefix+=" ";
}
prefix+=ExtraTrees.proxy.localise("multifence.solid.type");
}
if(embossed){
if(!prefix.isEmpty()){
prefix+=" ";
}
prefix+=ExtraTrees.proxy.localise("multifence.embedded.type");
}
if(!prefix.isEmpty()){
prefix+=" ";
}
return prefix;
}
public int ordinal() {
return this.size + ((this.solid ? 1 : 0) << 2) + ((this.embossed ? 1 : 0) << 3);
}
public FenceType(final int meta) {
this.size = (meta & 0x3);
this.solid = ((meta >> 2 & 0x1) > 0);
@@ -55,7 +26,7 @@ public class FenceType {
}
public static Collection<FenceType> values() {
if(VALUES == null){
if (VALUES == null) {
VALUES = new ArrayList<>();
for (int size = 0; size < 3; ++size) {
for (final boolean solid : new boolean[]{false, true}) {
@@ -68,10 +39,39 @@ public class FenceType {
return VALUES;
}
public String getPrefix() {
String prefix = "";
if (size == 1) {
prefix += ExtraTrees.proxy.localise("multifence.low.type");
} else if (size == 2) {
prefix += ExtraTrees.proxy.localise("multifence.full.type");
}
if (solid) {
if (!prefix.isEmpty()) {
prefix += " ";
}
prefix += ExtraTrees.proxy.localise("multifence.solid.type");
}
if (embossed) {
if (!prefix.isEmpty()) {
prefix += " ";
}
prefix += ExtraTrees.proxy.localise("multifence.embedded.type");
}
if (!prefix.isEmpty()) {
prefix += " ";
}
return prefix;
}
public int ordinal() {
return this.size + ((this.solid ? 1 : 0) << 2) + ((this.embossed ? 1 : 0) << 3);
}
public boolean isPlain() {
return this.size == 0 && !this.embossed && !this.solid;
}
@Override
public String toString() {
return size + (embossed ? ":embossed" : "") + (solid ? ":solid" : "");
@@ -2,111 +2,111 @@ package binnie.extratrees.block.decor;
public class HedgeRenderer //implements ISimpleBlockRenderingHandler
{
// @Override
// public void renderInventoryBlock(final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
// final int color = BlockHedge.getColor(metadata);
// final int r = color >> 16 & 0xFF;
// final int g = color >> 8 & 0xFF;
// final int b = color & 0xFF;
// GL11.glColor3f(r / 255.0f, g / 255.0f, b / 255.0f);
// renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
// final Tessellator tess = Tessellator.instance;
// GlStateManager.translate(-0.5f, -0.5f, -0.5f);
// tess.startDrawingQuads();
// tess.setNormal(0.0f, -1.0f, 0.0f);
// renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, block.getIcon(0, metadata));
// tess.draw();
// tess.startDrawingQuads();
// tess.setNormal(0.0f, 1.0f, 0.0f);
// renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, block.getIcon(1, metadata));
// tess.draw();
// tess.startDrawingQuads();
// tess.setNormal(0.0f, 0.0f, -1.0f);
// renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, block.getIcon(2, metadata));
// tess.draw();
// tess.startDrawingQuads();
// tess.setNormal(0.0f, 0.0f, 1.0f);
// renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, block.getIcon(3, metadata));
// tess.draw();
// tess.startDrawingQuads();
// tess.setNormal(-1.0f, 0.0f, 0.0f);
// renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, block.getIcon(4, metadata));
// tess.draw();
// tess.startDrawingQuads();
// tess.setNormal(1.0f, 0.0f, 0.0f);
// renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, block.getIcon(5, metadata));
// tess.draw();
// GlStateManager.translate(0.5f, 0.5f, 0.5f);
// }
//
// @Override
// public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
// final IIcon icon = block.getIcon(0, world.getBlockMetadata(x, y, z));
// final BlockHedge hedge = ExtraTrees.blockHedge;
// final boolean connectNegX = hedge.canConnectFenceTo(world, x - 1, y, z);
// final boolean connectPosX = hedge.canConnectFenceTo(world, x + 1, y, z);
// final boolean connectNegZ = hedge.canConnectFenceTo(world, x, y, z - 1);
// final boolean connectPosZ = hedge.canConnectFenceTo(world, x, y, z + 1);
// GlStateManager.pushMatrix();
// renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
// renderer.renderStandardBlock(block, x, y, z);
// renderer.renderFaceYPos(block, x, y, z, icon);
// renderer.renderFaceYNeg(block, x, y, z, icon);
// if (!connectNegX) {
// renderer.renderFaceXNeg(block, x, y, z, icon);
// }
// if (!connectPosX) {
// renderer.renderFaceXPos(block, x, y, z, icon);
// }
// if (!connectNegZ) {
// renderer.renderFaceZNeg(block, x, y, z, icon);
// }
// if (!connectPosZ) {
// renderer.renderFaceZPos(block, x, y, z, icon);
// }
// if (connectNegX) {
// renderer.setRenderBounds(0.0, 0.0, 0.25, 0.25, 1.0, 0.75);
// renderer.renderFaceYPos(block, x, y, z, icon);
// renderer.renderFaceYNeg(block, x, y, z, icon);
// renderer.renderFaceXNeg(block, x, y, z, icon);
// renderer.renderFaceZNeg(block, x, y, z, icon);
// renderer.renderFaceZPos(block, x, y, z, icon);
// }
// if (connectPosX) {
// renderer.setRenderBounds(0.75, 0.0, 0.25, 1.0, 1.0, 0.75);
// renderer.renderFaceYPos(block, x, y, z, icon);
// renderer.renderFaceYNeg(block, x, y, z, icon);
// renderer.renderFaceXPos(block, x, y, z, icon);
// renderer.renderFaceZNeg(block, x, y, z, icon);
// renderer.renderFaceZPos(block, x, y, z, icon);
// }
// if (connectPosZ) {
// renderer.setRenderBounds(0.25, 0.0, 0.75, 0.75, 1.0, 1.0);
// renderer.renderFaceYPos(block, x, y, z, icon);
// renderer.renderFaceYNeg(block, x, y, z, icon);
// renderer.renderFaceZPos(block, x, y, z, icon);
// renderer.renderFaceXNeg(block, x, y, z, icon);
// renderer.renderFaceXPos(block, x, y, z, icon);
// }
// if (connectNegZ) {
// renderer.setRenderBounds(0.25, 0.0, 0.0, 0.75, 1.0, 0.25);
// renderer.renderFaceYPos(block, x, y, z, icon);
// renderer.renderFaceYNeg(block, x, y, z, icon);
// renderer.renderFaceZNeg(block, x, y, z, icon);
// renderer.renderFaceXNeg(block, x, y, z, icon);
// renderer.renderFaceXPos(block, x, y, z, icon);
// }
// GlStateManager.popMatrix();
// return false;
// }
//
// @Override
// public boolean shouldRender3DInInventory(final int modelId) {
// return true;
// }
//
// @Override
// public int getRenderId() {
// return ModuleBlocks.hedgeRenderID;
// }
/*@Override
public void renderInventoryBlock(final Block block, final int metadata, final int modelId, final RenderBlocks renderer) {
final int color = BlockHedge.getColor(metadata);
final int r = color >> 16 & 0xFF;
final int g = color >> 8 & 0xFF;
final int b = color & 0xFF;
GL11.glColor3f(r / 255.0f, g / 255.0f, b / 255.0f);
renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
final Tessellator tess = Tessellator.instance;
GlStateManager.translate(-0.5f, -0.5f, -0.5f);
tess.startDrawingQuads();
tess.setNormal(0.0f, -1.0f, 0.0f);
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, block.getIcon(0, metadata));
tess.draw();
tess.startDrawingQuads();
tess.setNormal(0.0f, 1.0f, 0.0f);
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, block.getIcon(1, metadata));
tess.draw();
tess.startDrawingQuads();
tess.setNormal(0.0f, 0.0f, -1.0f);
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, block.getIcon(2, metadata));
tess.draw();
tess.startDrawingQuads();
tess.setNormal(0.0f, 0.0f, 1.0f);
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, block.getIcon(3, metadata));
tess.draw();
tess.startDrawingQuads();
tess.setNormal(-1.0f, 0.0f, 0.0f);
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, block.getIcon(4, metadata));
tess.draw();
tess.startDrawingQuads();
tess.setNormal(1.0f, 0.0f, 0.0f);
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, block.getIcon(5, metadata));
tess.draw();
GlStateManager.translate(0.5f, 0.5f, 0.5f);
}
@Override
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
final IIcon icon = block.getIcon(0, world.getBlockMetadata(x, y, z));
final BlockHedge hedge = ExtraTrees.blockHedge;
final boolean connectNegX = hedge.canConnectFenceTo(world, x - 1, y, z);
final boolean connectPosX = hedge.canConnectFenceTo(world, x + 1, y, z);
final boolean connectNegZ = hedge.canConnectFenceTo(world, x, y, z - 1);
final boolean connectPosZ = hedge.canConnectFenceTo(world, x, y, z + 1);
GlStateManager.pushMatrix();
renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.renderFaceYPos(block, x, y, z, icon);
renderer.renderFaceYNeg(block, x, y, z, icon);
if (!connectNegX) {
renderer.renderFaceXNeg(block, x, y, z, icon);
}
if (!connectPosX) {
renderer.renderFaceXPos(block, x, y, z, icon);
}
if (!connectNegZ) {
renderer.renderFaceZNeg(block, x, y, z, icon);
}
if (!connectPosZ) {
renderer.renderFaceZPos(block, x, y, z, icon);
}
if (connectNegX) {
renderer.setRenderBounds(0.0, 0.0, 0.25, 0.25, 1.0, 0.75);
renderer.renderFaceYPos(block, x, y, z, icon);
renderer.renderFaceYNeg(block, x, y, z, icon);
renderer.renderFaceXNeg(block, x, y, z, icon);
renderer.renderFaceZNeg(block, x, y, z, icon);
renderer.renderFaceZPos(block, x, y, z, icon);
}
if (connectPosX) {
renderer.setRenderBounds(0.75, 0.0, 0.25, 1.0, 1.0, 0.75);
renderer.renderFaceYPos(block, x, y, z, icon);
renderer.renderFaceYNeg(block, x, y, z, icon);
renderer.renderFaceXPos(block, x, y, z, icon);
renderer.renderFaceZNeg(block, x, y, z, icon);
renderer.renderFaceZPos(block, x, y, z, icon);
}
if (connectPosZ) {
renderer.setRenderBounds(0.25, 0.0, 0.75, 0.75, 1.0, 1.0);
renderer.renderFaceYPos(block, x, y, z, icon);
renderer.renderFaceYNeg(block, x, y, z, icon);
renderer.renderFaceZPos(block, x, y, z, icon);
renderer.renderFaceXNeg(block, x, y, z, icon);
renderer.renderFaceXPos(block, x, y, z, icon);
}
if (connectNegZ) {
renderer.setRenderBounds(0.25, 0.0, 0.0, 0.75, 1.0, 0.25);
renderer.renderFaceYPos(block, x, y, z, icon);
renderer.renderFaceYNeg(block, x, y, z, icon);
renderer.renderFaceZNeg(block, x, y, z, icon);
renderer.renderFaceXNeg(block, x, y, z, icon);
renderer.renderFaceXPos(block, x, y, z, icon);
}
GlStateManager.popMatrix();
return false;
}
@Override
public boolean shouldRender3DInInventory(final int modelId) {
return true;
}
@Override
public int getRenderId() {
return ModuleBlocks.hedgeRenderID;
}*/
}
@@ -24,7 +24,7 @@ public class MultiFenceRecipeEmbedded implements IRecipe {
FenceType typeSecond = WoodManager.getFenceType(c);
if (type != null && typeSecond != null && type.equals(typeSecond)) {
FenceDescription fenceDescription = WoodManager.getFenceDescription(a);
if(fenceDescription != null){
if (fenceDescription != null) {
IPlankType descPlankType = fenceDescription.getPlankType();
IPlankType plankType = WoodManager.getPlankType(b);
if (descPlankType == plankType) {
@@ -4,43 +4,43 @@ import binnie.extratrees.block.IPlankType;
import binnie.extratrees.block.WoodManager;
import net.minecraft.item.ItemStack;
public class MultiFenceRecipePattern{
public class MultiFenceRecipePattern {
public static MultiFenceRecipePattern[] VALUES;
static{
VALUES = new MultiFenceRecipePattern[] {
new MultiFenceRecipePattern(0, 2, "010"+"0 0"+" "),
new MultiFenceRecipePattern(0, 1, "000"+"0 0"+" "),
new MultiFenceRecipePattern(1, 2, "010"+"0 0"+" 1 "),
new MultiFenceRecipePattern(1, 1, "000"+"0 0"+" 0 "),
new MultiFenceRecipePattern(2, 2, " 0 "+"1 1"+"101"),
new MultiFenceRecipePattern(2, 1, " 0 "+"0 0"+"000")
static {
VALUES = new MultiFenceRecipePattern[]{
new MultiFenceRecipePattern(0, 2, "010" + "0 0" + " "),
new MultiFenceRecipePattern(0, 1, "000" + "0 0" + " "),
new MultiFenceRecipePattern(1, 2, "010" + "0 0" + " 1 "),
new MultiFenceRecipePattern(1, 1, "000" + "0 0" + " 0 "),
new MultiFenceRecipePattern(2, 2, " 0 " + "1 1" + "101"),
new MultiFenceRecipePattern(2, 1, " 0 " + "0 0" + "000")
};
}
private final String pattern;
private final int size;
private final int typeCount;
private MultiFenceRecipePattern(int size, int typeCount, String pattern) {
this.size = size;
this.typeCount = typeCount;
this.pattern = pattern;
}
public String getPattern() {
return pattern;
}
public int getTypeCount() {
return typeCount;
}
public boolean matches(String recipePattern){
public boolean matches(String recipePattern) {
return pattern.contains(recipePattern);
}
public ItemStack createFence(IPlankType plank, IPlankType plankSecondary){
public ItemStack createFence(IPlankType plank, IPlankType plankSecondary) {
return WoodManager.getFence(plank, plankSecondary, new FenceType(size, false, false), 4);
}
}
@@ -15,10 +15,10 @@ import java.util.List;
public class MultiFenceRecipeSize implements IRecipe {
private ItemStack cached = ItemStack.EMPTY;
public MultiFenceRecipeSize() {
}
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
StringBuilder recipePattern = new StringBuilder();
@@ -27,9 +27,9 @@ public class MultiFenceRecipeSize implements IRecipe {
ItemStack stack = inv.getStackInSlot(i);
boolean isEmpty = stack.isEmpty();
IPlankType type;
if(isEmpty){
if (isEmpty) {
type = null;
}else{
} else {
type = WoodManager.getPlankType(stack);
}
if (!isEmpty && type == null) {
@@ -50,8 +50,8 @@ public class MultiFenceRecipeSize implements IRecipe {
if (types.isEmpty()) {
return false;
}
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
if(pattern.matches(recipePattern.toString())){
for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
if (pattern.matches(recipePattern.toString())) {
cached = pattern.createFence(types.get(0), types.get(pattern.getTypeCount() - 1));
return true;
}
@@ -8,6 +8,10 @@ import net.minecraft.block.properties.PropertyEnum;
import java.util.Collection;
public class PropertyETType extends PropertyEnum<ETTreeDefinition> {
protected PropertyETType(String name, Class<ETTreeDefinition> valueClass, Collection<ETTreeDefinition> allowedValues) {
super(name, valueClass, allowedValues);
}
public static int getBlockCount(int variantsPerBlock) {
return (int) Math.ceil((float) ETTreeDefinition.VALUES.length / variantsPerBlock);
}
@@ -17,10 +21,4 @@ public class PropertyETType extends PropertyEnum<ETTreeDefinition> {
Collection<ETTreeDefinition> allowedValues = Collections2.filter(Lists.newArrayList(ETTreeDefinition.class.getEnumConstants()), filter);
return new PropertyETType(name, ETTreeDefinition.class, allowedValues);
}
protected PropertyETType(String name, Class<ETTreeDefinition> valueClass, Collection<ETTreeDefinition> allowedValues) {
super(name, valueClass, allowedValues);
}
}
@@ -10,6 +10,10 @@ import java.util.Collection;
public class PropertyETWoodType extends PropertyWoodType<EnumETLog> {
protected PropertyETWoodType(String name, Class<EnumETLog> valueClass, Collection<EnumETLog> allowedValues) {
super(name, valueClass, allowedValues);
}
public static PropertyETWoodType[] create(String name, int variantsPerBlock) {
return create(name, variantsPerBlock, false);
}
@@ -30,8 +34,4 @@ public class PropertyETWoodType extends PropertyWoodType<EnumETLog> {
}
return variants;
}
protected PropertyETWoodType(String name, Class<EnumETLog> valueClass, Collection<EnumETLog> allowedValues) {
super(name, valueClass, allowedValues);
}
}
@@ -13,6 +13,17 @@ import java.util.ArrayList;
import java.util.List;
public abstract class BlockETFence extends BlockForestryFence<EnumETLog> implements IWoodTyped, IItemModelRegister, IStateMapperRegister {
private BlockETFence(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "fences.";
if (fireproof) {
name += "fireproof.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
public static List<BlockETFence> create(boolean fireproof) {
List<BlockETFence> blocks = new ArrayList<>();
@@ -30,17 +41,6 @@ public abstract class BlockETFence extends BlockForestryFence<EnumETLog> impleme
return blocks;
}
private BlockETFence(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "fences.";
if (fireproof) {
name += "fireproof.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
@Override
public EnumETLog getWoodType(int meta) {
int variantCount = getVariant().getAllowedValues().size();
@@ -11,6 +11,17 @@ import java.util.ArrayList;
import java.util.List;
public abstract class BlockETLog extends BlockForestryLog<EnumETLog> {
private BlockETLog(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "logs.";
if (fireproof) {
name += "fireproof.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
public static List<BlockETLog> create(boolean fireproof) {
List<BlockETLog> blocks = new ArrayList<>();
PropertyETWoodType[] variants = PropertyETWoodType.create("variant", VARIANTS_PER_BLOCK, true);
@@ -27,22 +38,10 @@ public abstract class BlockETLog extends BlockForestryLog<EnumETLog> {
return blocks;
}
private BlockETLog(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "logs.";
if (fireproof) {
name += "fireproof.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
@Override
public EnumETLog getWoodType(int meta) {
int variantCount = getVariant().getAllowedValues().size();
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
return EnumETLog.byMetadata(variantMeta);
}
}
@@ -12,6 +12,17 @@ import java.util.List;
public abstract class BlockETPlank extends BlockForestryPlanks<EnumETLog> {
public static final String BLOCK_NAME = "plank";
private BlockETPlank(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "planks.";
if (fireproof) {
name += "fireproof.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
public static List<BlockETPlank> create(boolean fireproof) {
List<BlockETPlank> blocks = new ArrayList<>();
PropertyETWoodType[] variants = PropertyETWoodType.create("variant", VARIANTS_PER_BLOCK, false);
@@ -28,17 +39,6 @@ public abstract class BlockETPlank extends BlockForestryPlanks<EnumETLog> {
return blocks;
}
private BlockETPlank(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "planks.";
if (fireproof) {
name += "fireproof.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
@Override
public EnumETLog getWoodType(int meta) {
int variantCount = getVariant().getAllowedValues().size();
@@ -10,6 +10,20 @@ import java.util.ArrayList;
import java.util.List;
public abstract class BlockETSlab extends BlockForestrySlab<EnumETLog> {
private BlockETSlab(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "slabs.";
if (fireproof) {
name += "fireproof.";
}
if (isDouble()) {
name += "double.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
public static List<BlockETSlab> create(boolean fireproof, final boolean doubleSlab) {
List<BlockETSlab> blocks = new ArrayList<>();
PropertyETWoodType[] variants = PropertyETWoodType.create("variant", VARIANTS_PER_BLOCK, false);
@@ -31,20 +45,6 @@ public abstract class BlockETSlab extends BlockForestrySlab<EnumETLog> {
return blocks;
}
private BlockETSlab(boolean fireproof, int blockNumber) {
super(fireproof, blockNumber);
String name = "slabs.";
if (fireproof) {
name += "fireproof.";
}
if (isDouble()) {
name += "double.";
}
name += blockNumber;
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
setUnlocalizedName(name);
}
@Override
public EnumETLog getWoodType(int meta) {
meta &= ~8; // unset the top/bottom slab bit
@@ -44,46 +44,69 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
protected static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[] {
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D) };
public static final AxisAlignedBB PILLAR_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1D, 0.625D);
public static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.625D, 0.625D, 1D, 1.0D);
public static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.375D, 1D, 0.625D);
public static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1D, 0.375D);
public static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.625D, 0.0D, 0.375D, 1.0D, 1D, 0.625D);
protected static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[]{
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)
};
public BlockShrubLog() {
super(Material.WOOD);
this.setDefaultState(this.blockState.getBaseState()
.withProperty(NORTH, false)
.withProperty(EAST, false)
.withProperty(SOUTH, false)
.withProperty(WEST, false)
.withProperty(FIREPROOF, false));
.withProperty(NORTH, false)
.withProperty(EAST, false)
.withProperty(SOUTH, false)
.withProperty(WEST, false)
.withProperty(FIREPROOF, false));
setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "shrub_log"));
setUnlocalizedName("shrub_log");
setSoundType(SoundType.WOOD);
setHardness(EnumShrubLog.INSTANCE.getHardness());
}
private static int getBoundingBoxIdx(IBlockState state) {
int i = 0;
if (state.getValue(NORTH)) {
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
}
if (state.getValue(EAST)) {
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
}
if (state.getValue(SOUTH)) {
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
}
if (state.getValue(WEST)) {
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
}
return i;
}
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
if (!p_185477_7_) {
state = state.getActualState(worldIn, pos);
}
@@ -113,28 +136,6 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
return BOUNDING_BOXES[getBoundingBoxIdx(state)];
}
private static int getBoundingBoxIdx(IBlockState state) {
int i = 0;
if (state.getValue(NORTH)) {
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
}
if (state.getValue(EAST)) {
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
}
if (state.getValue(SOUTH)) {
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
}
if (state.getValue(WEST)) {
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
}
return i;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
@@ -171,7 +172,7 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos,
EnumFacing side) {
EnumFacing side) {
return true;
}
@@ -179,7 +180,7 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
public int getMetaFromState(IBlockState state) {
return state.getValue(FIREPROOF) ? 1 : 0;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(FIREPROOF, meta == 1);
@@ -188,9 +189,9 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
return state.withProperty(NORTH, canFenceConnectTo(worldIn, pos, EnumFacing.NORTH))
.withProperty(EAST, canFenceConnectTo(worldIn, pos, EnumFacing.EAST))
.withProperty(SOUTH, canFenceConnectTo(worldIn, pos, EnumFacing.SOUTH))
.withProperty(WEST, canFenceConnectTo(worldIn, pos, EnumFacing.WEST));
.withProperty(EAST, canFenceConnectTo(worldIn, pos, EnumFacing.EAST))
.withProperty(SOUTH, canFenceConnectTo(worldIn, pos, EnumFacing.SOUTH))
.withProperty(WEST, canFenceConnectTo(worldIn, pos, EnumFacing.WEST));
}
private boolean canFenceConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
@@ -201,70 +202,70 @@ 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;
Random rand = world instanceof World ? ((World) world).rand : RANDOM;
List<ItemStack> ret = new java.util.ArrayList<>();
float chance = 0.75F;
int amount = 2;
while(chance >= rand.nextFloat()){
chance-=0.25;
while (chance >= rand.nextFloat()) {
chance -= 0.25;
amount++;
}
ret.add(new ItemStack(Items.STICK, amount));
return ret;
}
@Override
public boolean isWood(IBlockAccess world, BlockPos pos) {
return true;
}
@Override
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos){
return true;
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state){
int i = 4;
int j = 5;
if (worldIn.isAreaLoaded(pos.add(-5, -5, -5), pos.add(5, 5, 5))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-4, -4, -4), pos.add(4, 4, 4))) {
IBlockState iblockstate = worldIn.getBlockState(blockpos);
@Override
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) {
return true;
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
int i = 4;
int j = 5;
if (worldIn.isAreaLoaded(pos.add(-5, -5, -5), pos.add(5, 5, 5))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-4, -4, -4), pos.add(4, 4, 4))) {
IBlockState iblockstate = worldIn.getBlockState(blockpos);
if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) {
iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
}
}
}
}
if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos)) {
iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
}
}
}
}
@Override
public IBlockState withRotation(IBlockState state, Rotation rot) {
switch (rot) {
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST))
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST))
.withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH))
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH))
.withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH))
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH))
.withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
default:
return state;
}
}
@Override
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
switch (mirrorIn) {
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
@@ -277,13 +278,13 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
public WoodBlockKind getBlockKind() {
return WoodBlockKind.LOG;
}
@SideOnly(Side.CLIENT)
@Override
public void registerStateMapper() {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(FIREPROOF).build());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
@@ -306,5 +307,4 @@ public class BlockShrubLog extends Block implements IWoodTyped, IStateMapperRegi
public Collection<? extends IWoodType> getWoodTypes() {
return Collections.singletonList(EnumShrubLog.INSTANCE);
}
}
@@ -21,5 +21,4 @@ public class ItemBlockETWood<V extends Block & IWoodTyped> extends ItemBlockWood
IWoodType woodType = wood.getWoodType(meta);
return WoodManager.getDisplayName(wood, woodType);
}
}
@@ -24,6 +24,15 @@ public class BlockCarpentryPanel extends BlockCarpentry {
this.setLightOpacity(0);
}
public static boolean isValidPanelPlacement(IBlockAccess world, BlockPos pos, @Nullable EnumFacing facing) {
if (facing == null) {
return false;
}
pos = pos.offset(facing);
IBlockState state = world.getBlockState(pos);
return state.isSideSolid(world, pos, facing.getOpposite());
}
@Override
public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
}
@@ -80,15 +89,6 @@ public class BlockCarpentryPanel extends BlockCarpentry {
return ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getTileMetadata(world, pos));
}
public static boolean isValidPanelPlacement(IBlockAccess world, BlockPos pos, @Nullable EnumFacing facing) {
if (facing == null) {
return false;
}
pos = pos.offset(facing);
IBlockState state = world.getBlockState(pos);
return state.isSideSolid(world, pos, facing.getOpposite());
}
@Override
public int getPlacedMeta(ItemStack item, World world, BlockPos pos, EnumFacing clickedBlock) {
final DesignBlock block = ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getItemDamage(item));
@@ -128,5 +128,4 @@ public class BlockCarpentryPanel extends BlockCarpentry {
world.setBlockToAir(pos);
}
}
}
@@ -11,7 +11,11 @@ import binnie.extratrees.api.CarpentryManager;
import binnie.extratrees.api.IDesign;
import binnie.extratrees.api.IDesignSystem;
import binnie.extratrees.api.IToolHammer;
import forestry.api.core.*;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.ISpriteRegister;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.ITextureManager;
import forestry.core.blocks.IColoredBlock;
import forestry.core.blocks.properties.UnlistedBlockAccess;
import forestry.core.blocks.properties.UnlistedBlockPos;
@@ -27,7 +31,11 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -44,8 +52,17 @@ import javax.annotation.Nullable;
import java.util.List;
public abstract class BlockDesign extends BlockMetadata implements IMultipassBlock<Integer>, IColoredBlock, ISpriteRegister, IItemModelRegister, IStateMapperRegister {
IDesignSystem designSystem;
public static final EnumFacing[] RENDER_DIRECTIONS = new EnumFacing[]{EnumFacing.DOWN, EnumFacing.UP, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH};
IDesignSystem designSystem;
public BlockDesign(final IDesignSystem system, final Material material) {
super(material);
this.designSystem = system;
}
public static int getMetadata(final int plank1, final int plank2, final int design) {
return plank1 + (plank2 << 9) + (design << 18);
}
@SubscribeEvent
public void onClick(final PlayerInteractEvent.RightClickBlock event) {
@@ -75,11 +92,6 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
}
}
public BlockDesign(final IDesignSystem system, final Material material) {
super(material);
this.designSystem = system;
}
public abstract ItemStack getCreativeStack(final IDesign p0);
@Override
@@ -147,10 +159,6 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
return TileEntityMetadata.getItemStack(this, getMetadata(plank1, plank2, design));
}
public static int getMetadata(final int plank1, final int plank2, final int design) {
return plank1 + (plank2 << 9) + (design << 18);
}
@Override
public int getDroppedMeta(IBlockState state, int tileMetadata) {
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), tileMetadata);
@@ -169,9 +177,10 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
ResourceLocation registryName = getRegistryName();
ModelLoader.setCustomStateMapper(this, new DefaultStateMapper(registryName));
ModelManager.registerCustomBlockModel(new BlockModelEntry(
new ModelResourceLocation(registryName, "normal"),
new ModelResourceLocation(registryName, "inventory"),
new ModelMutlipass<>(BlockDesign.class), this));
new ModelResourceLocation(registryName, "normal"),
new ModelResourceLocation(registryName, "inventory"),
new ModelMutlipass<>(BlockDesign.class), this
));
}
@SideOnly(Side.CLIENT)
@@ -180,15 +189,6 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
manager.registerItemModel(item, new DesignMeshDefinition());
}
private class DesignMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(getRegistryName(), "inventory");
}
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS});
@@ -243,4 +243,11 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
}
}
private class DesignMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(getRegistryName(), "inventory");
}
}
}
@@ -1,10 +1,20 @@
package binnie.extratrees.carpentry;
import binnie.extratrees.api.*;
import binnie.extratrees.api.ICarpentryInterface;
import binnie.extratrees.api.IDesign;
import binnie.extratrees.api.IDesignCategory;
import binnie.extratrees.api.IDesignMaterial;
import binnie.extratrees.api.ILayout;
import binnie.extratrees.api.IPattern;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class CarpentryInterface implements ICarpentryInterface {
static Map<Integer, IDesignMaterial> woodMap = new LinkedHashMap<>();
@@ -99,5 +109,4 @@ public class CarpentryInterface implements ICarpentryInterface {
}
return null;
}
}
@@ -1,6 +1,10 @@
package binnie.extratrees.carpentry;
import binnie.extratrees.api.*;
import binnie.extratrees.api.IDesign;
import binnie.extratrees.api.IDesignMaterial;
import binnie.extratrees.api.IDesignSystem;
import binnie.extratrees.api.ILayout;
import binnie.extratrees.api.IToolHammer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -13,6 +17,15 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public class DesignBlock {
private static final int[][] ROTATION_MATRIX = {
{0, 1, 4, 5, 3, 2, 6},
{0, 1, 5, 4, 2, 3, 6},
{5, 4, 2, 3, 0, 1, 6},
{4, 5, 2, 3, 1, 0, 6},
{2, 3, 1, 0, 4, 5, 6},
{3, 2, 0, 1, 4, 5, 6},
{0, 1, 2, 3, 4, 5, 6},
};
IDesign design;
IDesignMaterial primaryMaterial;
IDesignMaterial secondaryMaterial;
@@ -20,23 +33,6 @@ public class DesignBlock {
EnumFacing facing;
boolean panel;
@Override
public String toString() {
return super.toString() + " { design:" + this.design + " }, { primary:" + this.primaryMaterial + " }, { secondary:" + this.secondaryMaterial + " }, { rotation:" + this.rotation + " }, { facing:" + this.facing + " }";
}
public IDesign getDesign() {
return this.design;
}
public IDesignMaterial getPrimaryMaterial() {
return this.primaryMaterial;
}
public IDesignMaterial getSecondaryMaterial() {
return this.secondaryMaterial;
}
DesignBlock(final IDesignSystem system, @Nullable final IDesignMaterial primaryWood, @Nullable final IDesignMaterial secondaryWood, @Nullable final IDesign design, final int rotation, @Nullable final EnumFacing dir) {
this.panel = false;
this.rotation = rotation;
@@ -66,6 +62,23 @@ public class DesignBlock {
}
}
@Override
public String toString() {
return super.toString() + " { design:" + this.design + " }, { primary:" + this.primaryMaterial + " }, { secondary:" + this.secondaryMaterial + " }, { rotation:" + this.rotation + " }, { facing:" + this.facing + " }";
}
public IDesign getDesign() {
return this.design;
}
public IDesignMaterial getPrimaryMaterial() {
return this.primaryMaterial;
}
public IDesignMaterial getSecondaryMaterial() {
return this.secondaryMaterial;
}
public int getPrimaryColour() {
return this.getPrimaryMaterial().getColour();
}
@@ -132,16 +145,6 @@ public class DesignBlock {
}
}
private static final int[][] ROTATION_MATRIX = {
{0, 1, 4, 5, 3, 2, 6},
{0, 1, 5, 4, 2, 3, 6},
{5, 4, 2, 3, 0, 1, 6},
{4, 5, 2, 3, 1, 0, 6},
{2, 3, 1, 0, 4, 5, 6},
{3, 2, 0, 1, 4, 5, 6},
{0, 1, 2, 3, 4, 5, 6},
};
public EnumFacing getRotation(EnumFacing facing, EnumFacing axis) {
return getNewFacing(ROTATION_MATRIX[axis.ordinal()][facing.ordinal()]);
}
@@ -342,7 +345,6 @@ public class DesignBlock {
break LAYOUTS;
}
}
}
case SOUTH: {
switch (facing) {
@@ -379,7 +381,6 @@ public class DesignBlock {
break LAYOUTS;
}
}
}
}
}
@@ -407,6 +408,10 @@ public class DesignBlock {
return this.facing;
}
public void setFacing(final EnumFacing facing) {
this.facing = facing;
}
public int getRotation() {
return this.rotation;
}
@@ -418,7 +423,8 @@ public class DesignBlock {
EnumFacing newFacing = this.getFacing();
do {
newFacing = getNewFacing(newFacing.ordinal() + 1);
} while (newFacing != this.getFacing() && !BlockCarpentryPanel.isValidPanelPlacement(world, pos, newFacing));
}
while (newFacing != this.getFacing() && !BlockCarpentryPanel.isValidPanelPlacement(world, pos, newFacing));
if (newFacing != this.getFacing()) {
hammerI.onHammerUsed(hammer, player);
}
@@ -448,10 +454,6 @@ public class DesignBlock {
return EnumFacing.DOWN;
}
public void setFacing(final EnumFacing facing) {
this.facing = facing;
}
public int getBlockMetadata(final IDesignSystem system) {
return ModuleCarpentry.getBlockMetadata(system, this);
}
@@ -8,7 +8,7 @@ import java.util.List;
public class DesignerManager {
public static DesignerManager instance = new DesignerManager();
List<IDesignSystem> systems;
public DesignerManager() {
@@ -26,5 +26,4 @@ public class DesignerManager {
public void addDesignSystem(final DesignSystem system) {
this.systems.add(system);
}
}
@@ -111,209 +111,6 @@ public enum EnumDesign implements IDesign {
OverlappedBarred("Overlapped Barred"),
OverlappedSplitBarred("Overlapped Split Barred");
String name;
ILayout topPattern;
ILayout bottomPattern;
ILayout northPattern;
ILayout southPattern;
ILayout eastPattern;
ILayout westPattern;
void setEdgePatterns(final ILayout north, final ILayout east, final ILayout south, final ILayout west) {
this.setNorthPattern(north);
this.setEastPattern(east);
this.setSouthPattern(south);
this.setWestPattern(west);
}
void setEdgePatterns(final ILayout face) {
this.setEdgePatterns(face, face, face, face);
}
void setupStriped(final ILayout vert) {
this.setTopPattern(vert);
this.setEdgePatterns(vert.invert(), EnumPattern.Blank.layout(true), vert, EnumPattern.Blank.layout());
}
void setChequered(final ILayout cheq) {
this.setAllPatterns(cheq);
this.setNorthPattern(cheq.invert());
this.setSouthPattern(cheq.invert());
this.setBottomPattern(cheq.invert());
}
void setStripedChequered(final ILayout cheq, final ILayout stripe) {
this.setAllPatterns(cheq);
this.setNorthPattern(stripe.invert());
this.setSouthPattern(stripe.invert());
this.setEastPattern(stripe);
this.setWestPattern(stripe);
}
void setCornered(final ILayout corner, final ILayout edge) {
this.setTopPattern(corner);
this.setNorthPattern(EnumPattern.Blank.layout());
this.setEastPattern(edge.flipHorizontal());
this.setSouthPattern(edge);
this.setWestPattern(EnumPattern.Blank.layout());
}
void setEdged(final ILayout edge) {
this.setAllPatterns(edge);
this.setWestPattern(EnumPattern.Blank.layout());
this.setEastPattern(EnumPattern.Blank.layout(true));
this.northPattern = this.northPattern.flipHorizontal();
}
void setBarred(final ILayout bar) {
this.setAllPatterns(bar);
this.setEastPattern(EnumPattern.Blank.layout(true));
this.setWestPattern(EnumPattern.Blank.layout(true));
}
void setDiagonal(final ILayout diagonal, final ILayout edged) {
this.setAllPatterns(edged);
this.setTopPattern(diagonal);
this.northPattern = this.northPattern.flipHorizontal();
this.southPattern = this.southPattern.flipHorizontal();
}
void setSaltire(final ILayout saltire, final ILayout bar) {
this.setTopPattern(saltire);
this.setEdgePatterns(bar.invert());
}
void setCross(final ILayout saltire, final ILayout bar) {
this.setTopPattern(saltire);
this.setEdgePatterns(bar);
}
void setTSection(final ILayout tsection, final ILayout bar) {
this.setTopPattern(tsection);
this.setEdgePatterns(bar);
this.setWestPattern(EnumPattern.Blank.layout(true));
}
void setBarredCorner(final ILayout corner, final ILayout bar) {
this.setTSection(corner, bar);
this.setNorthPattern(EnumPattern.Blank.layout(true));
}
void setStripedCorner(final ILayout corner, final ILayout striped) {
this.setCornered(corner, striped);
}
void setLetterPattern(final ILayout letter) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(letter);
this.setBottomPattern(EnumPattern.Blank.layout(true));
}
void setBarredEndPattern(final ILayout end, final ILayout bar) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(end);
this.setWestPattern(bar);
}
void setDiagonalCorner(final ILayout diagonal, final ILayout bar, final ILayout edged) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(diagonal);
this.setWestPattern(bar.invert());
this.setNorthPattern(edged.flipHorizontal());
this.setSouthPattern(edged);
}
void setDiagonalTSection(final ILayout diagonal, final ILayout bar, final ILayout edged) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(diagonal);
this.setWestPattern(bar.invert());
this.setNorthPattern(bar.invert());
this.setEastPattern(edged.flipHorizontal());
this.setSouthPattern(edged);
}
EnumDesign(final String name) {
this.topPattern = Layout.get(EnumPattern.Blank, false);
this.bottomPattern = Layout.get(EnumPattern.Blank, false);
this.northPattern = Layout.get(EnumPattern.Blank, false);
this.eastPattern = Layout.get(EnumPattern.Blank, false);
this.southPattern = Layout.get(EnumPattern.Blank, false);
this.westPattern = Layout.get(EnumPattern.Blank, false);
this.name = name;
}
private void setAllPatterns(final ILayout layout) {
this.setTopPattern(layout);
this.setBottomPattern(layout);
this.setNorthPattern(layout);
this.setEastPattern(layout);
this.setSouthPattern(layout);
this.setWestPattern(layout);
}
@Override
public String getName() {
return this.name;
}
@Override
public ILayout getTopPattern() {
return this.topPattern;
}
public void setTopPattern(final ILayout layout) {
this.setBottomPattern(this.topPattern = layout);
}
@Override
public ILayout getBottomPattern() {
return this.bottomPattern;
}
public void setBottomPattern(final ILayout layout) {
this.bottomPattern = layout;
}
@Override
public ILayout getNorthPattern() {
return this.northPattern;
}
public void setNorthPattern(final ILayout layout) {
this.northPattern = layout;
}
@Override
public ILayout getSouthPattern() {
return this.southPattern;
}
public void setSouthPattern(final ILayout layout) {
this.southPattern = layout;
}
@Override
public ILayout getEastPattern() {
return this.eastPattern;
}
public void setEastPattern(final ILayout layout) {
this.eastPattern = layout;
}
@Override
public ILayout getWestPattern() {
return this.westPattern;
}
public void setWestPattern(final ILayout layout) {
this.westPattern = layout;
}
public void setName(final String name) {
this.name = name;
}
static {
Category.Design.addDesign(EnumDesign.Blank);
Category.Design.addDesign(EnumDesign.Octagon);
@@ -476,6 +273,209 @@ public enum EnumDesign implements IDesign {
EnumDesign.OverlappedBarred.setTopPattern(EnumPattern.OverlappedBarred.layout());
}
String name;
ILayout topPattern;
ILayout bottomPattern;
ILayout northPattern;
ILayout southPattern;
ILayout eastPattern;
ILayout westPattern;
EnumDesign(final String name) {
this.topPattern = Layout.get(EnumPattern.Blank, false);
this.bottomPattern = Layout.get(EnumPattern.Blank, false);
this.northPattern = Layout.get(EnumPattern.Blank, false);
this.eastPattern = Layout.get(EnumPattern.Blank, false);
this.southPattern = Layout.get(EnumPattern.Blank, false);
this.westPattern = Layout.get(EnumPattern.Blank, false);
this.name = name;
}
void setEdgePatterns(final ILayout north, final ILayout east, final ILayout south, final ILayout west) {
this.setNorthPattern(north);
this.setEastPattern(east);
this.setSouthPattern(south);
this.setWestPattern(west);
}
void setEdgePatterns(final ILayout face) {
this.setEdgePatterns(face, face, face, face);
}
void setupStriped(final ILayout vert) {
this.setTopPattern(vert);
this.setEdgePatterns(vert.invert(), EnumPattern.Blank.layout(true), vert, EnumPattern.Blank.layout());
}
void setChequered(final ILayout cheq) {
this.setAllPatterns(cheq);
this.setNorthPattern(cheq.invert());
this.setSouthPattern(cheq.invert());
this.setBottomPattern(cheq.invert());
}
void setStripedChequered(final ILayout cheq, final ILayout stripe) {
this.setAllPatterns(cheq);
this.setNorthPattern(stripe.invert());
this.setSouthPattern(stripe.invert());
this.setEastPattern(stripe);
this.setWestPattern(stripe);
}
void setCornered(final ILayout corner, final ILayout edge) {
this.setTopPattern(corner);
this.setNorthPattern(EnumPattern.Blank.layout());
this.setEastPattern(edge.flipHorizontal());
this.setSouthPattern(edge);
this.setWestPattern(EnumPattern.Blank.layout());
}
void setEdged(final ILayout edge) {
this.setAllPatterns(edge);
this.setWestPattern(EnumPattern.Blank.layout());
this.setEastPattern(EnumPattern.Blank.layout(true));
this.northPattern = this.northPattern.flipHorizontal();
}
void setBarred(final ILayout bar) {
this.setAllPatterns(bar);
this.setEastPattern(EnumPattern.Blank.layout(true));
this.setWestPattern(EnumPattern.Blank.layout(true));
}
void setDiagonal(final ILayout diagonal, final ILayout edged) {
this.setAllPatterns(edged);
this.setTopPattern(diagonal);
this.northPattern = this.northPattern.flipHorizontal();
this.southPattern = this.southPattern.flipHorizontal();
}
void setSaltire(final ILayout saltire, final ILayout bar) {
this.setTopPattern(saltire);
this.setEdgePatterns(bar.invert());
}
void setCross(final ILayout saltire, final ILayout bar) {
this.setTopPattern(saltire);
this.setEdgePatterns(bar);
}
void setTSection(final ILayout tsection, final ILayout bar) {
this.setTopPattern(tsection);
this.setEdgePatterns(bar);
this.setWestPattern(EnumPattern.Blank.layout(true));
}
void setBarredCorner(final ILayout corner, final ILayout bar) {
this.setTSection(corner, bar);
this.setNorthPattern(EnumPattern.Blank.layout(true));
}
void setStripedCorner(final ILayout corner, final ILayout striped) {
this.setCornered(corner, striped);
}
void setLetterPattern(final ILayout letter) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(letter);
this.setBottomPattern(EnumPattern.Blank.layout(true));
}
void setBarredEndPattern(final ILayout end, final ILayout bar) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(end);
this.setWestPattern(bar);
}
void setDiagonalCorner(final ILayout diagonal, final ILayout bar, final ILayout edged) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(diagonal);
this.setWestPattern(bar.invert());
this.setNorthPattern(edged.flipHorizontal());
this.setSouthPattern(edged);
}
void setDiagonalTSection(final ILayout diagonal, final ILayout bar, final ILayout edged) {
this.setAllPatterns(EnumPattern.Blank.layout(true));
this.setTopPattern(diagonal);
this.setWestPattern(bar.invert());
this.setNorthPattern(bar.invert());
this.setEastPattern(edged.flipHorizontal());
this.setSouthPattern(edged);
}
private void setAllPatterns(final ILayout layout) {
this.setTopPattern(layout);
this.setBottomPattern(layout);
this.setNorthPattern(layout);
this.setEastPattern(layout);
this.setSouthPattern(layout);
this.setWestPattern(layout);
}
@Override
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
@Override
public ILayout getTopPattern() {
return this.topPattern;
}
public void setTopPattern(final ILayout layout) {
this.setBottomPattern(this.topPattern = layout);
}
@Override
public ILayout getBottomPattern() {
return this.bottomPattern;
}
public void setBottomPattern(final ILayout layout) {
this.bottomPattern = layout;
}
@Override
public ILayout getNorthPattern() {
return this.northPattern;
}
public void setNorthPattern(final ILayout layout) {
this.northPattern = layout;
}
@Override
public ILayout getSouthPattern() {
return this.southPattern;
}
public void setSouthPattern(final ILayout layout) {
this.southPattern = layout;
}
@Override
public ILayout getEastPattern() {
return this.eastPattern;
}
public void setEastPattern(final ILayout layout) {
this.eastPattern = layout;
}
@Override
public ILayout getWestPattern() {
return this.westPattern;
}
public void setWestPattern(final ILayout layout) {
this.westPattern = layout;
}
enum Category implements IDesignCategory {
Design("Designs & Emblems"),
Stripes("Squares & Stripes"),
@@ -223,6 +223,69 @@ public enum EnumPattern implements IPattern {
OverlappedBarred,
OverlappedBarred2;
static {
setupStripedPattern(EnumPattern.ThinStriped, EnumPattern.ThinStriped2);
setupStripedPattern(EnumPattern.Striped, EnumPattern.Striped2);
setupStripedPattern(EnumPattern.Halved, EnumPattern.Halved2);
setupChequeredPattern(EnumPattern.Chequered);
setupChequeredPattern(EnumPattern.Tiled);
setupCornerPattern(EnumPattern.VeryThinCorner, EnumPattern.VeryThinCorner2, EnumPattern.VeryThinCorner3, EnumPattern.VeryThinCorner4);
setupCornerPattern(EnumPattern.ThinCorner, EnumPattern.ThinCorner2, EnumPattern.ThinCorner3, EnumPattern.ThinCorner4);
setupCornerPattern(EnumPattern.Corner, EnumPattern.Corner2, EnumPattern.Corner3, EnumPattern.Corner4);
setupCornerPattern(EnumPattern.ThickCorner, EnumPattern.ThickCorner2, EnumPattern.ThickCorner3, EnumPattern.ThickCorner4);
setupCornerPattern(EnumPattern.ThinCurvedCorner, EnumPattern.ThinCurvedCorner2, EnumPattern.ThinCurvedCorner3, EnumPattern.ThinCurvedCorner4);
setupCornerPattern(EnumPattern.CurvedCorner, EnumPattern.CurvedCorner2, EnumPattern.CurvedCorner3, EnumPattern.CurvedCorner4);
setupBarredPattern(EnumPattern.BarredEnd, EnumPattern.BarredEnd2, EnumPattern.BarredEnd3, EnumPattern.BarredEnd4);
setupEdgedPattern(EnumPattern.ThinEdged, EnumPattern.ThinEdged2, EnumPattern.ThinEdged3, EnumPattern.ThinEdged4);
setupEdgedPattern(EnumPattern.Edged, EnumPattern.Edged2, EnumPattern.Edged3, EnumPattern.Edged4);
setupBarredPattern(EnumPattern.ThinBarred, EnumPattern.ThinBarred2);
setupBarredPattern(EnumPattern.Barred, EnumPattern.Barred2);
setupBarredPattern(EnumPattern.ThickBarred, EnumPattern.ThickBarred2);
setupDiagonalPattern(EnumPattern.Diagonal, EnumPattern.Diagonal2);
setupDiagonalPattern(EnumPattern.ThickDiagonal, EnumPattern.ThickDiagonal2);
setupTSectionPattern(EnumPattern.ThinTSection, EnumPattern.ThinTSection2, EnumPattern.ThinTSection3, EnumPattern.ThinTSection4);
setupTSectionPattern(EnumPattern.TSection, EnumPattern.TSection2, EnumPattern.TSection3, EnumPattern.TSection4);
setupTSectionPattern(EnumPattern.ThickTSection, EnumPattern.ThickTSection2, EnumPattern.ThickTSection3, EnumPattern.ThickTSection4);
setupTSectionPattern(EnumPattern.ThinCurvedTSection, EnumPattern.ThinCurvedTSection2, EnumPattern.ThinCurvedTSection3, EnumPattern.ThinCurvedTSection4);
setupTSectionPattern(EnumPattern.CurvedTSection, EnumPattern.CurvedTSection2, EnumPattern.CurvedTSection3, EnumPattern.CurvedTSection4);
setupCornerPattern(EnumPattern.ThinBarredCorner, EnumPattern.ThinBarredCorner2, EnumPattern.ThinBarredCorner3, EnumPattern.ThinBarredCorner4);
setupCornerPattern(EnumPattern.BarredCorner, EnumPattern.BarredCorner2, EnumPattern.BarredCorner3, EnumPattern.BarredCorner4);
setupCornerPattern(EnumPattern.ThickBarredCorner, EnumPattern.ThickBarredCorner2, EnumPattern.ThickBarredCorner3, EnumPattern.ThickBarredCorner4);
setupCornerPattern(EnumPattern.ThinCurvedBarredCorner, EnumPattern.ThinCurvedBarredCorner2, EnumPattern.ThinCurvedBarredCorner3, EnumPattern.ThinCurvedBarredCorner4);
setupCornerPattern(EnumPattern.BarredCurvedCorner, EnumPattern.BarredCurvedCorner2, EnumPattern.BarredCurvedCorner3, EnumPattern.BarredCurvedCorner4);
setupCornerPattern(EnumPattern.ThinStripedCorner, EnumPattern.ThinStripedCorner2, EnumPattern.ThinStripedCorner3, EnumPattern.ThinStripedCorner4);
setupCornerPattern(EnumPattern.StripedCorner, EnumPattern.StripedCorner2, EnumPattern.StripedCorner3, EnumPattern.StripedCorner4);
setupCornerPattern(EnumPattern.OrnateStripedCorner, EnumPattern.OrnateStripedCorner2, EnumPattern.OrnateStripedCorner3, EnumPattern.OrnateStripedCorner4);
setupRotation(EnumPattern.LetterA, EnumPattern.LetterA2, EnumPattern.LetterA3, EnumPattern.LetterA4);
setupRotation(EnumPattern.LetterB, EnumPattern.LetterB2, EnumPattern.LetterB3, EnumPattern.LetterB4);
setupRotation(EnumPattern.LetterF, EnumPattern.LetterF2, EnumPattern.LetterF3, EnumPattern.LetterF4);
setupRotation(EnumPattern.LetterS, EnumPattern.LetterS2, EnumPattern.LetterS3, EnumPattern.LetterS4);
setupRotation(EnumPattern.LetterT, EnumPattern.LetterT2, EnumPattern.LetterT3, EnumPattern.LetterT4);
setupEdgedPattern(EnumPattern.DiagonalCorner, EnumPattern.DiagonalCorner2, EnumPattern.DiagonalCorner3, EnumPattern.DiagonalCorner4);
setupCornerPattern(EnumPattern.DiagonalTSection, EnumPattern.DiagonalTSection2, EnumPattern.DiagonalTSection3, EnumPattern.DiagonalTSection4);
setupEdgedPattern(EnumPattern.DiagonalCurvedCorner, EnumPattern.DiagonalCurvedCorner2, EnumPattern.DiagonalCurvedCorner3, EnumPattern.DiagonalCurvedCorner4);
setupCornerPattern(EnumPattern.DiagonalCurvedTSection, EnumPattern.DiagonalCurvedTSection2, EnumPattern.DiagonalCurvedTSection3, EnumPattern.DiagonalCurvedTSection4);
setupBarredPattern(EnumPattern.OrnateBarred, EnumPattern.OrnateBarred2);
setupBarredPattern(EnumPattern.OrnateThinBarred, EnumPattern.OrnateThinBarred2);
setupBarredPattern(EnumPattern.SplitBarred, EnumPattern.SplitBarred2);
setupCornerPattern(EnumPattern.SplitBarredCorner, EnumPattern.SplitBarredCorner2, EnumPattern.SplitBarredCorner3, EnumPattern.SplitBarredCorner4);
setupTSectionPattern(EnumPattern.SplitBarredTSection, EnumPattern.SplitBarredTSection2, EnumPattern.SplitBarredTSection3, EnumPattern.SplitBarredTSection4);
setupBarredPattern(EnumPattern.SplitBarredEnd, EnumPattern.SplitBarredEnd2, EnumPattern.SplitBarredEnd3, EnumPattern.SplitBarredEnd4);
setupRotation(EnumPattern.Creeper, EnumPattern.Creeper2, EnumPattern.Creeper3, EnumPattern.Creeper4);
setupDiagonalPattern(EnumPattern.DiagonalStriped, EnumPattern.DiagonalStriped2);
setupDiagonalPattern(EnumPattern.ThinDiagonalStriped, EnumPattern.ThinDiagonalStriped2);
setupCornerPattern(EnumPattern.Diagonal1Edged, EnumPattern.Diagonal1Edged2, EnumPattern.Diagonal1Edged3, EnumPattern.Diagonal1Edged4);
setupCornerPattern(EnumPattern.ThickDiagonal1Edged, EnumPattern.ThickDiagonal1Edged2, EnumPattern.ThickDiagonal1Edged3, EnumPattern.ThickDiagonal1Edged4);
setupInvert2Rot(EnumPattern.DiagonalHalved, EnumPattern.DiagonalHalved2);
set2Rotation(EnumPattern.Diagonal2Edged, EnumPattern.Diagonal2Edged2);
setupBarredPattern(EnumPattern.ThinBarredEnd, EnumPattern.ThinBarredEnd2, EnumPattern.ThinBarredEnd3, EnumPattern.ThinBarredEnd4);
setupBarredPattern(EnumPattern.ThickBarredEnd, EnumPattern.ThickBarredEnd2, EnumPattern.ThickBarredEnd3, EnumPattern.ThickBarredEnd4);
EnumPattern.OverlappedBarred.setLeftRotation(EnumPattern.OverlappedBarred2, false);
EnumPattern.OverlappedBarred2.setLeftRotation(EnumPattern.OverlappedBarred, false);
EnumPattern.OverlappedSplitBarred.setLeftRotation(EnumPattern.OverlappedSplitBarred2, false);
EnumPattern.OverlappedSplitBarred2.setLeftRotation(EnumPattern.OverlappedSplitBarred, false);
}
ILayout leftRotation;
ILayout horizontalFlip;
@@ -294,16 +357,16 @@ public enum EnumPattern implements IPattern {
setupEdgedPattern(l, t, r, b);
}
private static void setupRotation(final EnumPattern t, final EnumPattern r, final EnumPattern b, final EnumPattern l) {
setupEdgedPattern(l, t, r, b);
}
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getPrimarySprite(IDesignSystem system) {
return system.getPrimarySprite(this);
}
private static void setupRotation(final EnumPattern t, final EnumPattern r, final EnumPattern b, final EnumPattern l) {
setupEdgedPattern(l, t, r, b);
}
private void setHorizontalFlip(final EnumPattern pattern, final boolean inverted) {
this.horizontalFlip = Layout.get(pattern, inverted);
pattern.horizontalFlip = Layout.get(this, inverted);
@@ -340,67 +403,4 @@ public enum EnumPattern implements IPattern {
public ILayout layout(final boolean invert) {
return Layout.get(this, invert);
}
static {
setupStripedPattern(EnumPattern.ThinStriped, EnumPattern.ThinStriped2);
setupStripedPattern(EnumPattern.Striped, EnumPattern.Striped2);
setupStripedPattern(EnumPattern.Halved, EnumPattern.Halved2);
setupChequeredPattern(EnumPattern.Chequered);
setupChequeredPattern(EnumPattern.Tiled);
setupCornerPattern(EnumPattern.VeryThinCorner, EnumPattern.VeryThinCorner2, EnumPattern.VeryThinCorner3, EnumPattern.VeryThinCorner4);
setupCornerPattern(EnumPattern.ThinCorner, EnumPattern.ThinCorner2, EnumPattern.ThinCorner3, EnumPattern.ThinCorner4);
setupCornerPattern(EnumPattern.Corner, EnumPattern.Corner2, EnumPattern.Corner3, EnumPattern.Corner4);
setupCornerPattern(EnumPattern.ThickCorner, EnumPattern.ThickCorner2, EnumPattern.ThickCorner3, EnumPattern.ThickCorner4);
setupCornerPattern(EnumPattern.ThinCurvedCorner, EnumPattern.ThinCurvedCorner2, EnumPattern.ThinCurvedCorner3, EnumPattern.ThinCurvedCorner4);
setupCornerPattern(EnumPattern.CurvedCorner, EnumPattern.CurvedCorner2, EnumPattern.CurvedCorner3, EnumPattern.CurvedCorner4);
setupBarredPattern(EnumPattern.BarredEnd, EnumPattern.BarredEnd2, EnumPattern.BarredEnd3, EnumPattern.BarredEnd4);
setupEdgedPattern(EnumPattern.ThinEdged, EnumPattern.ThinEdged2, EnumPattern.ThinEdged3, EnumPattern.ThinEdged4);
setupEdgedPattern(EnumPattern.Edged, EnumPattern.Edged2, EnumPattern.Edged3, EnumPattern.Edged4);
setupBarredPattern(EnumPattern.ThinBarred, EnumPattern.ThinBarred2);
setupBarredPattern(EnumPattern.Barred, EnumPattern.Barred2);
setupBarredPattern(EnumPattern.ThickBarred, EnumPattern.ThickBarred2);
setupDiagonalPattern(EnumPattern.Diagonal, EnumPattern.Diagonal2);
setupDiagonalPattern(EnumPattern.ThickDiagonal, EnumPattern.ThickDiagonal2);
setupTSectionPattern(EnumPattern.ThinTSection, EnumPattern.ThinTSection2, EnumPattern.ThinTSection3, EnumPattern.ThinTSection4);
setupTSectionPattern(EnumPattern.TSection, EnumPattern.TSection2, EnumPattern.TSection3, EnumPattern.TSection4);
setupTSectionPattern(EnumPattern.ThickTSection, EnumPattern.ThickTSection2, EnumPattern.ThickTSection3, EnumPattern.ThickTSection4);
setupTSectionPattern(EnumPattern.ThinCurvedTSection, EnumPattern.ThinCurvedTSection2, EnumPattern.ThinCurvedTSection3, EnumPattern.ThinCurvedTSection4);
setupTSectionPattern(EnumPattern.CurvedTSection, EnumPattern.CurvedTSection2, EnumPattern.CurvedTSection3, EnumPattern.CurvedTSection4);
setupCornerPattern(EnumPattern.ThinBarredCorner, EnumPattern.ThinBarredCorner2, EnumPattern.ThinBarredCorner3, EnumPattern.ThinBarredCorner4);
setupCornerPattern(EnumPattern.BarredCorner, EnumPattern.BarredCorner2, EnumPattern.BarredCorner3, EnumPattern.BarredCorner4);
setupCornerPattern(EnumPattern.ThickBarredCorner, EnumPattern.ThickBarredCorner2, EnumPattern.ThickBarredCorner3, EnumPattern.ThickBarredCorner4);
setupCornerPattern(EnumPattern.ThinCurvedBarredCorner, EnumPattern.ThinCurvedBarredCorner2, EnumPattern.ThinCurvedBarredCorner3, EnumPattern.ThinCurvedBarredCorner4);
setupCornerPattern(EnumPattern.BarredCurvedCorner, EnumPattern.BarredCurvedCorner2, EnumPattern.BarredCurvedCorner3, EnumPattern.BarredCurvedCorner4);
setupCornerPattern(EnumPattern.ThinStripedCorner, EnumPattern.ThinStripedCorner2, EnumPattern.ThinStripedCorner3, EnumPattern.ThinStripedCorner4);
setupCornerPattern(EnumPattern.StripedCorner, EnumPattern.StripedCorner2, EnumPattern.StripedCorner3, EnumPattern.StripedCorner4);
setupCornerPattern(EnumPattern.OrnateStripedCorner, EnumPattern.OrnateStripedCorner2, EnumPattern.OrnateStripedCorner3, EnumPattern.OrnateStripedCorner4);
setupRotation(EnumPattern.LetterA, EnumPattern.LetterA2, EnumPattern.LetterA3, EnumPattern.LetterA4);
setupRotation(EnumPattern.LetterB, EnumPattern.LetterB2, EnumPattern.LetterB3, EnumPattern.LetterB4);
setupRotation(EnumPattern.LetterF, EnumPattern.LetterF2, EnumPattern.LetterF3, EnumPattern.LetterF4);
setupRotation(EnumPattern.LetterS, EnumPattern.LetterS2, EnumPattern.LetterS3, EnumPattern.LetterS4);
setupRotation(EnumPattern.LetterT, EnumPattern.LetterT2, EnumPattern.LetterT3, EnumPattern.LetterT4);
setupEdgedPattern(EnumPattern.DiagonalCorner, EnumPattern.DiagonalCorner2, EnumPattern.DiagonalCorner3, EnumPattern.DiagonalCorner4);
setupCornerPattern(EnumPattern.DiagonalTSection, EnumPattern.DiagonalTSection2, EnumPattern.DiagonalTSection3, EnumPattern.DiagonalTSection4);
setupEdgedPattern(EnumPattern.DiagonalCurvedCorner, EnumPattern.DiagonalCurvedCorner2, EnumPattern.DiagonalCurvedCorner3, EnumPattern.DiagonalCurvedCorner4);
setupCornerPattern(EnumPattern.DiagonalCurvedTSection, EnumPattern.DiagonalCurvedTSection2, EnumPattern.DiagonalCurvedTSection3, EnumPattern.DiagonalCurvedTSection4);
setupBarredPattern(EnumPattern.OrnateBarred, EnumPattern.OrnateBarred2);
setupBarredPattern(EnumPattern.OrnateThinBarred, EnumPattern.OrnateThinBarred2);
setupBarredPattern(EnumPattern.SplitBarred, EnumPattern.SplitBarred2);
setupCornerPattern(EnumPattern.SplitBarredCorner, EnumPattern.SplitBarredCorner2, EnumPattern.SplitBarredCorner3, EnumPattern.SplitBarredCorner4);
setupTSectionPattern(EnumPattern.SplitBarredTSection, EnumPattern.SplitBarredTSection2, EnumPattern.SplitBarredTSection3, EnumPattern.SplitBarredTSection4);
setupBarredPattern(EnumPattern.SplitBarredEnd, EnumPattern.SplitBarredEnd2, EnumPattern.SplitBarredEnd3, EnumPattern.SplitBarredEnd4);
setupRotation(EnumPattern.Creeper, EnumPattern.Creeper2, EnumPattern.Creeper3, EnumPattern.Creeper4);
setupDiagonalPattern(EnumPattern.DiagonalStriped, EnumPattern.DiagonalStriped2);
setupDiagonalPattern(EnumPattern.ThinDiagonalStriped, EnumPattern.ThinDiagonalStriped2);
setupCornerPattern(EnumPattern.Diagonal1Edged, EnumPattern.Diagonal1Edged2, EnumPattern.Diagonal1Edged3, EnumPattern.Diagonal1Edged4);
setupCornerPattern(EnumPattern.ThickDiagonal1Edged, EnumPattern.ThickDiagonal1Edged2, EnumPattern.ThickDiagonal1Edged3, EnumPattern.ThickDiagonal1Edged4);
setupInvert2Rot(EnumPattern.DiagonalHalved, EnumPattern.DiagonalHalved2);
set2Rotation(EnumPattern.Diagonal2Edged, EnumPattern.Diagonal2Edged2);
setupBarredPattern(EnumPattern.ThinBarredEnd, EnumPattern.ThinBarredEnd2, EnumPattern.ThinBarredEnd3, EnumPattern.ThinBarredEnd4);
setupBarredPattern(EnumPattern.ThickBarredEnd, EnumPattern.ThickBarredEnd2, EnumPattern.ThickBarredEnd3, EnumPattern.ThickBarredEnd4);
EnumPattern.OverlappedBarred.setLeftRotation(EnumPattern.OverlappedBarred2, false);
EnumPattern.OverlappedBarred2.setLeftRotation(EnumPattern.OverlappedBarred, false);
EnumPattern.OverlappedSplitBarred.setLeftRotation(EnumPattern.OverlappedSplitBarred2, false);
EnumPattern.OverlappedSplitBarred2.setLeftRotation(EnumPattern.OverlappedSplitBarred, false);
}
}
@@ -13,6 +13,17 @@ import java.util.Map;
public class GlassType implements IDesignMaterial {
static Map<Integer, GlassType> types;
static {
GlassType.types = new LinkedHashMap<>();
for (final StandardColor c : StandardColor.values()) {
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour));
}
for (final EnumFlowerColor c2 : EnumFlowerColor.values()) {
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getColourName(), c2.getColor(false)));
}
}
String name;
int colour;
int id;
@@ -23,29 +34,6 @@ public class GlassType implements IDesignMaterial {
this.colour = colour;
}
@Override
public ItemStack getStack() {
if (this.id < 128) {
return new ItemStack(Blocks.STAINED_GLASS, 1, this.id);
}
return TileEntityMetadata.getItemStack(Botany.stained, this.id - 128);
}
@Override
public ItemStack getStack(boolean fireproof) {
return getStack();
}
@Override
public String getName() {
return this.name;
}
@Override
public int getColour() {
return this.colour;
}
public static int getIndex(final IDesignMaterial id) {
for (final Map.Entry<Integer, GlassType> entry : GlassType.types.entrySet()) {
if (entry.getValue() == id) {
@@ -69,14 +57,27 @@ public class GlassType implements IDesignMaterial {
return null;
}
static {
GlassType.types = new LinkedHashMap<>();
for (final StandardColor c : StandardColor.values()) {
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour));
}
for (final EnumFlowerColor c2 : EnumFlowerColor.values()) {
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getColourName(), c2.getColor(false)));
@Override
public ItemStack getStack() {
if (this.id < 128) {
return new ItemStack(Blocks.STAINED_GLASS, 1, this.id);
}
return TileEntityMetadata.getItemStack(Botany.stained, this.id - 128);
}
@Override
public ItemStack getStack(boolean fireproof) {
return getStack();
}
@Override
public String getName() {
return this.name;
}
@Override
public int getColour() {
return this.colour;
}
private enum StandardColor {
@@ -22,5 +22,4 @@ public class ItemDesign extends ItemMetadata implements IColoredItem {
}
return block.getPrimaryColour();
}
}
@@ -11,6 +11,23 @@ public class Layout implements ILayout {
IPattern pattern;
boolean inverted;
private Layout(final IPattern pattern, final boolean inverted) {
this.pattern = pattern;
this.inverted = inverted;
}
private Layout(final IPattern pattern) {
this(pattern, false);
}
public static ILayout get(final IPattern pattern, final boolean inverted) {
return new Layout(pattern, inverted);
}
public static ILayout get(final IPattern pattern) {
return new Layout(pattern, false);
}
@Override
public IPattern getPattern() {
return this.pattern;
@@ -21,15 +38,6 @@ public class Layout implements ILayout {
return this.inverted;
}
private Layout(final IPattern pattern, final boolean inverted) {
this.pattern = pattern;
this.inverted = inverted;
}
private Layout(final IPattern pattern) {
this(pattern, false);
}
ILayout newLayout(final ILayout newLayout) {
return new Layout(newLayout.getPattern(), this.inverted ^ newLayout.isInverted());
}
@@ -70,12 +78,4 @@ public class Layout implements ILayout {
public ILayout invert() {
return new Layout(this.pattern, !this.inverted);
}
public static ILayout get(final IPattern pattern, final boolean inverted) {
return new Layout(pattern, inverted);
}
public static ILayout get(final IPattern pattern) {
return new Layout(pattern, false);
}
}
@@ -13,36 +13,14 @@ import net.minecraftforge.common.MinecraftForge;
public class ModuleCarpentry implements IInitializable {
static {
CarpentryManager.carpentryInterface = new CarpentryInterface();
}
public BlockCarpentry blockCarpentry;
public BlockCarpentry blockPanel;
public BlockStainedDesign blockStained;
@Override
public void preInit() {
blockCarpentry = new BlockCarpentry("carpentry");
blockPanel = new BlockCarpentryPanel();
blockStained = new BlockStainedDesign();
ExtraTrees.proxy.registerBlock(blockCarpentry, new ItemDesign(blockCarpentry));
ExtraTrees.proxy.registerBlock(blockPanel, new ItemDesign(blockPanel));
ExtraTrees.proxy.registerBlock(blockStained, new ItemDesign(blockStained));
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockCarpentry), new MultipassItemRenderer());
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockStained), new MultipassItemRenderer());
MinecraftForge.EVENT_BUS.register(blockCarpentry);
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockPanel), new MultipassItemRenderer());
}
@Override
public void init() {
}
@Override
public void postInit() {
for (final EnumDesign design : EnumDesign.values()) {
CarpentryManager.carpentryInterface.registerDesign(design.ordinal(), design);
}
}
public static ItemStack getItemStack(final BlockDesign block, final IDesignMaterial type1, final IDesignMaterial type2, final IDesign design) {
return getItemStack(block, block.getDesignSystem().getMaterialIndex(type1), block.getDesignSystem().getMaterialIndex(type2), CarpentryManager.carpentryInterface.getDesignIndex(design));
}
@@ -93,8 +71,30 @@ public class ModuleCarpentry implements IInitializable {
return getMetadata(plank1, plank2, design, 0, EnumFacing.UP.ordinal());
}
static {
CarpentryManager.carpentryInterface = new CarpentryInterface();
@Override
public void preInit() {
blockCarpentry = new BlockCarpentry("carpentry");
blockPanel = new BlockCarpentryPanel();
blockStained = new BlockStainedDesign();
ExtraTrees.proxy.registerBlock(blockCarpentry, new ItemDesign(blockCarpentry));
ExtraTrees.proxy.registerBlock(blockPanel, new ItemDesign(blockPanel));
ExtraTrees.proxy.registerBlock(blockStained, new ItemDesign(blockStained));
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockCarpentry), new MultipassItemRenderer());
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockStained), new MultipassItemRenderer());
MinecraftForge.EVENT_BUS.register(blockCarpentry);
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockPanel), new MultipassItemRenderer());
}
@Override
public void init() {
}
@Override
public void postInit() {
for (final EnumDesign design : EnumDesign.values()) {
CarpentryManager.carpentryInterface.registerDesign(design.ordinal(), design);
}
}
enum Axis {
@@ -9,5 +9,4 @@ public class ConfigurationMain {
@ConfigProperty(key = "lemon.citrus.family", comment = {"Uses reflection to convert the Forestry lemon tree to the Citrus family."})
@PropBoolean
public static boolean alterLemon = true;
}
@@ -3,7 +3,14 @@ package binnie.extratrees.core;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.gui.IBinnieGUID;
import binnie.extratrees.kitchen.craftgui.WindowBottleRack;
import binnie.extratrees.machines.craftgui.*;
import binnie.extratrees.machines.craftgui.WindowArboristDatabase;
import binnie.extratrees.machines.craftgui.WindowBrewery;
import binnie.extratrees.machines.craftgui.WindowDistillery;
import binnie.extratrees.machines.craftgui.WindowLepidopteristDatabase;
import binnie.extratrees.machines.craftgui.WindowLumbermill;
import binnie.extratrees.machines.craftgui.WindowPress;
import binnie.extratrees.machines.craftgui.WindowSetSquare;
import binnie.extratrees.machines.craftgui.WindowWoodworker;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
@@ -38,7 +38,6 @@ public class TreeGenBase extends WorldGenerator {
return a + this.rand.nextFloat() * (b - a);
}
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
this.world = worldIn;
@@ -15,19 +15,18 @@ public class WorldGenAlder {
public CommonAlder(ITreeGenData tree) {
super(tree, 5, 2);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height + 1;
float bottom = WorldGenUtils.randBetween(rand, 1, 2);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 0.5F, 1, EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 1.75F, 1, EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 0.5F, 1, EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 1.75F, 1, EnumReplaceMode.SOFT);
while (leafSpawn > bottom) {
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 2.25F, 1, EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 2F, 1, EnumReplaceMode.SOFT);
}
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 1.75F, 1, EnumReplaceMode.SOFT);
}
}
}
@@ -14,7 +14,7 @@ public class WorldGenApple {
public OrchardApple(ITreeGenData tree) {
super(tree, 3, 6);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = this.height;
@@ -24,14 +24,13 @@ public class WorldGenApple {
}
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 1F + girth, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
public static class SweetCrabapple extends forestry.arboriculture.worldgen.WorldGenTree {
public SweetCrabapple(ITreeGenData tree) {
super(tree, 4, 4);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = this.height;
@@ -43,14 +42,13 @@ public class WorldGenApple {
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 2.5F + girth, 1, WorldGenHelper.EnumReplaceMode.AIR);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.5F + girth, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
public static class FloweringCrabapple extends forestry.arboriculture.worldgen.WorldGenTree {
public FloweringCrabapple(ITreeGenData tree) {
super(tree, 3, 6);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = this.height;
@@ -67,7 +65,7 @@ public class WorldGenApple {
public PrairieCrabapple(ITreeGenData tree) {
super(tree, 4, 4);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = this.height;
@@ -14,7 +14,7 @@ public class WorldGenAsh {
public CommonAsh(ITreeGenData tree) {
super(tree, 5, 2);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height + 1;
@@ -25,6 +25,5 @@ public class WorldGenAsh {
}
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 0.25F, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
}
@@ -13,7 +13,7 @@ public class WorldGenBanana extends forestry.arboriculture.worldgen.WorldGenTree
public WorldGenBanana(ITreeGenData tree) {
super(tree, 6, 1);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = this.height + 1;
@@ -21,5 +21,4 @@ public class WorldGenBanana extends forestry.arboriculture.worldgen.WorldGenTree
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 1.5F, 1, WorldGenHelper.EnumReplaceMode.AIR);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 1, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
@@ -14,7 +14,7 @@ public class WorldGenBeech {
public CommonBeech(ITreeGenData tree) {
super(tree, 5, 3);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height + 1;
@@ -27,7 +27,6 @@ public class WorldGenBeech {
}
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 1.5F, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
public static class CopperBeech extends CommonBeech {
@@ -14,14 +14,14 @@ public class WorldGenConifer {
public WesternHemlock(ITreeGenData tree) {
super(tree, 7, 3);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height + girth * 4;
float bottom = WorldGenUtils.randBetween(rand, 2, 3);
final float coneHeight = leafSpawn - bottom;
float width = (girth * height / 3);
if(width > 9){
if (width > 9) {
width = 9;
}
while (leafSpawn > bottom) {
@@ -32,7 +32,6 @@ public class WorldGenConifer {
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + width * 0.7F, 1, WorldGenHelper.EnumReplaceMode.AIR);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + width * 0.4F, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
public static class Cypress extends WorldGenTree {
@@ -74,7 +73,6 @@ public class WorldGenConifer {
this.height = this.determineHeight(6, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Yew extends WorldGenTree {
@@ -112,7 +110,6 @@ public class WorldGenConifer {
this.height = this.determineHeight(5, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Cedar extends WorldGenTree {
@@ -178,7 +175,6 @@ public class WorldGenConifer {
this.height = this.determineHeight(6, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class LoblollyPine extends WorldGenTree {
@@ -216,7 +212,6 @@ public class WorldGenConifer {
this.height = this.determineHeight(6, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class MonkeyPuzzle extends WorldGenTree {
@@ -264,6 +259,5 @@ public class WorldGenConifer {
this.height = this.determineHeight(9, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -35,5 +35,4 @@ public class WorldGenDefault extends WorldGenTree {
public BlockType getWood() {
return new BlockTypeLog(this.treeGen);
}
}
@@ -57,7 +57,6 @@ public class WorldGenEucalyptus {
this.height = this.determineHeight(14, 3);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class RoseGum extends WorldGenTree {
@@ -106,7 +105,6 @@ public class WorldGenEucalyptus {
this.height = this.determineHeight(9, 3);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class RainbowGum extends WorldGenTree {
@@ -52,7 +52,6 @@ public class WorldGenFir {
this.height = this.determineHeight(7, 3);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class SilverFir extends WorldGenTree {
@@ -42,6 +42,5 @@ public class WorldGenHolly {
this.height = this.determineHeight(4, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -34,7 +34,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(4, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Logwood extends WorldGenTree {
@@ -72,7 +71,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(4, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Rosewood extends WorldGenTree {
@@ -114,7 +112,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(6, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Purpleheart extends WorldGenTree {
@@ -154,7 +151,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(7, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class OsangeOsange extends WorldGenTree {
@@ -192,7 +188,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(5, 1);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class OldFustic extends WorldGenTree {
@@ -230,7 +225,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(5, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Coffee extends WorldGenTree {
@@ -268,7 +262,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(3, 1);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class BrazilNut extends WorldGenTree {
@@ -310,7 +303,6 @@ public class WorldGenJungle {
this.height = this.determineHeight(7, 1);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class Shrub15 extends WorldGenTree {
@@ -344,6 +336,5 @@ public class WorldGenJungle {
this.height = this.determineHeight(4, 1);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -36,6 +36,5 @@ public class WorldGenLazy {
this.height = this.determineHeight(4, 1);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -53,6 +53,5 @@ public class WorldGenMaple {
this.height = this.determineHeight(5, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -14,7 +14,7 @@ public class WorldGenPalm {
public Coconut(ITreeGenData tree) {
super(tree, 6, 1);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height + 1;
@@ -22,6 +22,5 @@ public class WorldGenPalm {
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth + 0.5F, 1, WorldGenHelper.EnumReplaceMode.AIR);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth - 0.6F, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
}
@@ -42,7 +42,5 @@ public class WorldGenPoplar {
this.height = this.determineHeight(5, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -27,5 +27,4 @@ public class WorldGenPrune extends WorldGenTree {
this.height = this.determineHeight(6, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
@@ -18,23 +18,23 @@ import java.util.Random;
import java.util.Set;
public class WorldGenShrub {
public static class Shrub extends WorldGenArboriculture {
public static class Shrub extends WorldGenArboriculture {
private static final int minHeight = 1;
private static final int maxHeight = 10;
protected int girth;
protected int height;
public Shrub(ITreeGenData tree) {
super(tree);
}
@Override
public Set<BlockPos> generateTrunk(World world, Random rand, TreeBlockTypeLog wood, BlockPos startPos) {
WorldGenHelper.generateTreeTrunk(world, rand, wood, startPos, height, girth, 0, 0, null, 0);
return Collections.emptySet();
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height;
@@ -46,7 +46,7 @@ public class WorldGenShrub {
i++;
}
}
@Override
protected void generateExtras(World world, Random rand, BlockPos startPos) {
}
@@ -22,7 +22,6 @@ public class WorldGenSorbus {
}
this.generateCylinder(new Vector(0.0f, leafSpawn--, 0.0f), 0.7f * width, 1, this.leaf, false);
}
}
public static class Rowan extends WorldGenTree {
@@ -42,7 +41,6 @@ public class WorldGenSorbus {
}
this.generateCylinder(new Vector(0.0f, leafSpawn--, 0.0f), 0.7f * width, 1, this.leaf, false);
}
}
public static class ServiceTree extends WorldGenTree {
@@ -78,7 +78,6 @@ public class WorldGenSpruce {
this.height = this.determineHeight(5, 3);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class WhiteSpruce extends WorldGenTree {
@@ -147,6 +146,5 @@ public class WorldGenSpruce {
this.height = this.determineHeight(6, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}
@@ -31,6 +31,18 @@ public class WorldGenTree extends WorldGenerator {
BlockType air;
float bushiness;
public WorldGenTree(ITreeGenData tree) {
this.minHeight = 3;
this.maxHeight = 80;
this.spawnPods = false;
this.minPodHeight = 3;
this.vine = new BlockType(Blocks.VINE, 0);
this.air = new BlockTypeVoid();
this.bushiness = 0.0f;
this.spawnPods = tree.allowsFruitBlocks();
this.treeGen = tree;
}
protected int randBetween(final int a, final int b) {
return a + this.rand.nextInt(b - a);
}
@@ -79,18 +91,6 @@ public class WorldGenTree extends WorldGenerator {
return new BlockTypeLog(treeGen);
}
public WorldGenTree(ITreeGenData tree) {
this.minHeight = 3;
this.maxHeight = 80;
this.spawnPods = false;
this.minPodHeight = 3;
this.vine = new BlockType(Blocks.VINE, 0);
this.air = new BlockTypeVoid();
this.bushiness = 0.0f;
this.spawnPods = tree.allowsFruitBlocks();
this.treeGen = tree;
}
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
return generate(worldIn, rand, position.getX(), position.getY(), position.getZ(), false);
@@ -11,5 +11,4 @@ public class WorldGenUtils {
public static float randBetween(Random rand, float a, float b) {
return a + rand.nextFloat() * (b - a);
}
}
@@ -15,7 +15,7 @@ public class WorldGenWalnut {
public BlackWalnut(ITreeGenData tree) {
super(tree, 9, 6);
}
@Override
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
int leafSpawn = this.height + 1;
@@ -28,7 +28,7 @@ public class WorldGenWalnut {
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.2f - girth, 1, WorldGenHelper.EnumReplaceMode.AIR);
}
}
public static class Butternut extends WorldGenTree {
public Butternut(ITreeGenData tree) {
super(tree, 6, 3);
@@ -8,7 +8,12 @@ import binnie.extratrees.config.ConfigurationMain;
import binnie.extratrees.item.Food;
import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import forestry.api.arboriculture.*;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.IFruitProvider;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.TreeManager;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IFruitFamily;
@@ -27,8 +32,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.util.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IFruitProvider {
public static final AlleleETFruit Blackthorn = new AlleleETFruit("Blackthorn", 10, 7180062, 14561129, FruitSprite.SMALL);
@@ -91,7 +99,8 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
public static final AlleleETFruit Juniper = new AlleleETFruit("Juniper", 8, 10194034, 6316914, FruitSprite.TINY);
public static final AlleleETFruit Gooseberry = new AlleleETFruit("Gooseberry", 8, 12164944, 12177232, FruitSprite.TINY);
public static final AlleleETFruit GoldenRaspberry = new AlleleETFruit("GoldenRaspberry", 8, 12496955, 15970363, FruitSprite.TINY);
@Nullable
private static LinkedList<AlleleETFruit> list;
@Nullable
private IFruitFamily family;
private boolean isRipening;
@@ -105,8 +114,27 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
private FruitSprite sprite;
private Map<ItemStack, Float> products;
@Nullable
private static LinkedList<AlleleETFruit> list;
private AlleleETFruit(String name, int time, int unripe, int colour, FruitSprite sprite) {
super(Constants.EXTRA_TREES_MOD_ID, "fruit", name, true);
this.isRipening = false;
this.diffB = 0;
this.pod = null;
this.ripeningPeriod = 0;
this.products = new HashMap<>();
this.colour = colour;
this.sprite = sprite;
this.setRipening(time, unripe);
}
private AlleleETFruit(String name, FruitPod pod) {
super(Constants.EXTRA_TREES_MOD_ID, "fruit", name, true);
this.isRipening = false;
this.diffB = 0;
this.sprite = null;
this.products = new HashMap<>();
this.pod = pod;
this.ripeningPeriod = 2;
}
public static List<AlleleETFruit> values() {
if (list == null) {
@@ -124,8 +152,8 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
return list;
}
public static void preInit(){
public static void preInit() {
for (final AlleleETFruit fruit : AlleleETFruit.values()) {
AlleleManager.alleleRegistry.registerAllele(fruit, EnumTreeChromosome.FRUITS);
}
@@ -279,28 +307,6 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
}
}
private AlleleETFruit(String name, int time, int unripe, int colour, FruitSprite sprite) {
super(Constants.EXTRA_TREES_MOD_ID, "fruit", name, true);
this.isRipening = false;
this.diffB = 0;
this.pod = null;
this.ripeningPeriod = 0;
this.products = new HashMap<>();
this.colour = colour;
this.sprite = sprite;
this.setRipening(time, unripe);
}
private AlleleETFruit(String name, FruitPod pod) {
super(Constants.EXTRA_TREES_MOD_ID, "fruit", name, true);
this.isRipening = false;
this.diffB = 0;
this.sprite = null;
this.products = new HashMap<>();
this.pod = pod;
this.ripeningPeriod = 2;
}
public void setRipening(int time, int unripe) {
this.ripeningPeriod = time;
this.colourUnripe = unripe;
@@ -314,10 +320,6 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
this.products.put(product, chance);
}
private void setFamily(IFruitFamily family) {
this.family = family;
}
@Override
public IFruitProvider getProvider() {
return this;
@@ -361,8 +363,8 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
@Override
public boolean trySpawnFruitBlock(ITreeGenome genome, World world, Random rand, BlockPos pos) {
return this.pod != null &&
world.rand.nextFloat() <= genome.getSappiness() &&
TreeManager.treeRoot.setFruitBlock(world, genome, this, genome.getSappiness(), pos);
world.rand.nextFloat() <= genome.getSappiness() &&
TreeManager.treeRoot.setFruitBlock(world, genome, this, genome.getSappiness(), pos);
}
@Override
@@ -430,7 +432,6 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
return (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF);
}
@Override
public String getDescription() {
return ExtraTrees.proxy.localise("item.food." + this.getClass().getTypeName().toLowerCase());
@@ -442,6 +443,10 @@ public class AlleleETFruit extends AlleleCategorized implements IAlleleFruit, IF
return this.family;
}
private void setFamily(IFruitFamily family) {
this.family = family;
}
@Override
public int getRipeningPeriod() {
return this.ripeningPeriod;
@@ -4,7 +4,14 @@ import binnie.Constants;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IClassification;
import forestry.api.lepidopterology.*;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IAlleleButterflySpeciesBuilder;
import forestry.api.lepidopterology.IButterfly;
import forestry.api.lepidopterology.IButterflyGenome;
import forestry.api.lepidopterology.IButterflyMutationBuilder;
import forestry.core.genetics.alleles.AlleleHelper;
import forestry.lepidopterology.genetics.Butterfly;
import forestry.lepidopterology.genetics.ButterflyDefinition;
@@ -12,7 +19,7 @@ import forestry.lepidopterology.genetics.IButterflyDefinition;
import forestry.lepidopterology.genetics.MothDefinition;
import net.minecraft.item.ItemStack;
import java.awt.*;
import java.awt.Color;
import java.util.Arrays;
public enum ButterflySpecies implements IButterflyDefinition {
@@ -40,12 +47,12 @@ public enum ButterflySpecies implements IButterflyDefinition {
Marbled_White("Marbled White", "Melanargia galathea", 15527148);
public static final ButterflySpecies[] VALUES = values();
private final IAlleleButterflySpecies species;
private final IClassification branch;
private IAllele[] template;
private IButterflyGenome genome;
ButterflySpecies(String name, String scientific, int colour) {
String branchName = scientific.split(" ")[0].toLowerCase();
String binomial = scientific.split(" ")[1];
@@ -78,6 +85,10 @@ public enum ButterflySpecies implements IButterflyDefinition {
}
}
public static void preInit() {
}
private void init() {
template = ButterflyManager.butterflyRoot.getDefaultTemplate();
AlleleHelper.getInstance().set(template, EnumButterflyChromosome.SPECIES, species);
@@ -151,8 +162,4 @@ public enum ButterflySpecies implements IButterflyDefinition {
public IAlleleButterflySpecies getSpecies() {
return species;
}
public static void preInit() {
}
}
@@ -29,5 +29,4 @@ public class ETLeafProvider implements ILeafProvider {
}
return ModuleBlocks.getDecorativeLeaves(species.getUID());
}
}
@@ -4,13 +4,51 @@ import binnie.Constants;
import binnie.core.genetics.ForestryAllele;
import binnie.extratrees.block.EnumETLog;
import binnie.extratrees.block.EnumShrubLog;
import binnie.extratrees.gen.*;
import binnie.extratrees.gen.WorldGenAlder;
import binnie.extratrees.gen.WorldGenApple;
import binnie.extratrees.gen.WorldGenAsh;
import binnie.extratrees.gen.WorldGenBanana;
import binnie.extratrees.gen.WorldGenBeech;
import binnie.extratrees.gen.WorldGenConifer;
import binnie.extratrees.gen.WorldGenEucalyptus;
import binnie.extratrees.gen.WorldGenFir;
import binnie.extratrees.gen.WorldGenHolly;
import binnie.extratrees.gen.WorldGenJungle;
import binnie.extratrees.gen.WorldGenLazy;
import binnie.extratrees.gen.WorldGenMaple;
import binnie.extratrees.gen.WorldGenPalm;
import binnie.extratrees.gen.WorldGenPoplar;
import binnie.extratrees.gen.WorldGenShrub;
import binnie.extratrees.gen.WorldGenSorbus;
import binnie.extratrees.gen.WorldGenTree;
import binnie.extratrees.gen.WorldGenTree2;
import binnie.extratrees.gen.WorldGenTree3;
import binnie.extratrees.gen.WorldGenTropical;
import binnie.extratrees.gen.WorldGenWalnut;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.*;
import forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.EnumLeafType;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.EnumVanillaWoodType;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.IAlleleTreeSpeciesBuilder;
import forestry.api.arboriculture.ILeafSpriteProvider;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.ITreeGenerator;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.IWoodProvider;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.*;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IClassification;
import forestry.api.world.ITreeGenData;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.genetics.ClimateGrowthProvider;
@@ -32,7 +70,7 @@ import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import org.apache.commons.lang3.StringUtils;
import java.awt.*;
import java.awt.Color;
import java.util.Arrays;
import java.util.Locale;
@@ -1979,8 +2017,9 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
}
};
private static final String unlocalizedName = "extratrees.species.%s.name";
private static final String unlocalizedDesc = "extratrees.species.%s.desc";
public static ETTreeDefinition[] VALUES = values();
private String branchName;
private String binomial;
private Color leafColor;
@@ -1995,8 +2034,6 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
private IAlleleTreeSpecies species;
private ITreeGenome genome;
private AlleleTemplate template;
private static final String unlocalizedName = "extratrees.species.%s.name";
private static final String unlocalizedDesc = "extratrees.species.%s.desc";
ETTreeDefinition(String branch, String binomial, EnumLeafType leafType, Color leafColor, Color leafPollinatedColor, EnumSaplingType saplingType, IWoodType woodType, Color woodColor) {
this.binomial = binomial;
@@ -2009,8 +2046,6 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
this.woodProvider = new WoodProvider(woodType);
this.woodColor = woodColor;
this.branchName = branch;
}
public static void initTrees() {
@@ -2028,6 +2063,13 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
}
}
public static ETTreeDefinition byMetadata(int meta) {
if (meta < 0 || meta >= VALUES.length) {
meta = 0;
}
return VALUES[meta];
}
public void preInit() {
final String scientific = StringUtils.capitalize(branchName);
final String uid = "trees." + branchName;
@@ -2036,7 +2078,8 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
branch = AlleleManager.alleleRegistry.createAndRegisterClassification(IClassification.EnumClassLevel.GENUS, uid, scientific);
}
IAlleleTreeSpeciesBuilder speciesBuilder = TreeManager.treeFactory.createSpecies(getUID(), String.format(unlocalizedName, getUID()), getAuthority(), String.format(unlocalizedDesc, getUID()), isDominant(),
branch, getBinomial(), Constants.EXTRA_TREES_MOD_ID, leafSpriteProvider, saplingType.getGermlingModelProvider(leafColor, woodColor), woodProvider, this, new ETLeafProvider());
branch, getBinomial(), Constants.EXTRA_TREES_MOD_ID, leafSpriteProvider, saplingType.getGermlingModelProvider(leafColor, woodColor), woodProvider, this, new ETLeafProvider()
);
setSpeciesProperties(speciesBuilder);
species = speciesBuilder.build();
branch.addMemberSpecies(species);
@@ -2120,13 +2163,6 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
return ordinal();
}
public static ETTreeDefinition byMetadata(int meta) {
if (meta < 0 || meta >= VALUES.length) {
meta = 0;
}
return VALUES[meta];
}
@Override
public String getName() {
return name().toLowerCase(Locale.ENGLISH);
@@ -2139,7 +2175,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT
IBlockState logBlock = TreeManager.woodAccess.getBlock(woodType, WoodBlockKind.LOG, fireproof);
BlockLog.EnumAxis axis = BlockLog.EnumAxis.fromFacingAxis(facing.getAxis());
if(logBlock.getBlock() instanceof BlockLog){
if (logBlock.getBlock() instanceof BlockLog) {
logBlock = logBlock.withProperty(BlockLog.LOG_AXIS, axis);
}
return world.setBlockState(pos, logBlock);
@@ -10,7 +10,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.awt.*;
import java.awt.Color;
public enum EnumSaplingType {
Default,
@@ -29,6 +29,24 @@ public class ExtraTreeMutation implements ITreeMutation {
private float maxRainfall;
private float height;
public ExtraTreeMutation(final IAlleleSpecies allele0, final IAlleleSpecies allele1, final IAlleleSpecies result, final int chance) {
this(allele0, allele1, Binnie.GENETICS.getTreeRoot().getTemplate(result), chance);
}
public ExtraTreeMutation(final IAllele allele0, final IAllele allele1, final IAllele[] template, final int chance) {
this.isSecret = false;
this.minTemperature = 0.0f;
this.maxTemperature = 2.0f;
this.minRainfall = 0.0f;
this.maxRainfall = 2.0f;
this.height = -1.0f;
this.allele0 = (IAlleleTreeSpecies) allele0;
this.allele1 = (IAlleleTreeSpecies) allele1;
this.template = template;
this.chance = chance;
Binnie.GENETICS.getTreeRoot().registerMutation(this);
}
public static void init() {
final IAlleleTreeSpecies lemon = (IAlleleTreeSpecies) getVanilla("Lemon");
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ETTreeDefinition.KeyLime.getSpecies(), 10);
@@ -138,24 +156,6 @@ public class ExtraTreeMutation implements ITreeMutation {
return (IAlleleSpecies) allele;
}
public ExtraTreeMutation(final IAlleleSpecies allele0, final IAlleleSpecies allele1, final IAlleleSpecies result, final int chance) {
this(allele0, allele1, Binnie.GENETICS.getTreeRoot().getTemplate(result), chance);
}
public ExtraTreeMutation(final IAllele allele0, final IAllele allele1, final IAllele[] template, final int chance) {
this.isSecret = false;
this.minTemperature = 0.0f;
this.maxTemperature = 2.0f;
this.minRainfall = 0.0f;
this.maxRainfall = 2.0f;
this.height = -1.0f;
this.allele0 = (IAlleleTreeSpecies) allele0;
this.allele1 = (IAlleleTreeSpecies) allele1;
this.template = template;
this.chance = chance;
Binnie.GENETICS.getTreeRoot().registerMutation(this);
}
public ExtraTreeMutation setIsSecret() {
this.isSecret = true;
return this;
@@ -259,6 +259,4 @@ public class ExtraTreeMutation implements ITreeMutation {
}
return 0.0f;
}
}
@@ -18,17 +18,23 @@ public class ModuleGenetics implements IInitializable {
this.classifications = new ArrayList<>();
}
@SubscribeEvent
public static void onRegisterAllele(AlleleRegisterEvent<IAlleleFruit> event) {
if (event.getAlleleClass() == IAlleleFruit.class) {
AlleleETFruit.preInit();
}
}
@Override
public void preInit() {
}
@Override
public void init() {
AlleleETFruit.init();
ETTreeDefinition.initTrees();
ExtraTreeMutation.init();
if(BinnieCore.isLepidopteryActive()){
if (BinnieCore.isLepidopteryActive()) {
ButterflySpecies.initButterflies();
}
}
@@ -36,11 +42,4 @@ public class ModuleGenetics implements IInitializable {
@Override
public void postInit() {
}
@SubscribeEvent
public static void onRegisterAllele(AlleleRegisterEvent<IAlleleFruit> event){
if(event.getAlleleClass() == IAlleleFruit.class){
AlleleETFruit.preInit();
}
}
}
@@ -38,7 +38,6 @@ public class WoodProvider implements IWoodProvider {
TextureMap textureMap = FMLClientHandler.instance().getClient().getTextureMapBlocks();
trunk = textureMap.registerSprite(new ResourceLocation(type.getHeartTexture()));
bark = textureMap.registerSprite(new ResourceLocation(type.getBarkTexture()));
}
@Override
@@ -15,7 +15,12 @@ import binnie.extratrees.integration.jei.lumbermill.LumbermillRecipeCategory;
import binnie.extratrees.integration.jei.lumbermill.LumbermillRecipeMaker;
import binnie.extratrees.integration.jei.multifence.MultiFenceRecipeRegistryPlugin;
import binnie.extratrees.machines.ExtraTreeMachine;
import mezz.jei.api.*;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.JEIPlugin;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -27,9 +32,9 @@ public class ExtraTreesJeiPlugin extends BlankModPlugin {
@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ExtraTrees.blocks().blockMultiFence), (ItemStack itemStack)->{
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ExtraTrees.blocks().blockMultiFence), (ItemStack itemStack) -> {
FenceDescription desc = WoodManager.getFenceDescription(itemStack);
if(desc != null){
if (desc != null) {
FenceType type = WoodManager.getFenceType(itemStack);
return type + ":" + desc.getPlankType().getName().toLowerCase() + ":" + desc.getSecondaryPlankType().getName().toLowerCase();
}
@@ -44,10 +49,10 @@ public class ExtraTreesJeiPlugin extends BlankModPlugin {
ExtraTreesJeiPlugin.drawables = Drawables.getDrawables(guiHelper);
registry.addRecipeCategories(
new LumbermillRecipeCategory(),
new FruitPressRecipeCategory(),
new BreweryRecipeCategory(),
new DistilleryRecipeCategory()
new LumbermillRecipeCategory(),
new FruitPressRecipeCategory(),
new BreweryRecipeCategory(),
new DistilleryRecipeCategory()
);
registry.addRecipeCategoryCraftingItem(ExtraTreeMachine.Lumbermill.get(1), RecipeUids.LUMBERMILL);
@@ -59,7 +64,7 @@ public class ExtraTreesJeiPlugin extends BlankModPlugin {
registry.addRecipes(FruitPressRecipeMaker.create(), RecipeUids.FRUIT_PRESS);
registry.addRecipes(BreweryRecipeMaker.create(), RecipeUids.BREWING);
registry.addRecipes(DistilleryRecipeMaker.create(), RecipeUids.DISTILLING);
registry.addRecipeRegistryPlugin(new MultiFenceRecipeRegistryPlugin());
}
}
@@ -3,7 +3,11 @@ package binnie.extratrees.integration.jei.brewery;
import binnie.extratrees.integration.jei.ExtraTreesJeiPlugin;
import binnie.extratrees.integration.jei.RecipeUids;
import binnie.extratrees.machines.brewery.BreweryMachine;
import mezz.jei.api.gui.*;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
@@ -3,7 +3,11 @@ package binnie.extratrees.integration.jei.fruitpress;
import binnie.extratrees.integration.jei.ExtraTreesJeiPlugin;
import binnie.extratrees.integration.jei.RecipeUids;
import binnie.extratrees.machines.fruitpress.FruitPressMachine;
import mezz.jei.api.gui.*;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
@@ -1,10 +1,13 @@
package binnie.extratrees.integration.jei.lumbermill;
import binnie.extratrees.integration.jei.ExtraTreesJeiPlugin;
import binnie.extratrees.integration.jei.RecipeUids;
import binnie.extratrees.machines.lumbermill.LumbermillMachine;
import mezz.jei.api.gui.*;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
@@ -30,9 +30,9 @@ public class LumbermillRecipeWrapper extends BlankRecipeWrapper {
ExtraTrees.items();
ExtraTrees.items();
ingredients.setOutputs(ItemStack.class, Arrays.asList(
ExtraTreeItems.Bark.get(1),
outputPlanks,
ExtraTreeItems.Sawdust.get(1)
ExtraTreeItems.Bark.get(1),
outputPlanks,
ExtraTreeItems.Sawdust.get(1)
));
}
}
@@ -21,46 +21,46 @@ public class MultiFenceRecipeEmbeddedWrapper extends BlankRecipeWrapper implemen
private IPlankType plankType;
@Nullable
private IPlankType plankTypeSecondary;
public MultiFenceRecipeEmbeddedWrapper(FenceType fenceType) {
this.fenceType = fenceType;
}
public MultiFenceRecipeEmbeddedWrapper(IPlankType plankType, FenceType fenceType) {
this.plankType = plankType;
this.fenceType = fenceType;
}
public MultiFenceRecipeEmbeddedWrapper(FenceDescription fenceDesc) {
this.plankType = fenceDesc.getPlankType();
this.plankTypeSecondary = fenceDesc.getSecondaryPlankType();
this.fenceType = fenceDesc.getFenceType();
}
@Override
public void getIngredients(IIngredients ingredients) {
List<ItemStack> fences = new ArrayList<>();
List<ItemStack> planks = new ArrayList<>();
List<ItemStack> outputFences = new ArrayList<>();
if(plankType != null){
if(plankTypeSecondary == null){
for(Entry<IPlankType, ItemStack> secondary : WoodManager.getAllPlankStacks().entrySet()){
if (plankType != null) {
if (plankTypeSecondary == null) {
for (Entry<IPlankType, ItemStack> secondary : WoodManager.getAllPlankStacks().entrySet()) {
IPlankType plankTypeSecondary = secondary.getKey();
if(plankType != plankTypeSecondary){
if (plankType != plankTypeSecondary) {
planks.add(plankType.getStack(false));
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, false), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, true), 2));
}
}
}else{
} else {
planks.add(plankType.getStack(false));
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, false), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, true), 2));
}
}else{
for(IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()){
for(IPlankType plankType : WoodManager.getAllPlankTypes()){
if(plankType != plankTypeSecondary){
} else {
for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) {
for (IPlankType plankType : WoodManager.getAllPlankTypes()) {
if (plankType != plankTypeSecondary) {
planks.add(plankType.getStack(false));
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, false), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, fenceType.solid, true), 2));
@@ -77,7 +77,7 @@ public class MultiFenceRecipeEmbeddedWrapper extends BlankRecipeWrapper implemen
ingredients.setOutputLists(ItemStack.class, itemOutputs);
ingredients.setInputLists(ItemStack.class, itemInputs);
}
@Override
public int getWidth() {
return 3;
@@ -87,5 +87,4 @@ public class MultiFenceRecipeEmbeddedWrapper extends BlankRecipeWrapper implemen
public int getHeight() {
return 1;
}
}
@@ -5,8 +5,12 @@ import binnie.extratrees.block.WoodManager;
import binnie.extratrees.block.decor.FenceDescription;
import binnie.extratrees.block.decor.FenceType;
import binnie.extratrees.block.decor.MultiFenceRecipePattern;
import mezz.jei.api.recipe.*;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.api.recipe.IFocus.Mode;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeRegistryPlugin;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.gui.Focus;
import net.minecraft.item.ItemStack;
@@ -17,13 +21,13 @@ import java.util.List;
public class MultiFenceRecipeRegistryPlugin implements IRecipeRegistryPlugin {
public List<IRecipeWrapper> recipes = new ArrayList<>();
@Override
public <V> List<String> getRecipeCategoryUids(IFocus<V> focus) {
focus = Focus.check(focus);
V ingredient = focus.getValue();
if(!(ingredient instanceof ItemStack)){
if (!(ingredient instanceof ItemStack)) {
return Collections.emptyList();
}
ItemStack itemStack = (ItemStack) ingredient;
@@ -32,13 +36,13 @@ public class MultiFenceRecipeRegistryPlugin implements IRecipeRegistryPlugin {
case INPUT:
desc = WoodManager.getFenceDescription(itemStack);
IPlankType plankType = WoodManager.getPlankType(itemStack);
if(plankType != null || desc != null && (!desc.getFenceType().embossed || !desc.getFenceType().embossed)){
if (plankType != null || desc != null && (!desc.getFenceType().embossed || !desc.getFenceType().embossed)) {
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
}
return Collections.emptyList();
case OUTPUT:
desc = WoodManager.getFenceDescription(itemStack);
if(desc != null){
if (desc != null) {
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
}
return Collections.emptyList();
@@ -51,7 +55,7 @@ public class MultiFenceRecipeRegistryPlugin implements IRecipeRegistryPlugin {
public <T extends IRecipeWrapper, V> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory, IFocus<V> focus) {
focus = Focus.check(focus);
V ingredient = focus.getValue();
if(!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING) || !(ingredient instanceof ItemStack)){
if (!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING) || !(ingredient instanceof ItemStack)) {
return Collections.emptyList();
}
return (List<T>) getRecipes((IFocus<ItemStack>) focus);
@@ -59,61 +63,60 @@ public class MultiFenceRecipeRegistryPlugin implements IRecipeRegistryPlugin {
@Override
public <T extends IRecipeWrapper> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory) {
if(!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING)){
if (!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING)) {
return Collections.emptyList();
}
if(recipes.isEmpty()){
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
if (recipes.isEmpty()) {
for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
recipes.add(new MultiFenceRecipeSizeWrapper(pattern));
}
for(FenceType fenceType : FenceType.VALUES){
for (FenceType fenceType : FenceType.VALUES) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(fenceType));
recipes.add(new MultiFenceRecipeSolidWrapper(fenceType));
}
}
return (List<T>) recipes;
}
private List<IRecipeWrapper> getRecipes(IFocus<ItemStack> focus){
private List<IRecipeWrapper> getRecipes(IFocus<ItemStack> focus) {
ItemStack ingredient = focus.getValue();
List<IRecipeWrapper> recipes = new ArrayList<>();
if(focus.getMode() == Mode.INPUT){
if (focus.getMode() == Mode.INPUT) {
IPlankType plankType = WoodManager.getPlankType(ingredient);
if(plankType != null){
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
if (plankType != null) {
for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
recipes.add(new MultiFenceRecipeSizeWrapper(pattern, plankType));
}
for(int size = 0;size < 3;size++){
for (int size = 0; size < 3; size++) {
for (final boolean solid : new boolean[]{false, true}) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(plankType, new FenceType(size, solid, false)));
}
}
}else{
} else {
FenceDescription desc = WoodManager.getFenceDescription(ingredient);
if(desc != null){
if(!desc.getFenceType().embossed){
if (desc != null) {
if (!desc.getFenceType().embossed) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
}
if(!desc.getFenceType().solid){
if (!desc.getFenceType().solid) {
recipes.add(new MultiFenceRecipeSolidWrapper(desc));
}
}
}
}else{
} else {
FenceDescription desc = WoodManager.getFenceDescription(ingredient);
if(desc != null){
if (desc != null) {
int size = desc.getFenceType().size;
recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2], desc.getPlankType(), desc.getSecondaryPlankType()));
recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2 + 1], desc.getPlankType(), desc.getSecondaryPlankType()));
if(desc.getFenceType().embossed){
if (desc.getFenceType().embossed) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
}
if(desc.getFenceType().solid){
if (desc.getFenceType().solid) {
recipes.add(new MultiFenceRecipeSolidWrapper(desc));
}
}
}
return recipes;
}
}
@@ -21,16 +21,15 @@ public class MultiFenceRecipeSizeWrapper extends BlankRecipeWrapper {
private IPlankType plankTypeSecond;
private MultiFenceRecipePattern pattern;
private String[] recipePattern;
public MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern pattern) {
this(pattern, null, null);
}
public MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern pattern, @Nullable IPlankType plankType) {
this(pattern, plankType, null);
}
public MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern pattern, @Nullable IPlankType plankType, @Nullable IPlankType plankTypeSecond) {
this.pattern = pattern;
String recipePattern = pattern.getPattern();
@@ -41,60 +40,60 @@ public class MultiFenceRecipeSizeWrapper extends BlankRecipeWrapper {
this.plankType = plankType;
this.plankTypeSecond = plankTypeSecond;
}
@Override
public void getIngredients(IIngredients ingredients) {
int typeCount = pattern.getTypeCount();
List<List<ItemStack>> types = NonNullList.create();
if(this.plankType != null){
if (this.plankType != null) {
types.add(Collections.singletonList(plankType.getStack(false)));
}else{
} else {
List<ItemStack> planks = new ArrayList<>(WoodManager.getAllPlankStacks().values());
Collections.shuffle(planks);
types.add(planks);
}
if(typeCount > 1){
if(plankTypeSecond != null){
if (typeCount > 1) {
if (plankTypeSecond != null) {
types.add(Collections.singletonList(plankTypeSecond.getStack(false)));
}else{
} else {
List<ItemStack> planks;
if(plankType != null){
if (plankType != null) {
planks = new ArrayList<>(WoodManager.getAllPlankStacks(plankType));
}else{
} else {
planks = new ArrayList<>(WoodManager.getAllPlankStacks().values());
}
Collections.shuffle(planks);
types.add(planks);
}
}else{
} else {
types.add(types.get(0));
}
List<List<ItemStack>> itemInputs = NonNullList.withSize(9, NonNullList.create());
for(int p = 0;p < 3;p++){
for (int p = 0; p < 3; p++) {
String recipePattern = this.recipePattern[p];
for(int index = 0;index < 3;index++){
for (int index = 0; index < 3; index++) {
char c = recipePattern.charAt(index);
if(c == '0'){
if (c == '0') {
itemInputs.set(p * 3 + index, types.get(0));
}else if(c == '1'){
} else if (c == '1') {
itemInputs.set(p * 3 + index, types.get(1));
}else{
} else {
itemInputs.set(p * 3 + index, NonNullList.withSize(1, ItemStack.EMPTY));
}
}
}
List<List<ItemStack>> itemOutputs = new ArrayList<>();
int size = typeCount > 1 || plankType == null ? types.get(1).size() : 1;
int size = typeCount > 1 || plankType == null ? types.get(1).size() : 1;
List<ItemStack> outputs = new ArrayList<>();
itemOutputs.add(outputs);
for(int i = 0;i < size;i++){
for (int i = 0; i < size; i++) {
IPlankType plankType = this.plankType;
if(plankType == null){
if (plankType == null) {
ItemStack item = types.get(0).get(i);
plankType = WoodManager.getPlankType(item);
}
IPlankType plankTypeSecond = this.plankTypeSecond;
if(plankTypeSecond == null){
if (plankTypeSecond == null) {
ItemStack itemSecond = types.get(1).get(i);
plankTypeSecond = WoodManager.getPlankType(itemSecond);
}
@@ -103,5 +102,4 @@ public class MultiFenceRecipeSizeWrapper extends BlankRecipeWrapper {
ingredients.setOutputLists(ItemStack.class, itemOutputs);
ingredients.setInputLists(ItemStack.class, itemInputs);
}
}
@@ -20,39 +20,40 @@ public class MultiFenceRecipeSolidWrapper extends BlankRecipeWrapper implements
private IPlankType plankType;
@Nullable
private IPlankType plankTypeSecondary;
public MultiFenceRecipeSolidWrapper(FenceType fenceType) {
this.fenceType = fenceType;
this.plankType = null;
this.plankTypeSecondary = null;
}
public MultiFenceRecipeSolidWrapper(FenceDescription fenceDesc) {
this.fenceType = fenceDesc.getFenceType();
this.plankType = fenceDesc.getPlankType();
this.plankTypeSecondary = fenceDesc.getSecondaryPlankType();
}
@Override
public void getIngredients(IIngredients ingredients) {
List<ItemStack> fences = new ArrayList<>();
List<ItemStack> outputFences = new ArrayList<>();
if(plankType != null){
if(plankTypeSecondary == null){
for(IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()){
if(plankType != plankTypeSecondary){
if (plankType != null) {
if (plankTypeSecondary == null) {
for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) {
if (plankType != plankTypeSecondary) {
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
}
}
}else{
} else {
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
}
}else{
for(IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()){
for(IPlankType plankType : WoodManager.getAllPlankTypes()){
if(plankType != plankTypeSecondary){;
} else {
for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) {
for (IPlankType plankType : WoodManager.getAllPlankTypes()) {
if (plankType != plankTypeSecondary) {
;
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2));
}
@@ -78,5 +79,4 @@ public class MultiFenceRecipeSolidWrapper extends BlankRecipeWrapper implements
public int getHeight() {
return 1;
}
}
+43 -43
View File
@@ -90,6 +90,49 @@ public enum Food implements IItemMiscProvider {
this.hunger = hunger;
}
public static void registerOreDictionary() {
Food.CRABAPPLE.ore("Apple").ore("Crabapple");
Food.ORANGE.ore("Orange");
Food.KUMQUAT.ore("Kumquat");
Food.LIME.ore("Lime");
Food.WILD_CHERRY.ore("Cherry").ore("WildCherry");
Food.SOUR_CHERRY.ore("Cherry").ore("SourCherry");
Food.BLACK_CHERRY.ore("Cherry").ore("BlackCherry");
Food.Blackthorn.ore("Blackthorn");
Food.CHERRY_PLUM.ore("Plum").ore("CherryPlum");
Food.ALMOND.ore("Almond");
Food.APRICOT.ore("Apricot");
Food.GRAPEFRUIT.ore("Grapefruit");
Food.PEACH.ore("Peach");
Food.SATSUMA.ore("Satsuma").ore("Orange");
Food.BUDDHA_HAND.ore("BuddhaHand").ore("Citron");
Food.CITRON.ore("Citron");
Food.FINGER_LIME.ore("Lime").ore("FingerLime");
Food.KEY_LIME.ore("KeyLime").ore("Lime");
Food.MANDERIN.ore("Orange").ore("Manderin");
Food.NECTARINE.ore("Peach").ore("Nectarine");
Food.POMELO.ore("Pomelo");
Food.TANGERINE.ore("Tangerine").ore("Orange");
Food.PEAR.ore("Pear");
Food.SAND_PEAR.ore("SandPear");
Food.HAZELNUT.ore("Hazelnut");
Food.BUTTERNUT.ore("Butternut").ore("Walnut");
Food.BEECHNUT.ore("Beechnut");
Food.PECAN.ore("Pecan");
Food.BANANA.ore("Banana");
Food.RED_BANANA.ore("RedBanana").ore("Banana");
Food.PLANTAIN.ore("Plantain");
Food.BRAZIL_NUT.ore("BrazilNut");
Food.FIG.ore("Fig");
Food.ACORN.ore("Acorn");
Food.ELDERBERRY.ore("Elderberry");
Food.OLIVE.ore("Olive");
Food.GINGKO_NUT.ore("GingkoNut");
Food.COFFEE.ore("Coffee");
Food.OSANGE_ORANGE.ore("OsangeOrange");
Food.CLOVE.ore("Clove");
}
public boolean isEdible() {
return this.hunger > 0;
}
@@ -134,49 +177,6 @@ public enum Food implements IItemMiscProvider {
RecipeManagers.squeezerManager.addRecipe(time, this.get(1), Fluids.SEED_OIL.getFluid(amount), Mods.Forestry.stack("mulch"), mulch);
}
public static void registerOreDictionary() {
Food.CRABAPPLE.ore("Apple").ore("Crabapple");
Food.ORANGE.ore("Orange");
Food.KUMQUAT.ore("Kumquat");
Food.LIME.ore("Lime");
Food.WILD_CHERRY.ore("Cherry").ore("WildCherry");
Food.SOUR_CHERRY.ore("Cherry").ore("SourCherry");
Food.BLACK_CHERRY.ore("Cherry").ore("BlackCherry");
Food.Blackthorn.ore("Blackthorn");
Food.CHERRY_PLUM.ore("Plum").ore("CherryPlum");
Food.ALMOND.ore("Almond");
Food.APRICOT.ore("Apricot");
Food.GRAPEFRUIT.ore("Grapefruit");
Food.PEACH.ore("Peach");
Food.SATSUMA.ore("Satsuma").ore("Orange");
Food.BUDDHA_HAND.ore("BuddhaHand").ore("Citron");
Food.CITRON.ore("Citron");
Food.FINGER_LIME.ore("Lime").ore("FingerLime");
Food.KEY_LIME.ore("KeyLime").ore("Lime");
Food.MANDERIN.ore("Orange").ore("Manderin");
Food.NECTARINE.ore("Peach").ore("Nectarine");
Food.POMELO.ore("Pomelo");
Food.TANGERINE.ore("Tangerine").ore("Orange");
Food.PEAR.ore("Pear");
Food.SAND_PEAR.ore("SandPear");
Food.HAZELNUT.ore("Hazelnut");
Food.BUTTERNUT.ore("Butternut").ore("Walnut");
Food.BEECHNUT.ore("Beechnut");
Food.PECAN.ore("Pecan");
Food.BANANA.ore("Banana");
Food.RED_BANANA.ore("RedBanana").ore("Banana");
Food.PLANTAIN.ore("Plantain");
Food.BRAZIL_NUT.ore("BrazilNut");
Food.FIG.ore("Fig");
Food.ACORN.ore("Acorn");
Food.ELDERBERRY.ore("Elderberry");
Food.OLIVE.ore("Olive");
Food.GINGKO_NUT.ore("GingkoNut");
Food.COFFEE.ore("Coffee");
Food.OSANGE_ORANGE.ore("OsangeOrange");
Food.CLOVE.ore("Clove");
}
private Food ore(final String string) {
OreDictionary.registerOre("crop" + string, this.get(1));
this.ores.add("crop" + string);
@@ -70,8 +70,8 @@ public class ItemArboristDatabase extends Item implements IItemModelRegister {
public String getItemStackDisplayName(ItemStack itemStack) {
return ExtraTrees.proxy.localise(isMaster(itemStack) ? "item.database.arborist.master.name" : "item.database.arborist.name");
}
protected boolean isMaster(ItemStack itemStack){
protected boolean isMaster(ItemStack itemStack) {
return itemStack.getMetadata() > 0;
}
}
@@ -32,7 +32,7 @@ public class ItemHammer extends Item implements IToolHammer, IItemModelRegister
@Override
public String getItemStackDisplayName(ItemStack itemStack) {
return ExtraTrees.proxy.localise(isDurableHammer ? "item.hammer.master.name" : "item.hammer.name");
return ExtraTrees.proxy.localise(isDurableHammer ? "item.hammer.master.name" : "item.hammer.name");
}
@Override
@@ -70,8 +70,8 @@ public class ItemMothDatabase extends Item implements IItemModelRegister {
public String getItemStackDisplayName(ItemStack itemStack) {
return ExtraTrees.proxy.localise(isMaster(itemStack) ? "item.database.lepi.master.name" : "item.database.lepi.name");
}
protected boolean isMaster(ItemStack itemStack){
protected boolean isMaster(ItemStack itemStack) {
return itemStack.getMetadata() > 0;
}
}
@@ -7,83 +7,82 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class MachineRendererKitchen {
static int level = 0;
public static MachineRendererKitchen instance = new MachineRendererKitchen();
static int level = 0;
;
BinnieResource texture;
public void renderMachine(final Machine machine, final BinnieResource texture, final double x, final double y, final double z, final float var8) {
// if (renderer != null && renderer.blockAccess != null) {
// final Block block = machine.getPackage().getGroup().getBlock();
// final float i = 0.0625f;
// renderer.setRenderBounds(2.0f * i, 0.0, 2.0f * i, 14.0f * i, 14.0f * i, 14.0f * i);
// renderer.renderStandardBlock(block, (int) x, (int) y, (int) z);
// MachineRendererKitchen.level = 1;
// renderer.setRenderBounds(0.0, 14.0f * i, 0.0, 1.0, 1.0, 1.0);
// renderer.renderStandardBlock(block, (int) x, (int) y, (int) z);
// MachineRendererKitchen.level = 0;
// renderer.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
// if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) {
// return;
// }
// final IIcon icon = Blocks.dirt.getIcon(0, 0);
// final Tessellator tess = Tessellator.instance;
// boolean wasTessellating = true;
// try {
// tess.draw();
// } catch (Exception e) {
// wasTessellating = false;
// }
// tess.startDrawingQuads();
// tess.draw();
// GlStateManager.pushMatrix();
// GlStateManager.translate(x + 0.5, y + 1.0, z + 0.5);
// RenderManager.instance.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
// final float ux = icon.getMinU();
// final float uy = icon.getMinV();
// final float uw = icon.getMaxU();
// final float uh = icon.getMaxV();
// final int[] widths = { 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 6, 6, 5, 4 };
// for (int h = 0; h < 15; ++h) {
// final float h2 = h * i;
// final float h3 = h2 + i;
// final float d1 = widths[h] * i;
// final float d2 = widths[h + 1] * i;
// float ang = 0.707f;
// final float half = 8.0f * i;
// if (h < 13) {
// ang -= 0.05f;
// for (int angle = 0; angle < 360; angle += 90) {
// }
// if (h == 12) {
// }
// ang += 0.05f;
// }
// for (int angle = 0; angle < 360; angle += 90) {
// GlStateManager.pushMatrix();
// GlStateManager.rotate(angle, 0.0f, 1.0f, 0.0f);
// GlStateManager.translate(-0.5f, 0.0f, 0.0f);
// tess.startDrawingQuads();
// tess.setColorRGBA(255, 255, 255, 150);
// tess.addVertexWithUV(half - d1 * ang, h2, -d1 * ang, 0.0, 0.0);
// tess.addVertexWithUV(half - d2 * ang, h3, -d2 * ang, 0.0, 0.0);
// tess.addVertexWithUV(half + d2 * ang, h3, -d2 * ang, 0.0, 0.0);
// tess.addVertexWithUV(half + d1 * ang, h2, -d1 * ang, 0.0, 0.0);
// tess.draw();
// tess.startDrawingQuads();
// tess.addVertexWithUV(half + d1 * ang, h2, -d1 * ang, 0.0, 0.0);
// tess.addVertexWithUV(half + d2 * ang, h3, -d2 * ang, 0.0, 0.0);
// tess.addVertexWithUV(half - d2 * ang, h3, -d2 * ang, 0.0, 0.0);
// tess.addVertexWithUV(half - d1 * ang, h2, -d1 * ang, 0.0, 0.0);
// tess.draw();
// GlStateManager.popMatrix();
// }
// }
// GlStateManager.popMatrix();
// if (wasTessellating) {
// tess.startDrawingQuads();
// }
// }
/*if (renderer != null && renderer.blockAccess != null) {
final Block block = machine.getPackage().getGroup().getBlock();
final float i = 0.0625f;
renderer.setRenderBounds(2.0f * i, 0.0, 2.0f * i, 14.0f * i, 14.0f * i, 14.0f * i);
renderer.renderStandardBlock(block, (int) x, (int) y, (int) z);
MachineRendererKitchen.level = 1;
renderer.setRenderBounds(0.0, 14.0f * i, 0.0, 1.0, 1.0, 1.0);
renderer.renderStandardBlock(block, (int) x, (int) y, (int) z);
MachineRendererKitchen.level = 0;
renderer.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) {
return;
}
final IIcon icon = Blocks.dirt.getIcon(0, 0);
final Tessellator tess = Tessellator.instance;
boolean wasTessellating = true;
try {
tess.draw();
} catch (Exception e) {
wasTessellating = false;
}
tess.startDrawingQuads();
tess.draw();
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5, y + 1.0, z + 0.5);
RenderManager.instance.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
final float ux = icon.getMinU();
final float uy = icon.getMinV();
final float uw = icon.getMaxU();
final float uh = icon.getMaxV();
final int[] widths = { 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 6, 6, 5, 4 };
for (int h = 0; h < 15; ++h) {
final float h2 = h * i;
final float h3 = h2 + i;
final float d1 = widths[h] * i;
final float d2 = widths[h + 1] * i;
float ang = 0.707f;
final float half = 8.0f * i;
if (h < 13) {
ang -= 0.05f;
for (int angle = 0; angle < 360; angle += 90) {
}
if (h == 12) {
}
ang += 0.05f;
}
for (int angle = 0; angle < 360; angle += 90) {
GlStateManager.pushMatrix();
GlStateManager.rotate(angle, 0.0f, 1.0f, 0.0f);
GlStateManager.translate(-0.5f, 0.0f, 0.0f);
tess.startDrawingQuads();
tess.setColorRGBA(255, 255, 255, 150);
tess.addVertexWithUV(half - d1 * ang, h2, -d1 * ang, 0.0, 0.0);
tess.addVertexWithUV(half - d2 * ang, h3, -d2 * ang, 0.0, 0.0);
tess.addVertexWithUV(half + d2 * ang, h3, -d2 * ang, 0.0, 0.0);
tess.addVertexWithUV(half + d1 * ang, h2, -d1 * ang, 0.0, 0.0);
tess.draw();
tess.startDrawingQuads();
tess.addVertexWithUV(half + d1 * ang, h2, -d1 * ang, 0.0, 0.0);
tess.addVertexWithUV(half + d2 * ang, h3, -d2 * ang, 0.0, 0.0);
tess.addVertexWithUV(half - d2 * ang, h3, -d2 * ang, 0.0, 0.0);
tess.addVertexWithUV(half - d1 * ang, h2, -d1 * ang, 0.0, 0.0);
tess.draw();
GlStateManager.popMatrix();
}
}
GlStateManager.popMatrix();
if (wasTessellating) {
tess.startDrawingQuads();
}
}*/
}
}
Loaded 100 of 508 files, more files were not shown because too many files have changed in this diff. Show more