Updated guis, dispenser behaviours and tree generators

This commit is contained in:
Adubbz 2016-03-03 21:12:41 +11:00
parent c1dd0cdf7a
commit 603b089a4f
17 changed files with 30 additions and 26 deletions

View file

@ -9,6 +9,7 @@ import biomesoplenty.common.remote.TrailManager;
import biomesoplenty.common.util.entity.PlayerUtil; import biomesoplenty.common.util.entity.PlayerUtil;
import biomesoplenty.core.BiomesOPlenty; import biomesoplenty.core.BiomesOPlenty;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.config.DummyConfigElement; import net.minecraftforge.fml.client.config.DummyConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig; import net.minecraftforge.fml.client.config.GuiConfig;
@ -30,12 +31,12 @@ public class GuiBOPConfig extends GuiConfig
List<IConfigElement> textureSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.textureSettings.toLowerCase())).getChildElements(); List<IConfigElement> textureSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.textureSettings.toLowerCase())).getChildElements();
List<IConfigElement> trailSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.trailSettings.toLowerCase())).getChildElements(); List<IConfigElement> trailSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.trailSettings.toLowerCase())).getChildElements();
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.category.convenienceSettings.title"), "config.category.convenienceSettings", convenienceSettings)); list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.convenienceSettings.title"), "config.category.convenienceSettings", convenienceSettings));
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.category.guiSettings.title"), "config.category.guiSettings", guiSettings)); list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.guiSettings.title"), "config.category.guiSettings", guiSettings));
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.category.textureSettings.title"), "config.category.textureSettings", textureSettings)); list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.textureSettings.title"), "config.category.textureSettings", textureSettings));
if (TrailManager.trailsMap.containsKey(PlayerUtil.getClientPlayerUUID())) if (TrailManager.trailsMap.containsKey(PlayerUtil.getClientPlayerUUID()))
{ {
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.category.trailSettings.title"), "config.category.trailSettings", trailSettings)); list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.trailSettings.title"), "config.category.trailSettings", trailSettings));
} }
return list; return list;

View file

@ -19,6 +19,7 @@ import net.minecraft.client.gui.GuiSlider;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -636,7 +637,7 @@ public class GuiBOPConfigureWorld extends GuiScreen implements GuiSlider.FormatH
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.disableFog(); GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer(); VertexBuffer worldrenderer = tessellator.getBuffer();
this.mc.getTextureManager().bindTexture(optionsBackground); this.mc.getTextureManager().bindTexture(optionsBackground);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);

View file

@ -209,7 +209,7 @@ public class GuiBOPPageTable extends GuiBOPPageList
guitextfield.setText(field.getLabelText()); guitextfield.setText(field.getLabelText());
guitextfield.func_175207_a(this.responder); // setResponder guitextfield.func_175207_a(this.responder); // setResponder
guitextfield.setVisible(field.isVisible()); guitextfield.setVisible(field.isVisible());
guitextfield.func_175205_a(field.getValidator()); // setValidator guitextfield.setValidator(field.getValidator()); // setValidator
return guitextfield; return guitextfield;
} }

View file

@ -4,13 +4,14 @@ import biomesoplenty.common.entities.projectiles.EntityDart;
import net.minecraft.dispenser.BehaviorProjectileDispense; import net.minecraft.dispenser.BehaviorProjectileDispense;
import net.minecraft.dispenser.IPosition; import net.minecraft.dispenser.IPosition;
import net.minecraft.entity.IProjectile; import net.minecraft.entity.IProjectile;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DispenserBehaviorDart extends BehaviorProjectileDispense public class DispenserBehaviorDart extends BehaviorProjectileDispense
{ {
@Override @Override
protected IProjectile getProjectileEntity(World world, IPosition iPosition) protected IProjectile getProjectileEntity(World world, IPosition position, ItemStack stack)
{ {
return new EntityDart(world, iPosition.getX(), iPosition.getY(), iPosition.getZ()); return new EntityDart(world, position.getX(), position.getY(), position.getZ());
} }
} }

View file

@ -4,13 +4,14 @@ import biomesoplenty.common.entities.projectiles.EntityMudball;
import net.minecraft.dispenser.BehaviorProjectileDispense; import net.minecraft.dispenser.BehaviorProjectileDispense;
import net.minecraft.dispenser.IPosition; import net.minecraft.dispenser.IPosition;
import net.minecraft.entity.IProjectile; import net.minecraft.entity.IProjectile;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DispenserBehaviorMudball extends BehaviorProjectileDispense public class DispenserBehaviorMudball extends BehaviorProjectileDispense
{ {
@Override @Override
protected IProjectile getProjectileEntity(World world, IPosition iPosition) protected IProjectile getProjectileEntity(World world, IPosition position, ItemStack stack)
{ {
return new EntityMudball(world, iPosition.getX(), iPosition.getY(), iPosition.getZ()); return new EntityMudball(world, position.getX(), position.getY(), position.getZ());
} }
} }

