mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 05:02:34 +00:00
Clean Up and fix missing fruit sprites
This commit is contained in:
1 parent
b044244dc6
commit
11c40fa158
9 files changed
+46
-44
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user