Clean Up and fix missing fruit sprites

This commit is contained in:
Nedelosk committed 2017-04-09 14:33:31 +02:00
1 parent b044244dc6
commit 11c40fa158
9 files changed
+46 -44

No files matched your search

@@ -8,13 +8,8 @@ import javax.annotation.Nullable;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IFlowerType;
import binnie.botany.genetics.EnumFlowerType;
import binnie.core.resource.BinnieSprite;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class FlowerSpriteManager {
@@ -17,10 +17,8 @@ import binnie.botany.ceramic.brick.BlockCeramicBrick;
import binnie.botany.ceramic.brick.ItemCeramicBrick;
import binnie.botany.ceramic.brick.TileCeramicBrick;
import binnie.botany.farm.CircuitGarden;
import binnie.botany.flower.FlowerSpriteManager;
import binnie.botany.flower.ItemInsulatedTube;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.genetics.EnumFlowerType;
import binnie.botany.items.BotanyItems;
import binnie.botany.items.ItemClay;
import binnie.botany.items.ItemPigment;
@@ -15,7 +15,6 @@ import binnie.botany.api.IFlowerMutationBuilder;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore;
import binnie.botany.flower.FlowerSpriteManager;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.core.EnumTemperature;
@@ -5,7 +5,6 @@ import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.core.BotanyCore;
import binnie.botany.flower.BlockFlower;
import binnie.botany.flower.FlowerSpriteManager;
import binnie.botany.flower.ItemBotany;
import binnie.botany.flower.TileEntityFlower;
import binnie.core.BinnieCore;
@@ -5,7 +5,6 @@ import forestry.api.core.IModelBakerModel;
import forestry.core.models.ModelManager;
import forestry.core.models.baker.ModelBakerFace;
import forestry.core.models.baker.ModelBakerModel;
import forestry.core.proxy.Proxies;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -18,17 +18,20 @@ import binnie.extratrees.core.ModuleCore;
import binnie.extratrees.genetics.AlleleETFruit;
import binnie.extratrees.genetics.ButterflySpecies;
import binnie.extratrees.genetics.ETTreeDefinition;
import binnie.extratrees.genetics.FruitSprite;
import binnie.extratrees.genetics.ModuleGenetics;
import binnie.extratrees.item.ModuleItems;
import binnie.extratrees.kitchen.ModuleKitchen;
import binnie.extratrees.machines.ModuleMachine;
import binnie.extratrees.proxy.Proxy;
import com.google.common.base.Preconditions;
import forestry.api.arboriculture.ITreeRoot;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
@@ -41,6 +44,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -209,5 +213,13 @@ public class ExtraTrees extends AbstractMod {
});
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerSprites(TextureStitchEvent.Pre event) {
for (FruitSprite sprite : FruitSprite.VALUES) {
sprite.registerSprites();
}
}
}
@@ -1,47 +1,33 @@
package binnie.extratrees.gen;
import java.util.List;
import java.util.Random;
import forestry.api.world.ITreeGenData;
import forestry.arboriculture.worldgen.TreeBlockTypeLeaf;
import forestry.core.worldgen.WorldGenHelper;
import forestry.core.worldgen.WorldGenHelper.EnumReplaceMode;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class WorldGenAlder {
public static class CommonAlder extends WorldGenTree {
public static class CommonAlder extends forestry.arboriculture.worldgen.WorldGenTree {
public CommonAlder(ITreeGenData tree) {
super(tree);
super(tree, 5, 2);
}
@Override
public void generate() {
this.generateTreeTrunk(this.height, this.girth);
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
float leafSpawn = this.height + 1;
final float bottom = this.randBetween(1, 2);
final float width = this.height * this.randBetween(0.4f, 0.45f);
final float f = 0.0f;
final float h = leafSpawn;
leafSpawn = h - 1.0f;
this.generateCylinder(new Vector(f, h, 0.0f), 0.3f * width, 1, this.leaf, false);
final float f2 = 0.0f;
final float h2 = leafSpawn;
leafSpawn = h2 - 1.0f;
this.generateCylinder(new Vector(f2, h2, 0.0f), 0.8f * width, 1, this.leaf, false);
float bottom = WorldGenUtils.randBetween(rand, 1, 2);
float width = this.height * WorldGenUtils.randBetween(rand, 0.4f, 0.45f);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.3f * width + girth, 1, EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.8f * width + girth, 1, EnumReplaceMode.SOFT);
while (leafSpawn > bottom) {
final float f3 = 0.0f;
final float h3 = leafSpawn;
leafSpawn = h3 - 1.0f;
this.generateCylinder(new Vector(f3, h3, 0.0f), width, 1, this.leaf, false);
final float f4 = 0.0f;
final float h4 = leafSpawn;
leafSpawn = h4 - 1.0f;
this.generateCylinder(new Vector(f4, h4, 0.0f), width - 0.4f, 1, this.leaf, false);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, width - 0.25f + girth, 1, EnumReplaceMode.SOFT);
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, width - 0.4f + girth, 1, EnumReplaceMode.SOFT);
}
final float f5 = 0.0f;
final float h5 = leafSpawn;
leafSpawn = h5 - 1.0f;
this.generateCylinder(new Vector(f5, h5, 0.0f), 0.4f * width, 1, this.leaf, false);
}
@Override
public void preGenerate() {
this.height = this.determineHeight(5, 2);
this.girth = this.determineGirth(this.treeGen.getGirth());
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, 0.4f * width + girth, 1, EnumReplaceMode.SOFT);
}
}
@@ -0,0 +1,15 @@
package binnie.extratrees.gen;
import java.util.Random;
public class WorldGenUtils {
public static int randBetween(Random rand, int a, int b) {
return a + rand.nextInt(b - a);
}
public static float randBetween(Random rand, float a, float b) {
return a + rand.nextFloat() * (b - a);
}
}
@@ -1,6 +1,5 @@
package binnie.genetics.gui.flower;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerGenome;
import binnie.botany.api.IFlowerType;