View file

@ -103,9 +103,9 @@ public class TerrainSettings
{ {
// Transform vanilla height parameters into equivalent BOP terrain parameters // Transform vanilla height parameters into equivalent BOP terrain parameters
// Note they're named appallingly - minHeight and maxHeight in the vanilla biomes should be called baseHeight and scale // Note they're named appallingly - minHeight and maxHeight in the vanilla biomes should be called baseHeight and scale
double avgHeight = 65 + 17 * biome.minHeight; double avgHeight = 65 + 17 * biome.getBaseHeight();
double variationAbove = 7 + 20 * 4 * biome.maxHeight; double variationAbove = 7 + 20 * 4 * biome.getHeightVariation();
double variationBelow = 4 + 20 * biome.maxHeight; double variationBelow = 4 + 20 * biome.getHeightVariation();
return (new TerrainSettings()).setDefaults().avgHeight(avgHeight).heightVariation(variationAbove, variationBelow).sidewaysNoise(0.9D); return (new TerrainSettings()).setDefaults().avgHeight(avgHeight).heightVariation(variationAbove, variationBelow).sidewaysNoise(0.9D);

View file

@ -163,11 +163,11 @@ public class GeneratorBasicTree extends GeneratorTreeBase
{ {
BlockPos soilPos = pos.down(); BlockPos soilPos = pos.down();
Block soil = world.getBlockState(soilPos).getBlock(); Block soil = world.getBlockState(soilPos).getBlock();
boolean isSoil = soil.canSustainPlant(world, soilPos, EnumFacing.UP, (BlockSapling)Blocks.sapling); boolean isSoil = soil.canSustainPlant(world.getBlockState(soilPos), world, soilPos, EnumFacing.UP, (BlockSapling)Blocks.sapling);
if (this.placeOn.matches(world, soilPos) && isSoil && pos.getY() < 256 - height - 1) if (this.placeOn.matches(world, soilPos) && isSoil && pos.getY() < 256 - height - 1)
{ {
soil.onPlantGrow(world, soilPos, pos); soil.onPlantGrow(world.getBlockState(soilPos), world, soilPos, pos);
int leavesLayers = (this.leafLayers - 1); int leavesLayers = (this.leafLayers - 1);
//Generates leaves at the top of the tree, going one block above the top log (<= rather than <) //Generates leaves at the top of the tree, going one block above the top log (<= rather than <)
@ -234,7 +234,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
BlockPos blockpos3 = new BlockPos(x, y, z); BlockPos blockpos3 = new BlockPos(x, y, z);
//Surround leaves on the edge of the tree with vines and extend them downwards //Surround leaves on the edge of the tree with vines and extend them downwards
if (world.getBlockState(blockpos3).getBlock().isLeaves(world, blockpos3)) if (world.getBlockState(blockpos3).getBlock().isLeaves(world.getBlockState(blockpos3), world, blockpos3))
{ {
BlockPos westPos = blockpos3.west(); BlockPos westPos = blockpos3.west();
BlockPos eastPos = blockpos3.east(); BlockPos eastPos = blockpos3.east();

View file

@ -512,7 +512,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
{ {
BlockPos down = this.origin.down(); BlockPos down = this.origin.down();
IBlockState state = this.world.getBlockState(down); IBlockState state = this.world.getBlockState(down);
boolean isSoil = state.getBlock().canSustainPlant(this.world, down, EnumFacing.UP, ((BlockSapling)Blocks.sapling)); boolean isSoil = state.getBlock().canSustainPlant(state, this.world, down, EnumFacing.UP, ((BlockSapling)Blocks.sapling));
//Don't grow the tree here if the location can't sustain a sapling //Don't grow the tree here if the location can't sustain a sapling
if (!isSoil && !this.placeOn.matches(world, down)) if (!isSoil && !this.placeOn.matches(world, down))

View file

@ -143,7 +143,7 @@ public class GeneratorBulbTree extends GeneratorTreeBase
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world, startPos)) {startPos = startPos.down();} while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world.getBlockState(startPos), world, startPos)) {startPos = startPos.down();}
if (!this.placeOn.matches(world, startPos)) if (!this.placeOn.matches(world, startPos))
{ {

View file

@ -53,7 +53,7 @@ public class GeneratorBush extends GeneratorTreeBase
public boolean generate(World world, Random random, BlockPos startPos) public boolean generate(World world, Random random, BlockPos startPos)
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world, startPos)) {startPos = startPos.down();} while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world.getBlockState(startPos), world, startPos)) {startPos = startPos.down();}
if (!this.placeOn.matches(world, startPos)) if (!this.placeOn.matches(world, startPos))
{ {

View file

@ -118,6 +118,6 @@ public abstract class GeneratorHugeTree extends GeneratorTreeBase
//Just a helper macro //Just a helper macro
private void onPlantGrow(World world, BlockPos pos, BlockPos source) private void onPlantGrow(World world, BlockPos pos, BlockPos source)
{ {
world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); world.getBlockState(pos).getBlock().onPlantGrow(world.getBlockState(pos), world, pos, source);
} }
} }

View file

@ -57,7 +57,7 @@ public class GeneratorPineTree extends GeneratorTreeBase
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (pos.getY() > 1 && world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isLeaves(world, pos)) {pos = pos.down();} while (pos.getY() > 1 && world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isLeaves(world.getBlockState(pos), world, pos)) {pos = pos.down();}
if (!this.placeOn.matches(world, pos)) if (!this.placeOn.matches(world, pos))
{ {

View file

@ -82,7 +82,7 @@ public class GeneratorProfileTree extends GeneratorTreeBase
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (pos.getY() > 1 && world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isLeaves(world, pos)) {pos = pos.down();} while (pos.getY() > 1 && world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isLeaves(world.getBlockState(pos), world, pos)) {pos = pos.down();}
if (!this.placeOn.matches(world, pos)) if (!this.placeOn.matches(world, pos))
{ {

View file

@ -138,7 +138,7 @@ public class GeneratorRedwoodTree extends GeneratorTreeBase
public boolean generate(World world, Random random, BlockPos pos) public boolean generate(World world, Random random, BlockPos pos)
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (pos.getY() > 1 && world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isLeaves(world, pos)) {pos = pos.down();} while (pos.getY() > 1 && world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isLeaves(world.getBlockState(pos), world, pos)) {pos = pos.down();}
// Choose heights // Choose heights
int height = GeneratorUtils.nextIntBetween(random, this.minHeight, this.maxHeight); int height = GeneratorUtils.nextIntBetween(random, this.minHeight, this.maxHeight);

View file

@ -145,7 +145,7 @@ public class GeneratorTaigaTree extends GeneratorTreeBase
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world, startPos)) {startPos = startPos.down();} while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world.getBlockState(startPos), world, startPos)) {startPos = startPos.down();}
if (!this.placeOn.matches(world, startPos)) if (!this.placeOn.matches(world, startPos))
{ {

View file

@ -182,7 +182,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
if (this.vine == null) {return false;} if (this.vine == null) {return false;}
IBlockState vineState = this.vine.getBlock() instanceof BlockVine ? this.vine.withProperty(BlockVine.NORTH, Boolean.valueOf(side == EnumFacing.NORTH)).withProperty(BlockVine.EAST, Boolean.valueOf(side == EnumFacing.EAST)).withProperty(BlockVine.SOUTH, Boolean.valueOf(side == EnumFacing.SOUTH)).withProperty(BlockVine.WEST, Boolean.valueOf(side == EnumFacing.WEST)) : this.vine; IBlockState vineState = this.vine.getBlock() instanceof BlockVine ? this.vine.withProperty(BlockVine.NORTH, Boolean.valueOf(side == EnumFacing.NORTH)).withProperty(BlockVine.EAST, Boolean.valueOf(side == EnumFacing.EAST)).withProperty(BlockVine.SOUTH, Boolean.valueOf(side == EnumFacing.SOUTH)).withProperty(BlockVine.WEST, Boolean.valueOf(side == EnumFacing.WEST)) : this.vine;
boolean setOne = false; boolean setOne = false;
while (world.getBlockState(pos).getBlock().isAir(world, pos) && length > 0 && rand.nextInt(12) > 0) while (world.getBlockState(pos).getBlock().isAir(world.getBlockState(pos), world, pos) && length > 0 && rand.nextInt(12) > 0)
{ {
world.setBlockState(pos, vineState, 2); world.setBlockState(pos, vineState, 2);
setOne = true; setOne = true;

View file

@ -67,7 +67,7 @@ public class GeneratorTwigletTree extends GeneratorTreeBase
{ {
// Move down until we reach the ground // Move down until we reach the ground
while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world, startPos)) {startPos = startPos.down();} while (startPos.getY() > 1 && world.isAirBlock(startPos) || world.getBlockState(startPos).getBlock().isLeaves(world.getBlockState(startPos), world, startPos)) {startPos = startPos.down();}
if (!this.placeOn.matches(world, startPos)) if (!this.placeOn.matches(world, startPos))
{ {