Fix JABBA-related issues with crafting station slots (#54)

* Fix shift-merging tools voiding items

fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392>

* Change 0-sized ItemStacks into null stacks in crafting station attached slots

Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425>

* Update buildscript

* spotlessApply
This commit is contained in:
Raven Szewczyk authored and GitHub committed 2022-09-22 20:51:23 +02:00
1 parent 18bfeaff32
commit 39be06c23b
571 files changed
+25959 -28223

No files matched your search

@@ -10,22 +10,19 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.*;
import net.minecraft.world.*;
public class MiningExplosion extends Explosion
{
public class MiningExplosion extends Explosion {
World world;
private Random random = new Random();
private int field_77289_h = 16;
private Map field_77288_k = new HashMap();
public MiningExplosion(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9)
{
public MiningExplosion(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9) {
super(par1World, par2Entity, par3, par5, par7, par9);
world = par1World;
}
@Override
public void doExplosionA ()
{
public void doExplosionA() {
float f = this.explosionSize;
HashSet hashset = new HashSet();
int i;
@@ -35,14 +32,15 @@ public class MiningExplosion extends Explosion
double d1;
double d2;
for (i = 0; i < this.field_77289_h; ++i)
{
for (j = 0; j < this.field_77289_h; ++j)
{
for (k = 0; k < this.field_77289_h; ++k)
{
if (i == 0 || i == this.field_77289_h - 1 || j == 0 || j == this.field_77289_h - 1 || k == 0 || k == this.field_77289_h - 1)
{
for (i = 0; i < this.field_77289_h; ++i) {
for (j = 0; j < this.field_77289_h; ++j) {
for (k = 0; k < this.field_77289_h; ++k) {
if (i == 0
|| i == this.field_77289_h - 1
|| j == 0
|| j == this.field_77289_h - 1
|| k == 0
|| k == this.field_77289_h - 1) {
double d3 = (double) ((float) i / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d4 = (double) ((float) j / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
double d5 = (double) ((float) k / ((float) this.field_77289_h - 1.0F) * 2.0F - 1.0F);
@@ -55,22 +53,24 @@ public class MiningExplosion extends Explosion
d1 = this.explosionY;
d2 = this.explosionZ;
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F)
{
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) {
int l = MathHelper.floor_double(d0);
int i1 = MathHelper.floor_double(d1);
int j1 = MathHelper.floor_double(d2);
Block k1 = this.world.getBlock(l, i1, j1);
if (k1 != Blocks.air)
{
if (k1 != Blocks.air) {
Block block = k1;
float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.world, l, i1, j1, block) : block.getExplosionResistance(this.exploder, world, l, i1, j1, explosionX, explosionY, explosionZ);
float f3 = this.exploder != null
? this.exploder.func_145772_a(this, this.world, l, i1, j1, block)
: block.getExplosionResistance(
this.exploder, world, l, i1, j1, explosionX, explosionY, explosionZ);
f1 -= (f3 + 0.8F) * f2 * 0.25f;
}
if (f1 > 0.0F && (this.exploder == null || this.exploder.func_145774_a(this, this.world, l, i1, j1, k1, f1)))
{
if (f1 > 0.0F
&& (this.exploder == null
|| this.exploder.func_145774_a(this, this.world, l, i1, j1, k1, f1))) {
hashset.add(new ChunkPosition(l, i1, j1));
}
@@ -91,38 +91,40 @@ public class MiningExplosion extends Explosion
int l1 = MathHelper.floor_double(this.explosionY + (double) this.explosionSize + 1.0D);
int i2 = MathHelper.floor_double(this.explosionZ - (double) this.explosionSize - 1.0D);
int j2 = MathHelper.floor_double(this.explosionZ + (double) this.explosionSize + 1.0D);
List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
List list = this.world.getEntitiesWithinAABBExcludingEntity(
this.exploder,
AxisAlignedBB.getBoundingBox(
(double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ);
for (int k2 = 0; k2 < list.size(); ++k2)
{
for (int k2 = 0; k2 < list.size(); ++k2) {
Entity entity = (Entity) list.get(k2);
double d7 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize;
double d7 =
entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize;
if (d7 <= 1.0D)
{
if (d7 <= 1.0D) {
d0 = entity.posX - this.explosionX;
d1 = entity.posY + (double) entity.getEyeHeight() - this.explosionY;
d2 = entity.posZ - this.explosionZ;
double d8 = (double) MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
if (d8 != 0.0D)
{
if (d8 != 0.0D) {
d0 /= d8;
d1 /= d8;
d2 /= d8;
double d9 = (double) this.world.getBlockDensity(vec3, entity.boundingBox);
double d10 = (1.0D - d7) * d9;
if (!(entity instanceof EntityItem))
entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D)));
entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float)
((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D)));
double d11 = EnchantmentProtection.func_92092_a(entity, d10);
entity.motionX += d0 * d11;
entity.motionY += d1 * d11;
entity.motionZ += d2 * d11;
if (entity instanceof EntityPlayer)
{
this.field_77288_k.put((EntityPlayer) entity, Vec3.createVectorHelper(d0 * d10, d1 * d10, d2 * d10));
if (entity instanceof EntityPlayer) {
this.field_77288_k.put(
(EntityPlayer) entity, Vec3.createVectorHelper(d0 * d10, d1 * d10, d2 * d10));
}
}
}
@@ -132,17 +134,21 @@ public class MiningExplosion extends Explosion
}
@Override
public void doExplosionB (boolean par1)
{
this.world.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 0.7F);
public void doExplosionB(boolean par1) {
this.world.playSoundEffect(
this.explosionX,
this.explosionY,
this.explosionZ,
"random.explode",
4.0F,
(1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 0.7F);
if (this.explosionSize >= 2.0F && this.isSmoking)
{
this.world.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
}
else
{
this.world.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
if (this.explosionSize >= 2.0F && this.isSmoking) {
this.world.spawnParticle(
"hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
} else {
this.world.spawnParticle(
"largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D);
}
Iterator iterator;
@@ -152,20 +158,17 @@ public class MiningExplosion extends Explosion
int k;
Block l;
if (this.isSmoking)
{
if (this.isSmoking) {
iterator = this.affectedBlockPositions.iterator();
while (iterator.hasNext())
{
while (iterator.hasNext()) {
chunkposition = (ChunkPosition) iterator.next();
i = chunkposition.chunkPosX;
j = chunkposition.chunkPosY;
k = chunkposition.chunkPosZ;
l = this.world.getBlock(i, j, k);
if (par1)
{
if (par1) {
double d0 = (double) ((float) i + this.world.rand.nextFloat());
double d1 = (double) ((float) j + this.world.rand.nextFloat());
double d2 = (double) ((float) k + this.world.rand.nextFloat());
@@ -181,17 +184,23 @@ public class MiningExplosion extends Explosion
d3 *= d7;
d4 *= d7;
d5 *= d7;
this.world.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5);
this.world.spawnParticle(
"explode",
(d0 + this.explosionX * 1.0D) / 2.0D,
(d1 + this.explosionY * 1.0D) / 2.0D,
(d2 + this.explosionZ * 1.0D) / 2.0D,
d3,
d4,
d5);
this.world.spawnParticle("smoke", d0, d1, d2, d3, d4, d5);
}
if (l != Blocks.air)
{
if (l != Blocks.air) {
Block block = l;
if (block.canDropFromExplosion(this))
{
block.dropBlockAsItemWithChance(this.world, i, j, k, this.world.getBlockMetadata(i, j, k), 1.0F, 0);
if (block.canDropFromExplosion(this)) {
block.dropBlockAsItemWithChance(
this.world, i, j, k, this.world.getBlockMetadata(i, j, k), 1.0F, 0);
}
block.onBlockExploded(this.world, i, j, k, this);
@@ -199,12 +208,10 @@ public class MiningExplosion extends Explosion
}
}
if (this.isFlaming)
{
if (this.isFlaming) {
iterator = this.affectedBlockPositions.iterator();
while (iterator.hasNext())
{
while (iterator.hasNext()) {
chunkposition = (ChunkPosition) iterator.next();
i = chunkposition.chunkPosX;
j = chunkposition.chunkPosY;
@@ -212,8 +219,7 @@ public class MiningExplosion extends Explosion
l = this.world.getBlock(i, j, k);
Block i1 = this.world.getBlock(i, j - 1, k);
if (l == Blocks.air && i1.isOpaqueCube() && this.random.nextInt(3) == 0)
{
if (l == Blocks.air && i1.isOpaqueCube() && this.random.nextInt(3) == 0) {
this.world.setBlock(i, j, k, Blocks.fire);
}
}
@@ -7,23 +7,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import tconstruct.tools.items.TitleIcon;
public class TDispenserBehaviorSpawnEgg extends BehaviorDefaultDispenseItem
{
public class TDispenserBehaviorSpawnEgg extends BehaviorDefaultDispenseItem {
/**
* Dispense the specified stack, play the dispense sound and spawn
* particles.
*/
@Override
public ItemStack dispenseStack (IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
double d0 = par1IBlockSource.getX() + (double) enumfacing.getFrontOffsetX();
double d1 = (double) ((float) par1IBlockSource.getYInt() + 0.2F);
double d2 = par1IBlockSource.getZ() + (double) enumfacing.getFrontOffsetZ();
EntityLiving entity = TitleIcon.activateSpawnEgg(par2ItemStack, par1IBlockSource.getWorld(), d0, d1, d2, 0);
if (par2ItemStack.hasDisplayName())
{
if (par2ItemStack.hasDisplayName()) {
((EntityLiving) entity).setCustomNameTag(par2ItemStack.getDisplayName());
}
+588 -180
View File
@@ -1,7 +1,7 @@
package tconstruct.world;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.registry.*;
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
@@ -44,11 +44,13 @@ import tconstruct.world.items.*;
@ObjectHolder(TConstruct.modID)
@Pulse(id = "Tinkers' World", description = "Ores, slime islands, essence berries, and the like.", forced = true)
public class TinkerWorld
{
public class TinkerWorld {
@Instance("TinkerWorld")
public static TinkerWorld instance;
@SidedProxy(clientSide = "tconstruct.world.TinkerWorldProxyClient", serverSide = "tconstruct.world.TinkerWorldProxyCommon")
@SidedProxy(
clientSide = "tconstruct.world.TinkerWorldProxyClient",
serverSide = "tconstruct.world.TinkerWorldProxyCommon")
public static TinkerWorldProxyCommon proxy;
public static Item strangeFood;
@@ -92,11 +94,10 @@ public class TinkerWorld
public static Item goldHead;
@Handler
public void preInit (FMLPreInitializationEvent event)
{
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new TinkerWorldEvents());
//Blocks
// Blocks
TinkerWorld.meatBlock = new MeatBlock().setBlockName("tconstruct.meatblock");
TinkerWorld.woolSlab1 = new SlabBase(Material.cloth, Blocks.wool, 0, 8).setBlockName("cloth");
TinkerWorld.woolSlab1.setStepSound(Block.soundTypeCloth).setCreativeTab(CreativeTabs.tabDecorations);
@@ -108,7 +109,10 @@ public class TinkerWorld
TinkerWorld.barricadeSpruce = new BarricadeBlock(Blocks.log, 1).setBlockName("trap.barricade.spruce");
TinkerWorld.barricadeBirch = new BarricadeBlock(Blocks.log, 2).setBlockName("trap.barricade.birch");
TinkerWorld.barricadeJungle = new BarricadeBlock(Blocks.log, 3).setBlockName("trap.barricade.jungle");
TinkerWorld.slimeExplosive = new SlimeExplosive().setHardness(0.0F).setStepSound(Block.soundTypeGrass).setBlockName("explosive.slime");
TinkerWorld.slimeExplosive = new SlimeExplosive()
.setHardness(0.0F)
.setStepSound(Block.soundTypeGrass)
.setBlockName("explosive.slime");
// Slime
TinkerWorld.slimeStep = new StepSoundSlime("mob.slime", 1.0f, 1.0f);
@@ -116,20 +120,43 @@ public class TinkerWorld
TinkerWorld.blueSlimeFluid = new Fluid("slime.blue");
if (!FluidRegistry.registerFluid(TinkerWorld.blueSlimeFluid))
TinkerWorld.blueSlimeFluid = FluidRegistry.getFluid("slime.blue");
TinkerWorld.slimePool = new SlimeFluid(TinkerWorld.blueSlimeFluid, Material.water).setCreativeTab(TConstructRegistry.blockTab).setStepSound(TinkerWorld.slimeStep).setBlockName("liquid.slime");
TinkerWorld.slimePool = new SlimeFluid(TinkerWorld.blueSlimeFluid, Material.water)
.setCreativeTab(TConstructRegistry.blockTab)
.setStepSound(TinkerWorld.slimeStep)
.setBlockName("liquid.slime");
GameRegistry.registerBlock(TinkerWorld.slimePool, "liquid.slime");
TinkerWorld.blueSlimeFluid.setBlock(TinkerWorld.slimePool);
// Slime Islands
TinkerWorld.slimeGel = new SlimeGel().setStepSound(TinkerWorld.slimeStep).setLightOpacity(0).setBlockName("slime.gel");
TinkerWorld.slimeGel = new SlimeGel()
.setStepSound(TinkerWorld.slimeStep)
.setLightOpacity(0)
.setBlockName("slime.gel");
TinkerWorld.slimeGel.setHarvestLevel("axe", 0, 1);
TinkerWorld.slimeGrass = new SlimeGrass().setStepSound(Block.soundTypeGrass).setLightOpacity(0).setBlockName("slime.grass");
TinkerWorld.slimeTallGrass = new SlimeTallGrass().setStepSound(Block.soundTypeGrass).setBlockName("slime.grass.tall");
TinkerWorld.slimeLeaves = (SlimeLeaves) new SlimeLeaves().setStepSound(TinkerWorld.slimeStep).setLightOpacity(0).setBlockName("slime.leaves");
TinkerWorld.slimeSapling = (SlimeSapling) new SlimeSapling().setStepSound(TinkerWorld.slimeStep).setBlockName("slime.sapling");
TinkerWorld.slimeChannel = new ConveyorBase(Material.water, "greencurrent").setHardness(0.3f).setStepSound(TinkerWorld.slimeStep).setBlockName("slime.channel");
TinkerWorld.bloodChannel = new ConveyorBase(Material.water, "liquid_cow").setHardness(0.3f).setStepSound(TinkerWorld.slimeStep).setBlockName("blood.channel");
TinkerWorld.slimePad = new SlimePad(Material.cloth).setStepSound(TinkerWorld.slimeStep).setHardness(0.3f).setBlockName("slime.pad");
TinkerWorld.slimeGrass = new SlimeGrass()
.setStepSound(Block.soundTypeGrass)
.setLightOpacity(0)
.setBlockName("slime.grass");
TinkerWorld.slimeTallGrass =
new SlimeTallGrass().setStepSound(Block.soundTypeGrass).setBlockName("slime.grass.tall");
TinkerWorld.slimeLeaves = (SlimeLeaves) new SlimeLeaves()
.setStepSound(TinkerWorld.slimeStep)
.setLightOpacity(0)
.setBlockName("slime.leaves");
TinkerWorld.slimeSapling = (SlimeSapling)
new SlimeSapling().setStepSound(TinkerWorld.slimeStep).setBlockName("slime.sapling");
TinkerWorld.slimeChannel = new ConveyorBase(Material.water, "greencurrent")
.setHardness(0.3f)
.setStepSound(TinkerWorld.slimeStep)
.setBlockName("slime.channel");
TinkerWorld.bloodChannel = new ConveyorBase(Material.water, "liquid_cow")
.setHardness(0.3f)
.setStepSound(TinkerWorld.slimeStep)
.setBlockName("blood.channel");
TinkerWorld.slimePad = new SlimePad(Material.cloth)
.setStepSound(TinkerWorld.slimeStep)
.setHardness(0.3f)
.setBlockName("slime.pad");
// Decoration
TinkerWorld.stoneTorch = new StoneTorch().setBlockName("decoration.stonetorch");
@@ -139,12 +166,29 @@ public class TinkerWorld
TinkerTools.multiBrickMetal = new MultiBrickMetal().setBlockName("Decoration.BrickMetal");
// Ores
String[] berryOres = new String[] { "berry_iron", "berry_gold", "berry_copper", "berry_tin", "berry_iron_ripe", "berry_gold_ripe", "berry_copper_ripe", "berry_tin_ripe" };
TinkerWorld.oreBerry = (OreberryBush) new OreberryBush(berryOres, 0, 4, new String[] { "oreIron", "oreGold", "oreCopper", "oreTin" }).setBlockName("ore.berries.one");
String[] berryOresTwo = new String[] { "berry_aluminum", "berry_essence", "", "", "berry_aluminum_ripe", "berry_essence_ripe", "", "" };
TinkerWorld.oreBerrySecond = (OreberryBush) new OreberryBushEssence(berryOresTwo, 4, 2, new String[] { "oreAluminum", "oreSilver" }).setBlockName("ore.berries.two");
String[] berryOres = new String[] {
"berry_iron",
"berry_gold",
"berry_copper",
"berry_tin",
"berry_iron_ripe",
"berry_gold_ripe",
"berry_copper_ripe",
"berry_tin_ripe"
};
TinkerWorld.oreBerry = (OreberryBush)
new OreberryBush(berryOres, 0, 4, new String[] {"oreIron", "oreGold", "oreCopper", "oreTin"})
.setBlockName("ore.berries.one");
String[] berryOresTwo = new String[] {
"berry_aluminum", "berry_essence", "", "", "berry_aluminum_ripe", "berry_essence_ripe", "", ""
};
TinkerWorld.oreBerrySecond =
(OreberryBush) new OreberryBushEssence(berryOresTwo, 4, 2, new String[] {"oreAluminum", "oreSilver"})
.setBlockName("ore.berries.two");
String[] oreTypes = new String[] { "nether_slag", "nether_cobalt", "nether_ardite", "ore_copper", "ore_tin", "ore_aluminum", "ore_slag" };
String[] oreTypes = new String[] {
"nether_slag", "nether_cobalt", "nether_ardite", "ore_copper", "ore_tin", "ore_aluminum", "ore_slag"
};
TinkerWorld.oreSlag = new MetalOre(Material.rock, 10.0F, oreTypes).setBlockName("tconstruct.stoneore");
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 4, 1);
TinkerWorld.oreSlag.setHarvestLevel("pickaxe", 4, 2);
@@ -160,7 +204,10 @@ public class TinkerWorld
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 4);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 4, 5);
// Rail
TinkerWorld.woodenRail = new WoodRail().setStepSound(Block.soundTypeWood).setCreativeTab(TConstructRegistry.blockTab).setBlockName("rail.wood");
TinkerWorld.woodenRail = new WoodRail()
.setStepSound(Block.soundTypeWood)
.setCreativeTab(TConstructRegistry.blockTab)
.setBlockName("rail.wood");
GameRegistry.registerBlock(TinkerWorld.meatBlock, HamboneItemBlock.class, "MeatBlock");
OreDictionary.registerOre("hambone", new ItemStack(TinkerWorld.meatBlock));
@@ -196,8 +243,10 @@ public class TinkerWorld
GameRegistry.registerBlock(TinkerWorld.stoneTorch, "decoration.stonetorch");
GameRegistry.registerBlock(TinkerWorld.stoneLadder, "decoration.stoneladder");
GameRegistry.registerBlock(TinkerTools.multiBrick, MultiBrickItem.class, "decoration.multibrick");
GameRegistry.registerBlock(TinkerTools.multiBrickFancy, MultiBrickFancyItem.class, "decoration.multibrickfancy");
GameRegistry.registerBlock(TinkerTools.multiBrickMetal, MultiBrickMetalItem.class, "decoration.multibrickmetal");
GameRegistry.registerBlock(
TinkerTools.multiBrickFancy, MultiBrickFancyItem.class, "decoration.multibrickfancy");
GameRegistry.registerBlock(
TinkerTools.multiBrickMetal, MultiBrickMetalItem.class, "decoration.multibrickmetal");
// Ores
GameRegistry.registerBlock(TinkerWorld.oreBerry, OreberryBushItem.class, "ore.berries.one");
@@ -208,19 +257,22 @@ public class TinkerWorld
// Rail
GameRegistry.registerBlock(TinkerWorld.woodenRail, "rail.wood");
//Items
goldHead = new GoldenHead(4, 1.2F, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F).setUnlocalizedName("goldenhead");
// Items
goldHead = new GoldenHead(4, 1.2F, false)
.setAlwaysEdible()
.setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F)
.setUnlocalizedName("goldenhead");
GameRegistry.registerItem(goldHead, "goldHead");
TinkerWorld.strangeFood = new StrangeFood().setUnlocalizedName("tconstruct.strangefood");
TinkerWorld.oreBerries = new OreBerries().setUnlocalizedName("oreberry");
GameRegistry.registerItem(TinkerWorld.strangeFood, "strangeFood");
GameRegistry.registerItem(TinkerWorld.oreBerries, "oreBerries");
String[] oreberries = { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Essence" };
String[] oreberries = {"Iron", "Gold", "Copper", "Tin", "Aluminum", "Essence"};
for (int i = 0; i < oreberries.length; i++)
{
TConstructRegistry.addItemStackToDirectory("oreberry" + oreberries[i], new ItemStack(TinkerWorld.oreBerries, 1, i));
for (int i = 0; i < oreberries.length; i++) {
TConstructRegistry.addItemStackToDirectory(
"oreberry" + oreberries[i], new ItemStack(TinkerWorld.oreBerries, 1, i));
}
TConstructRegistry.addItemStackToDirectory("blueSlimeFood", new ItemStack(TinkerWorld.strangeFood, 1, 0));
@@ -244,8 +296,7 @@ public class TinkerWorld
}
@Handler
public void init (FMLInitializationEvent event)
{
public void init(FMLInitializationEvent event) {
craftingTableRecipes();
addRecipesForFurnace();
addLoot();
@@ -257,13 +308,9 @@ public class TinkerWorld
}
@Handler
public void postInit (FMLPostInitializationEvent evt)
{
public void postInit(FMLPostInitializationEvent evt) {}
}
public void createEntities ()
{
public void createEntities() {
EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(DaggerEntity.class, "Dagger", 1, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 3, true);
@@ -277,187 +324,532 @@ public class TinkerWorld
// EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13,
// TConstruct.instance, 64, 5, true);
if (PHConstruct.naturalSlimeSpawn > 0)
{
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.FOREST));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.MOUNTAIN));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.HILLS));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.SWAMP));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.JUNGLE));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.WASTELAND));
if (PHConstruct.naturalSlimeSpawn > 0) {
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.FOREST));
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS));
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.MOUNTAIN));
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.HILLS));
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.SWAMP));
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.JUNGLE));
EntityRegistry.addSpawn(
BlueSlime.class,
PHConstruct.naturalSlimeSpawn,
4,
20,
EnumCreatureType.monster,
BiomeDictionary.getBiomesForType(BiomeDictionary.Type.WASTELAND));
}
}
private void craftingTableRecipes ()
{
String[] patBlock = { "###", "###", "###" };
String[] patSurround = { "###", "#m#", "###" };
private void craftingTableRecipes() {
String[] patBlock = {"###", "###", "###"};
String[] patSurround = {"###", "#m#", "###"};
// Metal conversion Recipes
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 3), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 9)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 5), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 10)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 6), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 11)); // Aluminum
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 3),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 9)); // Copper
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 5),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 10)); // Tin
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 6),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 11)); // Aluminum
// GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 6),
// patBlock, '#', new ItemStack(TRepo.materials, 1, 12)); // Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 4), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 13)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 7), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 14)); // AluBrass
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 0), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 3)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 1), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 4)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 2), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 8), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 9), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 16)); // Steel
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 11), "#", '#', new ItemStack(TinkerTools.materials, 1, 12)); // Aluminum raw ->
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 4),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 13)); // Bronze
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 7),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 14)); // AluBrass
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 0),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 3)); // Cobalt
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 1),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 4)); // Ardite
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 2),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 8),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.metalBlock, 1, 9),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 16)); // Steel
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 11),
"#",
'#',
new ItemStack(TinkerTools.materials, 1, 12)); // Aluminum raw ->
// ingot
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 9), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 3)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 10), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 5)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 11), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 6)); // Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 13), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 4)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 14), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 7)); // AluBrass
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 3), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 0)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 4), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 1)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 5), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 2)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 15), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 8)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 16), "m", 'm', new ItemStack(TinkerWorld.metalBlock, 1, 9)); // Steel
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 9),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 3)); // Copper
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 10),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 5)); // Tin
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 11),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 6)); // Aluminum
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 13),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 4)); // Bronze
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 14),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 7)); // AluBrass
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 3),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 0)); // Cobalt
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 4),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 1)); // Ardite
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 5),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 2)); // Manyullyn
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 15),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 8)); // Alumite
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 16),
"m",
'm',
new ItemStack(TinkerWorld.metalBlock, 1, 9)); // Steel
GameRegistry.addRecipe(new ItemStack(Items.iron_ingot), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 19)); // Iron
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 9), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 20)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 10), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 21)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 11), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 22)); // Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 14), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 24)); // Aluminum Brass
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 18), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 27)); // Obsidian
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 3), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 28)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 4), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 29)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 5), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 30)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 13), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 31)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 15), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 32)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 16), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 33)); // Steel
GameRegistry.addRecipe(
new ItemStack(Items.iron_ingot), patBlock, '#', new ItemStack(TinkerTools.materials, 1, 19)); // Iron
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 9),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 20)); // Copper
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 10),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 21)); // Tin
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 11),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 22)); // Aluminum
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 14),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 24)); // Aluminum Brass
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 18),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 27)); // Obsidian
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 3),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 28)); // Cobalt
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 4),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 29)); // Ardite
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 5),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 30)); // Manyullyn
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 13),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 31)); // Bronze
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 15),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 32)); // Alumite
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 1, 16),
patBlock,
'#',
new ItemStack(TinkerTools.materials, 1, 33)); // Steel
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 19), "m", 'm', new ItemStack(Items.iron_ingot)); // Iron
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 20), "m", 'm', new ItemStack(TinkerTools.materials, 1, 9)); // Copper
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 21), "m", 'm', new ItemStack(TinkerTools.materials, 1, 10)); // Tin
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 22), "m", 'm', new ItemStack(TinkerTools.materials, 1, 11)); // Aluminum
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 19), "m", 'm', new ItemStack(Items.iron_ingot)); // Iron
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 20),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 9)); // Copper
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 21),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 10)); // Tin
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 22),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 11)); // Aluminum
// GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 22), "m",
// 'm', new ItemStack(TRepo.materials, 1, 12)); //Aluminum
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 24), "m", 'm', new ItemStack(TinkerTools.materials, 1, 14)); // Aluminum Brass
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 27), "m", 'm', new ItemStack(TinkerTools.materials, 1, 18)); // Obsidian
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 28), "m", 'm', new ItemStack(TinkerTools.materials, 1, 3)); // Cobalt
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 29), "m", 'm', new ItemStack(TinkerTools.materials, 1, 4)); // Ardite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 30), "m", 'm', new ItemStack(TinkerTools.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 31), "m", 'm', new ItemStack(TinkerTools.materials, 1, 13)); // Bronze
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 32), "m", 'm', new ItemStack(TinkerTools.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 9, 33), "m", 'm', new ItemStack(TinkerTools.materials, 1, 16)); // Steel
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 24),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 14)); // Aluminum Brass
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 27),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 18)); // Obsidian
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 28),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 3)); // Cobalt
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 29),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 4)); // Ardite
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 30),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 31),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 13)); // Bronze
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 32),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(
new ItemStack(TinkerTools.materials, 9, 33),
"m",
'm',
new ItemStack(TinkerTools.materials, 1, 16)); // Steel
String[] dyeTypes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" };
String[] dyeTypes = {
"dyeBlack",
"dyeRed",
"dyeGreen",
"dyeBrown",
"dyeBlue",
"dyePurple",
"dyeCyan",
"dyeLightGray",
"dyeGray",
"dyePink",
"dyeLime",
"dyeYellow",
"dyeLightBlue",
"dyeMagenta",
"dyeOrange",
"dyeWhite"
};
String color = "";
for (int i = 0; i < 16; i++)
{
for (int i = 0; i < 16; i++) {
color = dyeTypes[15 - i];
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.wool, 8, i), patSurround, 'm', color, '#', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(Blocks.wool, 8, i),
patSurround,
'm',
color,
'#',
new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
}
// Jack o'Latern Recipe - Stone Torch
GameRegistry.addRecipe(new ItemStack(Blocks.lit_pumpkin, 1, 0), "p", "s", 'p', new ItemStack(Blocks.pumpkin), 's', new ItemStack(TinkerWorld.stoneTorch));
GameRegistry.addRecipe(
new ItemStack(Blocks.lit_pumpkin, 1, 0),
"p",
"s",
'p',
new ItemStack(Blocks.pumpkin),
's',
new ItemStack(TinkerWorld.stoneTorch));
// Stone Torch Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.stoneTorch, 4), "p", "w", 'p', new ItemStack(Items.coal, 1, Short.MAX_VALUE), 'w', "rodStone"));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(TinkerWorld.stoneTorch, 4),
"p",
"w",
'p',
new ItemStack(Items.coal, 1, Short.MAX_VALUE),
'w',
"rodStone"));
// Stone Ladder Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.stoneLadder, 3), "w w", "www", "w w", 'w', "rodStone"));
GameRegistry.addRecipe(
new ShapedOreRecipe(new ItemStack(TinkerWorld.stoneLadder, 3), "w w", "www", "w w", 'w', "rodStone"));
// Wooden Rail Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.woodenRail, 4, 0), "b b", "bxb", "b b", 'b', "plankWood", 'x', "stickWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(TinkerWorld.woodenRail, 4, 0), "b b", "bxb", "b b", 'b', "plankWood", 'x', "stickWood"));
// Stonesticks Recipes
GameRegistry.addRecipe(new ItemStack(TinkerTools.toolRod, 4, 1), "c", "c", 'c', new ItemStack(Blocks.stone));
GameRegistry.addRecipe(new ItemStack(TinkerTools.toolRod, 2, 1), "c", "c", 'c', new ItemStack(Blocks.cobblestone));
GameRegistry.addRecipe(
new ItemStack(TinkerTools.toolRod, 2, 1), "c", "c", 'c', new ItemStack(Blocks.cobblestone));
//
ItemStack aluBrass = new ItemStack(TinkerTools.materials, 1, 14);
// Clock Recipe - Vanilla alternative
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.clock), " i ", "iri", " i ", 'i', aluBrass, 'r', "dustRedstone"));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(Items.clock), " i ", "iri", " i ", 'i', aluBrass, 'r', "dustRedstone"));
// Gold Pressure Plate - Vanilla alternative
// todo: temporarily disabled due to light weighted pressure plate being smeltable to gold
//GameRegistry.addRecipe(new ItemStack(Blocks.light_weighted_pressure_plate, 0, 1), "ii", 'i', aluBrass);
// GameRegistry.addRecipe(new ItemStack(Blocks.light_weighted_pressure_plate, 0, 1), "ii", 'i', aluBrass);
// Ultra hardcore recipes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(goldHead), patSurround, '#', "ingotGold", 'm', new ItemStack(Items.skull, 1, 3)));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(goldHead), patSurround, '#', "ingotGold", 'm', new ItemStack(Items.skull, 1, 3)));
// Wool Slab Recipes
for (int sc = 0; sc <= 7; sc++)
{
GameRegistry.addRecipe(new ItemStack(TinkerWorld.woolSlab1, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.woolSlab2, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc + 8));
for (int sc = 0; sc <= 7; sc++) {
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.woolSlab1, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.woolSlab2, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc + 8));
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.wool, 1, sc), new ItemStack(TinkerWorld.woolSlab1, 1, sc), new ItemStack(TinkerWorld.woolSlab1, 1, sc));
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.wool, 1, sc + 8), new ItemStack(TinkerWorld.woolSlab2, 1, sc), new ItemStack(TinkerWorld.woolSlab2, 1, sc));
GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.wool, 1, sc),
new ItemStack(TinkerWorld.woolSlab1, 1, sc),
new ItemStack(TinkerWorld.woolSlab1, 1, sc));
GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.wool, 1, sc + 8),
new ItemStack(TinkerWorld.woolSlab2, 1, sc),
new ItemStack(TinkerWorld.woolSlab2, 1, sc));
}
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.wool, 1, 0), "slabCloth", "slabCloth"));
// Trap Recipes
GameRegistry.addRecipe(new ItemStack(TinkerWorld.punji, 5, 0), "b b", " b ", "b b", 'b', new ItemStack(Items.reeds));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.barricadeSpruce, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 1));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.barricadeBirch, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 2));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.barricadeJungle, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 3));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerWorld.barricadeOak, 1, 0), "b", "b", 'b', "logWood"));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.punji, 5, 0), "b b", " b ", "b b", 'b', new ItemStack(Items.reeds));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.barricadeSpruce, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 1));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.barricadeBirch, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 2));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.barricadeJungle, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 3));
GameRegistry.addRecipe(
new ShapedOreRecipe(new ItemStack(TinkerWorld.barricadeOak, 1, 0), "b", "b", 'b', "logWood"));
// Slime Recipes
GameRegistry.addRecipe(new ItemStack(TinkerWorld.slimeGel, 1, 0), "##", "##", '#', TinkerWorld.strangeFood);
GameRegistry.addRecipe(new ItemStack(TinkerWorld.strangeFood, 4, 0), "#", '#', new ItemStack(TinkerWorld.slimeGel, 1, 0));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.strangeFood, 4, 0), "#", '#', new ItemStack(TinkerWorld.slimeGel, 1, 0));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.slimeGel, 1, 1), "##", "##", '#', Items.slime_ball);
GameRegistry.addRecipe(new ItemStack(Items.slime_ball, 4, 0), "#", '#', new ItemStack(TinkerWorld.slimeGel, 1, 1));
GameRegistry.addRecipe(
new ItemStack(Items.slime_ball, 4, 0), "#", '#', new ItemStack(TinkerWorld.slimeGel, 1, 1));
// slimeExplosive
GameRegistry.addShapelessRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 0), Items.slime_ball, Blocks.tnt);
GameRegistry.addShapelessRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 2), TinkerWorld.strangeFood, Blocks.tnt);
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 0), "slimeball", Blocks.tnt));
GameRegistry.addShapelessRecipe(
new ItemStack(TinkerWorld.slimeExplosive, 1, 2), TinkerWorld.strangeFood, Blocks.tnt);
GameRegistry.addRecipe(
new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimeExplosive, 1, 0), "slimeball", Blocks.tnt));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimeChannel, 1, 0), new ItemStack(TinkerWorld.slimeGel, 1, Short.MAX_VALUE), "dustRedstone"));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.bloodChannel, 1, 0), new ItemStack(TinkerWorld.strangeFood, 1, 1), new ItemStack(TinkerWorld.strangeFood, 1, 1), new ItemStack(TinkerWorld.strangeFood, 1, 1), new ItemStack(TinkerWorld.strangeFood, 1, 1), "dustRedstone"));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimeChannel, 1, 0), "slimeball", "slimeball", "slimeball", "slimeball", "dustRedstone"));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerWorld.slimePad, 1, 0), TinkerWorld.slimeChannel, "slimeball"));
GameRegistry.addRecipe(new ShapelessOreRecipe(
new ItemStack(TinkerWorld.slimeChannel, 1, 0),
new ItemStack(TinkerWorld.slimeGel, 1, Short.MAX_VALUE),
"dustRedstone"));
GameRegistry.addRecipe(new ShapelessOreRecipe(
new ItemStack(TinkerWorld.bloodChannel, 1, 0),
new ItemStack(TinkerWorld.strangeFood, 1, 1),
new ItemStack(TinkerWorld.strangeFood, 1, 1),
new ItemStack(TinkerWorld.strangeFood, 1, 1),
new ItemStack(TinkerWorld.strangeFood, 1, 1),
"dustRedstone"));
GameRegistry.addRecipe(new ShapelessOreRecipe(
new ItemStack(TinkerWorld.slimeChannel, 1, 0),
"slimeball",
"slimeball",
"slimeball",
"slimeball",
"dustRedstone"));
GameRegistry.addRecipe(new ShapelessOreRecipe(
new ItemStack(TinkerWorld.slimePad, 1, 0), TinkerWorld.slimeChannel, "slimeball"));
GameRegistry.addRecipe(new ItemStack(TinkerWorld.meatBlock), "mmm", "mbm", "mmm", 'b', new ItemStack(Items.bone), 'm', new ItemStack(Items.porkchop));
GameRegistry.addRecipe(
new ItemStack(TinkerWorld.meatBlock),
"mmm",
"mbm",
"mmm",
'b',
new ItemStack(Items.bone),
'm',
new ItemStack(Items.porkchop));
}
private void addRecipesForFurnace ()
{
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 3), new ItemStack(TinkerTools.craftedSoil, 1, 4), 0.2f); // Concecrated
private void addRecipesForFurnace() {
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.craftedSoil, 1, 3),
new ItemStack(TinkerTools.craftedSoil, 1, 4),
0.2f); // Concecrated
// Soil
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 0), new ItemStack(TinkerTools.materials, 1, 1), 2f); // Slime
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 1), new ItemStack(TinkerTools.materials, 1, 2), 2f); // Seared brick item
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 2), new ItemStack(TinkerTools.materials, 1, 17), 2f); // Blue Slime
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.craftedSoil, 1, 6), new ItemStack(TinkerTools.materials, 1, 37), 2f); // Nether seared
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.craftedSoil, 1, 0),
new ItemStack(TinkerTools.materials, 1, 1),
2f); // Slime
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.craftedSoil, 1, 1),
new ItemStack(TinkerTools.materials, 1, 2),
2f); // Seared brick item
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.craftedSoil, 1, 2),
new ItemStack(TinkerTools.materials, 1, 17),
2f); // Blue Slime
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.craftedSoil, 1, 6),
new ItemStack(TinkerTools.materials, 1, 37),
2f); // Nether seared
// brick
// FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag,
// 1, new ItemStack(TRepo.materials, 1, 3), 3f);
// FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag,
// 2, new ItemStack(TRepo.materials, 1, 4), 3f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreSlag, 1, 3), new ItemStack(TinkerTools.materials, 1, 9), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreSlag, 1, 4), new ItemStack(TinkerTools.materials, 1, 10), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreSlag, 1, 5), new ItemStack(TinkerTools.materials, 1, 11), 0.5f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreSlag, 1, 3), new ItemStack(TinkerTools.materials, 1, 9), 0.5f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreSlag, 1, 4), new ItemStack(TinkerTools.materials, 1, 10), 0.5f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreSlag, 1, 5), new ItemStack(TinkerTools.materials, 1, 11), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 0), new ItemStack(TinkerTools.materials, 1, 19), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 1), new ItemStack(Items.gold_nugget), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 2), new ItemStack(TinkerTools.materials, 1, 20), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 3), new ItemStack(TinkerTools.materials, 1, 21), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 4), new ItemStack(TinkerTools.materials, 1, 22), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreBerries, 1, 0), new ItemStack(TinkerTools.materials, 1, 19), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(new ItemStack(TinkerWorld.oreBerries, 1, 1), new ItemStack(Items.gold_nugget), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreBerries, 1, 2), new ItemStack(TinkerTools.materials, 1, 20), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreBerries, 1, 3), new ItemStack(TinkerTools.materials, 1, 21), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreBerries, 1, 4), new ItemStack(TinkerTools.materials, 1, 22), 0.2f);
// FurnaceRecipes.smelting().func_151394_a(new
// ItemStack(TRepo.oreBerries, 5, new ItemStack(TRepo.materials, 1, 23),
// 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 0), new ItemStack(Items.iron_ingot), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 1), new ItemStack(Items.gold_ingot), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 2), new ItemStack(TinkerTools.materials, 1, 9), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 3), new ItemStack(TinkerTools.materials, 1, 10), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 4), new ItemStack(TinkerTools.materials, 1, 11), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 38), new ItemStack(TinkerTools.materials, 1, 4), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 39), new ItemStack(TinkerTools.materials, 1, 3), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 40), new ItemStack(TinkerTools.materials, 1, 11), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 41), new ItemStack(TinkerTools.materials, 1, 5), 0.2f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(TinkerTools.materials, 1, 42), new ItemStack(TinkerTools.materials, 1, 14), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 0), new ItemStack(Items.iron_ingot), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(new ItemStack(TinkerWorld.oreGravel, 1, 1), new ItemStack(Items.gold_ingot), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreGravel, 1, 2), new ItemStack(TinkerTools.materials, 1, 9), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreGravel, 1, 3), new ItemStack(TinkerTools.materials, 1, 10), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerWorld.oreGravel, 1, 4), new ItemStack(TinkerTools.materials, 1, 11), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.materials, 1, 38), new ItemStack(TinkerTools.materials, 1, 4), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.materials, 1, 39), new ItemStack(TinkerTools.materials, 1, 3), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.materials, 1, 40), new ItemStack(TinkerTools.materials, 1, 11), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.materials, 1, 41), new ItemStack(TinkerTools.materials, 1, 5), 0.2f);
FurnaceRecipes.smelting()
.func_151394_a(
new ItemStack(TinkerTools.materials, 1, 42), new ItemStack(TinkerTools.materials, 1, 14), 0.2f);
}
public void oreRegistry ()
{
public void oreRegistry() {
OreDictionary.registerOre("oreCobalt", new ItemStack(TinkerWorld.oreSlag, 1, 1));
OreDictionary.registerOre("oreArdite", new ItemStack(TinkerWorld.oreSlag, 1, 2));
OreDictionary.registerOre("oreCopper", new ItemStack(TinkerWorld.oreSlag, 1, 3));
@@ -532,44 +924,60 @@ public class TinkerWorld
RecipeRemover.removeShapedRecipe(new ItemStack(Items.magma_cream));
RecipeRemover.removeShapedRecipe(new ItemStack(Items.lead));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.sticky_piston), "slimeball", Blocks.piston));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.magma_cream), "slimeball", Items.blaze_powder));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.lead, 2), "ss ", "sS ", " s", 's', Items.string, 'S', "slimeball"));
GameRegistry.addRecipe(
new ShapelessOreRecipe(new ItemStack(Items.magma_cream), "slimeball", Items.blaze_powder));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(Items.lead, 2), "ss ", "sS ", " s", 's', Items.string, 'S', "slimeball"));
}
public static void ensureOreIsRegistered (String oreName, ItemStack is)
{
public static void ensureOreIsRegistered(String oreName, ItemStack is) {
int oreId = OreDictionary.getOreID(is);
if (oreId == -1)
{
if (oreId == -1) {
OreDictionary.registerOre(oreName, is);
}
}
public void addLoot ()
{
public void addLoot() {
// Item, min, max, weight
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 5));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 10));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 10));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
.addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 5));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST)
.addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 10));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST)
.addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 10));
TinkerWorld.tinkerHouseChest = new ChestGenHooks("TinkerHouse", new WeightedRandomChestContent[0], 3, 27);
TinkerWorld.tinkerHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 1));
int[] validTypes = { 0, 1, 2, 3, 4, 5, 6, 8, 9, 13, 14, 17 };
Item[] partTypes = { TinkerTools.pickaxeHead, TinkerTools.shovelHead, TinkerTools.hatchetHead, TinkerTools.binding, TinkerTools.swordBlade, TinkerTools.wideGuard, TinkerTools.handGuard, TinkerTools.crossbar, TinkerTools.knifeBlade, TinkerTools.frypanHead, TinkerTools.signHead, TinkerTools.chiselHead };
TinkerWorld.tinkerHouseChest.addItem(
new WeightedRandomChestContent(new ItemStack(TinkerArmor.heartCanister, 1, 1), 1, 1, 1));
int[] validTypes = {0, 1, 2, 3, 4, 5, 6, 8, 9, 13, 14, 17};
Item[] partTypes = {
TinkerTools.pickaxeHead,
TinkerTools.shovelHead,
TinkerTools.hatchetHead,
TinkerTools.binding,
TinkerTools.swordBlade,
TinkerTools.wideGuard,
TinkerTools.handGuard,
TinkerTools.crossbar,
TinkerTools.knifeBlade,
TinkerTools.frypanHead,
TinkerTools.signHead,
TinkerTools.chiselHead
};
for (int partIter = 0; partIter < partTypes.length; partIter++)
{
for (int typeIter = 0; typeIter < validTypes.length; typeIter++)
{
TinkerWorld.tinkerHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(partTypes[partIter], 1, validTypes[typeIter]), 1, 1, 15));
for (int partIter = 0; partIter < partTypes.length; partIter++) {
for (int typeIter = 0; typeIter < validTypes.length; typeIter++) {
TinkerWorld.tinkerHouseChest.addItem(new WeightedRandomChestContent(
new ItemStack(partTypes[partIter], 1, validTypes[typeIter]), 1, 1, 15));
}
}
TinkerWorld.tinkerHousePatterns = new ChestGenHooks("TinkerPatterns", new WeightedRandomChestContent[0], 5, 30);
for (int i = 0; i < 13; i++)
{
TinkerWorld.tinkerHousePatterns.addItem(new WeightedRandomChestContent(new ItemStack(TinkerTools.woodPattern, 1, i + 1), 1, 3, 20));
for (int i = 0; i < 13; i++) {
TinkerWorld.tinkerHousePatterns.addItem(
new WeightedRandomChestContent(new ItemStack(TinkerTools.woodPattern, 1, i + 1), 1, 3, 20));
}
TinkerWorld.tinkerHousePatterns.addItem(new WeightedRandomChestContent(new ItemStack(TinkerTools.woodPattern, 1, 22), 1, 3, 40));
TinkerWorld.tinkerHousePatterns.addItem(
new WeightedRandomChestContent(new ItemStack(TinkerTools.woodPattern, 1, 22), 1, 3, 40));
}
}
@@ -16,30 +16,24 @@ import tconstruct.tools.TinkerTools;
import tconstruct.util.ItemHelper;
import tconstruct.util.config.PHConstruct;
public class TinkerWorldEvents
{
public class TinkerWorldEvents {
@SubscribeEvent
public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event)
{
public void onLivingSpawn(LivingSpawnEvent.SpecialSpawn event) {
EntityLivingBase living = event.entityLiving;
if (living.getClass() == EntitySpider.class && TConstruct.random.nextInt(100) == 0)
{
if (living.getClass() == EntitySpider.class && TConstruct.random.nextInt(100) == 0) {
EntityCreeper creeper = new EntityCreeper(living.worldObj);
spawnEntityLiving(living.posX, living.posY + 1, living.posZ, creeper, living.worldObj);
if (living.riddenByEntity != null)
creeper.mountEntity(living.riddenByEntity);
else
creeper.mountEntity(living);
if (living.riddenByEntity != null) creeper.mountEntity(living.riddenByEntity);
else creeper.mountEntity(living);
EntityXPOrb orb = new EntityXPOrb(living.worldObj, living.posX, living.posY, living.posZ, TConstruct.random.nextInt(20) + 20);
EntityXPOrb orb = new EntityXPOrb(
living.worldObj, living.posX, living.posY, living.posZ, TConstruct.random.nextInt(20) + 20);
orb.mountEntity(creeper);
}
}
public static void spawnEntityLiving (double x, double y, double z, EntityLiving entity, World world)
{
if (!world.isRemote)
{
public static void spawnEntityLiving(double x, double y, double z, EntityLiving entity, World world) {
if (!world.isRemote) {
entity.setPosition(x, y, z);
entity.onSpawnWithEgg((IEntityLivingData) null);
world.spawnEntityInWorld(entity);
@@ -48,13 +42,11 @@ public class TinkerWorldEvents
/* Bonemeal */
@SubscribeEvent
public void bonemealEvent (BonemealEvent event)
{
if (!event.world.isRemote)
{
if (event.block == TinkerWorld.slimeSapling)
{
if (TinkerWorld.slimeSapling.boneFertilize(event.world, event.x, event.y, event.z, event.world.rand, event.entityPlayer))
public void bonemealEvent(BonemealEvent event) {
if (!event.world.isRemote) {
if (event.block == TinkerWorld.slimeSapling) {
if (TinkerWorld.slimeSapling.boneFertilize(
event.world, event.x, event.y, event.z, event.world.rand, event.entityPlayer))
event.setResult(Event.Result.ALLOW);
}
}
@@ -62,40 +54,30 @@ public class TinkerWorldEvents
/* Damage */
@SubscribeEvent
public void onHurt (LivingHurtEvent event)
{
public void onHurt(LivingHurtEvent event) {
EntityLivingBase reciever = event.entityLiving;
if (reciever instanceof EntityPlayer)
{
if (reciever instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
// Cutlass
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && player.isUsingItem())
{
if (stack != null && player.isUsingItem()) {
Item item = stack.getItem();
if (item == TinkerTools.cutlass)
{
if (item == TinkerTools.cutlass) {
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1));
}
else if (item == TinkerTools.battlesign)
{
event.ammount *= 1.5; //Puts battlesign blocking at 3/4 instead of 1/2
} else if (item == TinkerTools.battlesign) {
event.ammount *= 1.5; // Puts battlesign blocking at 3/4 instead of 1/2
}
}
}
else if (reciever instanceof EntityCreeper)
{
} else if (reciever instanceof EntityCreeper) {
Entity attacker = event.source.getEntity();
if (attacker instanceof EntityLivingBase)
{
if (attacker instanceof EntityLivingBase) {
Entity target = ((EntityCreeper) reciever).getAttackTarget();
if (target != null)
{
if (target != null) {
float d1 = reciever.getDistanceToEntity(((EntityCreeper) reciever).getAttackTarget());
float d2 = reciever.getDistanceToEntity(attacker);
if (d2 < d1)
{
((EntityCreeper) event.entityLiving).setAttackTarget((EntityLivingBase) event.source.getEntity());
if (d2 < d1) {
((EntityCreeper) event.entityLiving)
.setAttackTarget((EntityLivingBase) event.source.getEntity());
}
}
}
@@ -103,25 +85,17 @@ public class TinkerWorldEvents
}
@SubscribeEvent
public void onLivingDrop (LivingDropsEvent event)
{
if (event.entityLiving == null)
return;
public void onLivingDrop(LivingDropsEvent event) {
if (event.entityLiving == null) return;
if (event.entityLiving.getClass() == EntityGhast.class)
{
if (PHConstruct.uhcGhastDrops)
{
for (EntityItem o : event.drops)
{
if (o.getEntityItem().getItem() == Items.ghast_tear)
{
if (event.entityLiving.getClass() == EntityGhast.class) {
if (PHConstruct.uhcGhastDrops) {
for (EntityItem o : event.drops) {
if (o.getEntityItem().getItem() == Items.ghast_tear) {
o.setEntityItemStack(new ItemStack(Items.gold_ingot, 1));
}
}
}
else
{
} else {
ItemHelper.addDrops(event, new ItemStack(Items.ghast_tear, 1));
}
}
@@ -15,18 +15,15 @@ import tconstruct.tools.TinkerTools;
import tconstruct.world.entity.*;
import tconstruct.world.model.*;
public class TinkerWorldProxyClient extends TinkerWorldProxyCommon
{
public class TinkerWorldProxyClient extends TinkerWorldProxyCommon {
@Override
public void initialize ()
{
public void initialize() {
registerRenderer();
registerManualIcons();
registerManualRecipes();
}
void registerRenderer ()
{
void registerRenderer() {
RenderingRegistry.registerBlockHandler(new OreberryRender());
RenderingRegistry.registerBlockHandler(new BarricadeRender());
RenderingRegistry.registerBlockHandler(new RenderLandmine());
@@ -40,16 +37,13 @@ public class TinkerWorldProxyClient extends TinkerWorldProxyCommon
RenderingRegistry.registerEntityRenderingHandler(KingBlueSlime.class, slimeRender);
RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender());
VillagerRegistry.instance().registerVillagerSkin(78943, new ResourceLocation("tinker", "textures/mob/villagertools.png"));
VillagerRegistry.instance()
.registerVillagerSkin(78943, new ResourceLocation("tinker", "textures/mob/villagertools.png"));
}
void registerManualIcons ()
{
void registerManualIcons() {}
}
void registerManualRecipes ()
{
void registerManualRecipes() {
ItemStack netherrack = new ItemStack(Blocks.netherrack);
ItemStack coal = new ItemStack(Items.coal);
ItemStack log = new ItemStack(Blocks.log, 1, 0);
@@ -57,38 +51,54 @@ public class TinkerWorldProxyClient extends TinkerWorldProxyCommon
ItemStack graveyardsoil = new ItemStack(TinkerTools.craftedSoil, 1, 3);
ItemStack consecratedsoil = new ItemStack(TinkerTools.craftedSoil, 1, 4);
MantleClientRegistry.registerManualSmallRecipe("slimechannel", new ItemStack(TinkerWorld.slimeChannel, 1, 0), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Items.redstone), null, null);
MantleClientRegistry.registerManualSmallRecipe("bouncepad", new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimeChannel), new ItemStack(Items.slime_ball), null, null);
MantleClientRegistry.registerManualSmallRecipe(
"slimechannel",
new ItemStack(TinkerWorld.slimeChannel, 1, 0),
new ItemStack(TinkerWorld.slimeGel, 1, 0),
new ItemStack(Items.redstone),
null,
null);
MantleClientRegistry.registerManualSmallRecipe(
"bouncepad",
new ItemStack(TinkerWorld.slimePad, 1, 0),
new ItemStack(TinkerWorld.slimeChannel),
new ItemStack(Items.slime_ball),
null,
null);
MantleClientRegistry.registerManualSmallRecipe("graveyardsoil", graveyardsoil, new ItemStack(Blocks.dirt), new ItemStack(Items.rotten_flesh), new ItemStack(Items.dye, 1, 15), null);
MantleClientRegistry.registerManualSmallRecipe(
"graveyardsoil",
graveyardsoil,
new ItemStack(Blocks.dirt),
new ItemStack(Items.rotten_flesh),
new ItemStack(Items.dye, 1, 15),
null);
MantleClientRegistry.registerManualFurnaceRecipe("consecratedsoil", consecratedsoil, graveyardsoil);
// Traps
ItemStack reed = new ItemStack(Items.reeds);
MantleClientRegistry.registerManualLargeRecipe("punji", new ItemStack(TinkerWorld.punji, 5), reed, null, reed, null, reed, null, reed, null, reed);
MantleClientRegistry.registerManualSmallRecipe("barricade", new ItemStack(TinkerWorld.barricadeOak), null, log, null, log);
MantleClientRegistry.registerManualLargeRecipe(
"punji", new ItemStack(TinkerWorld.punji, 5), reed, null, reed, null, reed, null, reed, null, reed);
MantleClientRegistry.registerManualSmallRecipe(
"barricade", new ItemStack(TinkerWorld.barricadeOak), null, log, null, log);
}
Minecraft mc = Minecraft.getMinecraft();
@Override
public void spawnParticle (String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
{
public void spawnParticle(
String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ) {
this.doSpawnParticle(particle, xPos, yPos, zPos, velX, velY, velZ);
}
public EntityFX doSpawnParticle (String par1Str, double par2, double par4, double par6, double par8, double par10, double par12)
{
if (this.mc == null)
this.mc = Minecraft.getMinecraft();
public EntityFX doSpawnParticle(
String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) {
if (this.mc == null) this.mc = Minecraft.getMinecraft();
if (this.mc.renderViewEntity != null && this.mc.effectRenderer != null)
{
if (this.mc.renderViewEntity != null && this.mc.effectRenderer != null) {
int i = this.mc.gameSettings.particleSetting;
if (i == 1 && mc.theWorld.rand.nextInt(3) == 0)
{
if (i == 1 && mc.theWorld.rand.nextInt(3) == 0) {
i = 2;
}
@@ -97,180 +107,112 @@ public class TinkerWorldProxyClient extends TinkerWorldProxyCommon
double d8 = this.mc.renderViewEntity.posZ - par6;
EntityFX entityfx = null;
if (par1Str.equals("hugeexplosion"))
{
this.mc.effectRenderer.addEffect(entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
}
else if (par1Str.equals("largeexplode"))
{
this.mc.effectRenderer.addEffect(entityfx = new EntityLargeExplodeFX(mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
}
else if (par1Str.equals("fireworksSpark"))
{
this.mc.effectRenderer.addEffect(entityfx = new EntityFireworkSparkFX(mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
if (par1Str.equals("hugeexplosion")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityHugeExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12));
} else if (par1Str.equals("largeexplode")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityLargeExplodeFX(
mc.renderEngine, mc.theWorld, par2, par4, par6, par8, par10, par12));
} else if (par1Str.equals("fireworksSpark")) {
this.mc.effectRenderer.addEffect(
entityfx = new EntityFireworkSparkFX(
mc.theWorld, par2, par4, par6, par8, par10, par12, this.mc.effectRenderer));
}
if (entityfx != null)
{
if (entityfx != null) {
return (EntityFX) entityfx;
}
else
{
} else {
double d9 = 16.0D;
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9)
{
if (d6 * d6 + d7 * d7 + d8 * d8 > d9 * d9) {
return null;
}
else if (i > 1)
{
} else if (i > 1) {
return null;
}
else
{
if (par1Str.equals("bubble"))
{
} else {
if (par1Str.equals("bubble")) {
entityfx = new EntityBubbleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("suspended"))
{
} else if (par1Str.equals("suspended")) {
entityfx = new EntitySuspendFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("depthsuspend"))
{
} else if (par1Str.equals("depthsuspend")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("townaura"))
{
} else if (par1Str.equals("townaura")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("crit"))
{
} else if (par1Str.equals("crit")) {
entityfx = new EntityCritFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("smoke"))
{
} else if (par1Str.equals("smoke")) {
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("mobSpell"))
{
} else if (par1Str.equals("mobSpell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
}
else if (par1Str.equals("mobSpellAmbient"))
{
} else if (par1Str.equals("mobSpellAmbient")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, 0.0D, 0.0D, 0.0D);
((EntityFX) entityfx).setAlphaF(0.15F);
((EntityFX) entityfx).setRBGColorF((float) par8, (float) par10, (float) par12);
}
else if (par1Str.equals("spell"))
{
} else if (par1Str.equals("spell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("instantSpell"))
{
} else if (par1Str.equals("instantSpell")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
}
else if (par1Str.equals("witchMagic"))
{
} else if (par1Str.equals("witchMagic")) {
entityfx = new EntitySpellParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
float f = mc.theWorld.rand.nextFloat() * 0.5F + 0.35F;
((EntityFX) entityfx).setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
}
else if (par1Str.equals("note"))
{
} else if (par1Str.equals("note")) {
entityfx = new EntityNoteFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("portal"))
{
} else if (par1Str.equals("portal")) {
entityfx = new EntityPortalFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("enchantmenttable"))
{
entityfx = new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("explode"))
{
} else if (par1Str.equals("enchantmenttable")) {
entityfx =
new EntityEnchantmentTableParticleFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
} else if (par1Str.equals("explode")) {
entityfx = new EntityExplodeFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("flame"))
{
} else if (par1Str.equals("flame")) {
entityfx = new EntityFlameFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("lava"))
{
} else if (par1Str.equals("lava")) {
entityfx = new EntityLavaFX(mc.theWorld, par2, par4, par6);
}
else if (par1Str.equals("footstep"))
{
} else if (par1Str.equals("footstep")) {
entityfx = new EntityFootStepFX(mc.renderEngine, mc.theWorld, par2, par4, par6);
}
else if (par1Str.equals("splash"))
{
} else if (par1Str.equals("splash")) {
entityfx = new EntitySplashFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("largesmoke"))
{
} else if (par1Str.equals("largesmoke")) {
entityfx = new EntitySmokeFX(mc.theWorld, par2, par4, par6, par8, par10, par12, 2.5F);
}
else if (par1Str.equals("cloud"))
{
} else if (par1Str.equals("cloud")) {
entityfx = new EntityCloudFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("reddust"))
{
entityfx = new EntityReddustFX(mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
}
else if (par1Str.equals("snowballpoof"))
{
} else if (par1Str.equals("reddust")) {
entityfx = new EntityReddustFX(
mc.theWorld, par2, par4, par6, (float) par8, (float) par10, (float) par12);
} else if (par1Str.equals("snowballpoof")) {
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, Items.snowball);
}
else if (par1Str.equals("dripWater"))
{
} else if (par1Str.equals("dripWater")) {
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.water);
}
else if (par1Str.equals("dripLava"))
{
} else if (par1Str.equals("dripLava")) {
entityfx = new EntityDropParticleFX(mc.theWorld, par2, par4, par6, Material.lava);
}
else if (par1Str.equals("snowshovel"))
{
} else if (par1Str.equals("snowshovel")) {
entityfx = new EntitySnowShovelFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("blueslime"))
{
} else if (par1Str.equals("blueslime")) {
entityfx = new EntityBreakingFX(mc.theWorld, par2, par4, par6, TinkerWorld.strangeFood);
}
else if (par1Str.equals("heart"))
{
} else if (par1Str.equals("heart")) {
entityfx = new EntityHeartFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
}
else if (par1Str.equals("angryVillager"))
{
} else if (par1Str.equals("angryVillager")) {
entityfx = new EntityHeartFX(mc.theWorld, par2, par4 + 0.5D, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(81);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
}
else if (par1Str.equals("happyVillager"))
{
} else if (par1Str.equals("happyVillager")) {
entityfx = new EntityAuraFX(mc.theWorld, par2, par4, par6, par8, par10, par12);
((EntityFX) entityfx).setParticleTextureIndex(82);
((EntityFX) entityfx).setRBGColorF(1.0F, 1.0F, 1.0F);
}
if (entityfx != null)
{
if (entityfx != null) {
this.mc.effectRenderer.addEffect((EntityFX) entityfx);
}
return (EntityFX) entityfx;
}
}
}
else
{
} else {
return null;
}
}
@@ -1,16 +1,9 @@
package tconstruct.world;
public class TinkerWorldProxyCommon
{
public class TinkerWorldProxyCommon {
public void spawnParticle (String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ)
{
}
public void initialize ()
{
}
public void spawnParticle(
String particle, double xPos, double yPos, double zPos, double velX, double velY, double velZ) {}
public void initialize() {}
}
@@ -12,94 +12,85 @@ import net.minecraft.world.*;
import tconstruct.library.TConstructRegistry;
import tconstruct.world.model.SlimeChannelRender;
public class ConveyorBase extends MantleBlock
{
public class ConveyorBase extends MantleBlock {
String texturename;
public ConveyorBase(Material material, String name)
{
public ConveyorBase(Material material, String name) {
super(material);
this.setCreativeTab(TConstructRegistry.blockTab);
setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
texturename = name;
}
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
public boolean isBlockReplaceable(World world, int x, int y, int z) {
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
{
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (!world.isBlockIndirectlyGettingPowered(x, y, z)) {
double moveX = 0;
double moveZ = 0;
double speed = 0.01;
int meta = world.getBlockMetadata(x, y, z);
switch (meta % 8)
{
case 6:
moveX += speed;
break;
case 7:
moveX += speed;
moveZ += speed;
break;
case 0:
moveZ += speed;
break;
case 1:
moveZ += speed;
moveX -= speed;
break;
case 2:
moveX -= speed;
break;
case 3:
moveX -= speed;
moveZ -= speed;
break;
case 4:
moveZ -= speed;
break;
case 5:
moveZ -= speed;
moveX += speed;
break;
switch (meta % 8) {
case 6:
moveX += speed;
break;
case 7:
moveX += speed;
moveZ += speed;
break;
case 0:
moveZ += speed;
break;
case 1:
moveZ += speed;
moveX -= speed;
break;
case 2:
moveX -= speed;
break;
case 3:
moveX -= speed;
moveZ -= speed;
break;
case 4:
moveZ -= speed;
break;
case 5:
moveZ -= speed;
moveX += speed;
break;
}
entity.addVelocity(moveX, 0, moveZ);
}
if (entity instanceof EntityItem)
{
if (entity instanceof EntityItem) {
((EntityItem) entity).age = 0;
}
}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7;
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D)
+ (entity.isSneaking() ? 4 : 0)
& 7;
int meta = world.getBlockMetadata(x, y, z) & 8;
world.setBlockMetadataWithNotify(x, y, z, face | meta, 2);
}
@Override
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
if (side == 1)
return false;
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
if (side == 1) return false;
return super.shouldSideBeRendered(world, x, y, z, side);
}
@@ -107,47 +98,39 @@ public class ConveyorBase extends MantleBlock
/* Rendering */
@Override
public boolean renderAsNormalBlock ()
{
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube ()
{
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderBlockPass ()
{
public int getRenderBlockPass() {
return 1;
}
@Override
public int getRenderType ()
{
public int getRenderType() {
return SlimeChannelRender.model;
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
String[] textureNames = new String[] { texturename, texturename + "_flow" };
public void registerBlockIcons(IIconRegister iconRegister) {
String[] textureNames = new String[] {texturename, texturename + "_flow"};
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
for (int i = 0; i < this.icons.length; ++i) {
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (meta >= 8)
return icons[0];
public IIcon getIcon(int side, int meta) {
if (meta >= 8) return icons[0];
return side == 1 ? icons[1] : icons[0];
}
}
@@ -12,69 +12,56 @@ import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
import tconstruct.world.TinkerWorld;
public class GravelOre extends BlockSand
{
public String[] textureNames = new String[] { "iron", "gold", "copper", "tin", "aluminum", "cobalt" };
public class GravelOre extends BlockSand {
public String[] textureNames = new String[] {"iron", "gold", "copper", "tin", "aluminum", "cobalt"};
public IIcon[] icons;
public GravelOre()
{
public GravelOre() {
this.blockMaterial = Material.craftedSnow;
this.setCreativeTab(TConstructRegistry.blockTab);
this.setStepSound(soundTypeGravel);
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
public void registerBlockIcons(IIconRegister iconRegister) {
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
for (int i = 0; i < this.icons.length; ++i) {
this.icons[i] = iconRegister.registerIcon("tinker:ore_" + textureNames[i] + "_gravel");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (meta >= textureNames.length)
return icons[0];
public IIcon getIcon(int side, int meta) {
if (meta >= textureNames.length) return icons[0];
return icons[meta];
}
public float getBlockHardness (World world, int x, int y, int z)
{
public float getBlockHardness(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 5)
return 10f;
else
return 3f;
if (meta == 5) return 10f;
else return 3f;
}
@Override
public int damageDropped (int meta)
{
public int damageDropped(int meta) {
/*if (meta == 1)
return 0;*/
return 0;*/
return meta;
}
@Override
public Item getItemDropped (int par1, Random par2Random, int par3)
{
public Item getItemDropped(int par1, Random par2Random, int par3) {
/*if (par1 == 1)
return Item.goldNugget.itemID;*/
return Item.goldNugget.itemID;*/
return Item.getItemFromBlock(TinkerWorld.oreGravel);
}
@Override
public void getSubBlocks (Item id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 6; iter++)
{
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
for (int iter = 0; iter < 6; iter++) {
list.add(new ItemStack(id, 1, iter));
}
}
}
}
@@ -10,13 +10,11 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.*;
import tconstruct.library.TConstructRegistry;
public class MeatBlock extends BlockWood
{
public class MeatBlock extends BlockWood {
public IIcon[] icons;
public String[] textureNames = new String[] { "ham_skin", "ham_bone" };
public String[] textureNames = new String[] {"ham_skin", "ham_bone"};
public MeatBlock()
{
public MeatBlock() {
this.setHardness(1.0F);
this.setStepSound(Block.soundTypeWood);
// setBurnProperties(this.blockID, 5, 20);
@@ -25,26 +23,22 @@ public class MeatBlock extends BlockWood
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int metadata)
{
public IIcon getIcon(int side, int metadata) {
int tex = (metadata % 4) * 2;
int orientation = metadata / 4;
switch (orientation)
// Ends of logs
{
case 0:
if (side == 0 || side == 1)
return icons[tex + 1];
break;
case 1:
if (side == 4 || side == 5)
return icons[tex + 1];
break;
case 2:
if (side == 2 || side == 3)
return icons[tex + 1];
break;
case 0:
if (side == 0 || side == 1) return icons[tex + 1];
break;
case 1:
if (side == 4 || side == 5) return icons[tex + 1];
break;
case 2:
if (side == 2 || side == 3) return icons[tex + 1];
break;
}
return icons[tex];
@@ -52,19 +46,16 @@ public class MeatBlock extends BlockWood
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
public void registerBlockIcons(IIconRegister iconRegister) {
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
for (int i = 0; i < this.icons.length; ++i) {
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
public Item getItemDropped (int par1, Random par2Random, int par3)
{
public Item getItemDropped(int par1, Random par2Random, int par3) {
return new ItemStack(this).getItem();
}
@@ -72,23 +63,17 @@ public class MeatBlock extends BlockWood
* ejects contained items into the world, and notifies neighbours of an
* update, as appropriate
*/
public void breakBlock (World par1World, int par2, int par3, int par4, int par5, int par6)
{
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
byte b0 = 4;
int j1 = b0 + 1;
if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1))
{
for (int k1 = -b0; k1 <= b0; ++k1)
{
for (int l1 = -b0; l1 <= b0; ++l1)
{
for (int i2 = -b0; i2 <= b0; ++i2)
{
if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) {
for (int k1 = -b0; k1 <= b0; ++k1) {
for (int l1 = -b0; l1 <= b0; ++l1) {
for (int i2 = -b0; i2 <= b0; ++i2) {
Block j2 = par1World.getBlock(par2 + k1, par3 + l1, par4 + i2);
if (j2 != null)
{
if (j2 != null) {
j2.beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
}
}
@@ -102,24 +87,23 @@ public class MeatBlock extends BlockWood
* side, hitX, hitY, hitZ, block metadata
*/
@Override
public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
{
public int onBlockPlaced(
World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) {
int j1 = par9 & 3;
byte b0 = 0;
switch (par5)
{
case 0:
case 1:
b0 = 0;
break;
case 2:
case 3:
b0 = 8;
break;
case 4:
case 5:
b0 = 4;
switch (par5) {
case 0:
case 1:
b0 = 0;
break;
case 2:
case 3:
b0 = 8;
break;
case 4:
case 5:
b0 = 4;
}
return j1 | b0;
@@ -130,27 +114,23 @@ public class MeatBlock extends BlockWood
* wood.
*/
@Override
public int damageDropped (int par1)
{
public int damageDropped(int par1) {
return par1 & 3;
}
/**
* returns a number between 0 and 3
*/
public static int limitToValidMetadata (int par0)
{
public static int limitToValidMetadata(int par0) {
return par0 & 3;
}
@Override
protected ItemStack createStackedBlock (int par1)
{
protected ItemStack createStackedBlock(int par1) {
return new ItemStack(this, 1, limitToValidMetadata(par1));
}
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
public boolean isBlockReplaceable(World world, int x, int y, int z) {
return false;
}
@@ -163,15 +143,12 @@ public class MeatBlock extends BlockWood
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < icons.length / 2; i++)
par3List.add(new ItemStack(b, 1, i));
public void getSubBlocks(Item b, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < icons.length / 2; i++) par3List.add(new ItemStack(b, 1, i));
}
@Override
public boolean isBeaconBase (IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return true;
}
}
@@ -15,14 +15,12 @@ import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraftforge.common.*;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.world.TinkerWorld;
import tconstruct.world.model.OreberryRender;
public class OreberryBush extends BlockLeavesBase implements IPlantable
{
public class OreberryBush extends BlockLeavesBase implements IPlantable {
Random random;
public IIcon[] fastIcons;
public IIcon[] fancyIcons;
@@ -31,8 +29,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
public int itemMeat;
private int subitems;
public OreberryBush(String[] textureNames, int meta, int sub, String[] oreTypes)
{
public OreberryBush(String[] textureNames, int meta, int sub, String[] oreTypes) {
super(Material.leaves, false);
this.textureNames = textureNames;
this.itemMeat = meta;
@@ -49,15 +46,12 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
public void registerBlockIcons(IIconRegister iconRegister) {
this.fastIcons = new IIcon[textureNames.length];
this.fancyIcons = new IIcon[textureNames.length];
for (int i = 0; i < this.fastIcons.length; i++)
{
if (textureNames[i] != "")
{
for (int i = 0; i < this.fastIcons.length; i++) {
if (textureNames[i] != "") {
this.fastIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fast");
this.fancyIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fancy");
}
@@ -65,28 +59,18 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
}
@Override
public IIcon getIcon (int side, int metadata)
{
public IIcon getIcon(int side, int metadata) {
this.setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);
if (field_150121_P)
{
if (metadata < 12)
{
if (field_150121_P) {
if (metadata < 12) {
return fancyIcons[metadata % 4];
}
else
{
} else {
return fancyIcons[metadata % 4 + 4];
}
}
else
{
if (metadata < 12)
{
} else {
if (metadata < 12) {
return fastIcons[metadata % 4];
}
else
{
} else {
return fastIcons[metadata % 4 + 4];
}
}
@@ -94,51 +78,62 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
/* Bushes are stored by size then type */
@Override
public int damageDropped (int metadata)
{
public int damageDropped(int metadata) {
return metadata % 4;
}
/* The following methods define a berry bush's size depending on metadata */
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
int l = world.getBlockMetadata(x, y, z);
if (l < 4)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D);
}
else if (l < 8)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D);
}
else
{
return AxisAlignedBB.getBoundingBox(x + 0.0625, y, z + 0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D);
if (l < 4) {
return AxisAlignedBB.getBoundingBox(
(double) x + 0.25D,
y,
(double) z + 0.25D,
(double) x + 0.75D,
(double) y + 0.5D,
(double) z + 0.75D);
} else if (l < 8) {
return AxisAlignedBB.getBoundingBox(
(double) x + 0.125D,
y,
(double) z + 0.125D,
(double) x + 0.875D,
(double) y + 0.75D,
(double) z + 0.875D);
} else {
return AxisAlignedBB.getBoundingBox(
x + 0.0625, y, z + 0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D);
}
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
{
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
int l = world.getBlockMetadata(x, y, z);
if (l < 4)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D);
}
else if (l < 8)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D);
}
else
{
if (l < 4) {
return AxisAlignedBB.getBoundingBox(
(double) x + 0.25D,
y,
(double) z + 0.25D,
(double) x + 0.75D,
(double) y + 0.5D,
(double) z + 0.75D);
} else if (l < 8) {
return AxisAlignedBB.getBoundingBox(
(double) x + 0.125D,
y,
(double) z + 0.125D,
(double) x + 0.875D,
(double) y + 0.75D,
(double) z + 0.875D);
} else {
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D);
}
}
@Override
public void setBlockBoundsBasedOnState (IBlockAccess iblockaccess, int x, int y, int z)
{
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int x, int y, int z) {
int md = iblockaccess.getBlockMetadata(x, y, z);
float minX;
@@ -148,23 +143,15 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
float maxY;
float maxZ;
if (md < 4)
{
if (md < 4) {
minX = minZ = 0.25F;
maxX = maxZ = 0.75F;
maxY = 0.5F;
}
else
if (md < 8)
{
} else if (md < 8) {
minX = minZ = 0.125F;
maxX = maxZ = 0.875F;
maxY = 0.75F;
}
else
{
} else {
minX = minZ = 0.0F;
maxX = maxZ = 1.0F;
maxY = 1.0F;
@@ -174,28 +161,25 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
/* Left-click harvests berries */
@Override
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player)
{
harvest(world, x,y,z, player);
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
harvest(world, x, y, z, player);
}
/* Right-click harvests berries */
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
return harvest(world, x,y,z, player);
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
return harvest(world, x, y, z, player);
}
public boolean harvest(World world, int x, int y, int z, EntityPlayer player)
{
public boolean harvest(World world, int x, int y, int z, EntityPlayer player) {
int meta = world.getBlockMetadata(x, y, z);
if (meta >= 12)
{
if (world.isRemote)
return true;
if (meta >= 12) {
if (world.isRemote) return true;
world.setBlock(x, y, z, this, meta - 4, 3);
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat));
AbilityHelper.spawnItemAtPlayer(
player, new ItemStack(TinkerWorld.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat));
}
return false;
@@ -204,37 +188,29 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
/* Render logic */
@Override
public boolean isOpaqueCube ()
{
public boolean isOpaqueCube() {
return false;
}
public void setGraphicsLevel (boolean flag)
{
public void setGraphicsLevel(boolean flag) {
field_150121_P = flag;
}
@Override
public boolean renderAsNormalBlock ()
{
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType ()
{
public int getRenderType() {
return OreberryRender.model;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int x, int y, int z, int meta)
{
if (meta > 7 || field_150121_P)
{
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int x, int y, int z, int meta) {
if (meta > 7 || field_150121_P) {
return super.shouldSideBeRendered(iblockaccess, x, y, z, meta);
}
else
{
} else {
return true;
}
}
@@ -242,20 +218,16 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
/* Bush growth */
@Override
public void updateTick (World world, int x, int y, int z, Random random1)
{
if (world.isRemote)
{
public void updateTick(World world, int x, int y, int z, Random random1) {
if (world.isRemote) {
return;
}
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8)
if (random1.nextInt(20) == 0) // && world.getBlockLightValue(x, y, z) <= 8)
{
if (world.getFullBlockLightValue(x, y, z) < 10)
{
if (world.getFullBlockLightValue(x, y, z) < 10) {
int meta = world.getBlockMetadata(x, y, z);
if (meta < 12)
{
if (meta < 12) {
world.setBlock(x, y, z, this, meta + 4, 3);
}
}
@@ -266,18 +238,14 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
}
}
public boolean canSustainPlant (World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
if (plant instanceof OreberryBush)
return (world.getBlockMetadata(x, y, z) > 7);
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) {
if (plant instanceof OreberryBush) return (world.getBlockMetadata(x, y, z) > 7);
return super.canSustainPlant(world, x, y, z, direction, plant);
}
@Override
public boolean canPlaceBlockAt (World world, int x, int y, int z)
{
if (world.getFullBlockLightValue(x, y, z) < 13)
return super.canPlaceBlockAt(world, x, y, z);
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
if (world.getFullBlockLightValue(x, y, z) < 13) return super.canPlaceBlockAt(world, x, y, z);
return false;
}
@@ -288,36 +256,29 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
*/
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int var4 = 8; var4 < 8 + subitems; ++var4)
{
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 8; var4 < 8 + subitems; ++var4) {
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z)
{
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) {
return EnumPlantType.Cave;
}
@Override
public Block getPlant (IBlockAccess world, int x, int y, int z)
{
public Block getPlant(IBlockAccess world, int x, int y, int z) {
return this;
}
@Override
public int getPlantMetadata (IBlockAccess world, int x, int y, int z)
{
public int getPlantMetadata(IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x, y, z) - 4;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (!(entity instanceof EntityItem))
entity.attackEntityFrom(DamageSource.cactus, 1);
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (!(entity instanceof EntityItem)) entity.attackEntityFrom(DamageSource.cactus, 1);
}
}
}
@@ -5,31 +5,25 @@ import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
public class OreberryBushEssence extends OreberryBush implements IPlantable
{
public OreberryBushEssence(String[] textureNames, int meta, int sub, String[] oreTypes)
{
public class OreberryBushEssence extends OreberryBush implements IPlantable {
public OreberryBushEssence(String[] textureNames, int meta, int sub, String[] oreTypes) {
super(textureNames, meta, sub, oreTypes);
}
/* Bush growth */
@Override
public void updateTick (World world, int x, int y, int z, Random random1)
{
if (world.isRemote)
{
public void updateTick(World world, int x, int y, int z, Random random1) {
if (world.isRemote) {
return;
}
if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <=
// 8)
if (random1.nextInt(20) == 0) // && world.getBlockLightValue(x, y, z) <=
// 8)
{
int meta = world.getBlockMetadata(x, y, z);
if (world.getFullBlockLightValue(x, y, z) < 10 || meta % 4 == 1)
{
if (meta < 12)
{
if (world.getFullBlockLightValue(x, y, z) < 10 || meta % 4 == 1) {
if (meta < 12) {
world.setBlock(x, y, z, (Block) this, meta + 4, 3);
}
}
@@ -41,8 +35,7 @@ public class OreberryBushEssence extends OreberryBush implements IPlantable
}
@Override
public boolean canPlaceBlockAt (World world, int x, int y, int z)
{
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return true;
/*
* if (world.getFullBlockLightValue(x, y, z) < 13) return
@@ -16,20 +16,16 @@ import net.minecraft.world.*;
import tconstruct.blocks.TConstructBlock;
import tconstruct.mechworks.entity.item.ExplosivePrimed;
public class SlimeExplosive extends TConstructBlock
{
public class SlimeExplosive extends TConstructBlock {
public SlimeExplosive()
{
public SlimeExplosive() {
super(Material.tnt, 0f, getTextureNames());
}
static String[] getTextureNames ()
{
static String[] getTextureNames() {
String[] names = new String[6];
String[] types = new String[] { "green", "blue" };
for (int i = 0; i < 2; i++)
{
String[] types = new String[] {"green", "blue"};
for (int i = 0; i < 2; i++) {
names[i * 3 + 0] = "sdx_bottom_" + types[i];
names[i * 3 + 1] = "sdx_side_" + types[i];
names[i * 3 + 2] = "sdx_top_" + types[i];
@@ -39,66 +35,64 @@ public class SlimeExplosive extends TConstructBlock
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
public IIcon getIcon(int side, int meta) {
return icons[(meta / 2) * 3 + getSideTextureIndex(side)];
}
@Override
public void getSubBlocks (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 2; iter++)
{
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
for (int iter = 0; iter < 2; iter++) {
list.add(new ItemStack(b, 1, iter * 2));
}
}
@Override
public void onBlockAdded (World par1World, int par2, int par3, int par4)
{
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
super.onBlockAdded(par1World, par2, par3, par4);
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
{
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) {
this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
}
@Override
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5Block)
{
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
{
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5Block) {
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) {
this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
}
@Override
public void onBlockDestroyedByExplosion (World par1World, int par2, int par3, int par4, Explosion par5Explosion)
{
if (!par1World.isRemote)
{
ExplosivePrimed entitytntprimed = new ExplosivePrimed(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), par5Explosion.getExplosivePlacedBy());
public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) {
if (!par1World.isRemote) {
ExplosivePrimed entitytntprimed = new ExplosivePrimed(
par1World,
(double) ((float) par2 + 0.5F),
(double) ((float) par3 + 0.5F),
(double) ((float) par4 + 0.5F),
par5Explosion.getExplosivePlacedBy());
entitytntprimed.fuse = par1World.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
par1World.spawnEntityInWorld(entitytntprimed);
}
}
@Override
public void onBlockDestroyedByPlayer (World par1World, int par2, int par3, int par4, int par5)
{
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {
this.primeTnt(par1World, par2, par3, par4, par5, (EntityLivingBase) null);
}
public void primeTnt (World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase)
{
if (!par1World.isRemote)
{
if ((par5 % 2) == 1)
{
ExplosivePrimed entitytntprimed = new ExplosivePrimed(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), par6EntityLivingBase);
public void primeTnt(
World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) {
if (!par1World.isRemote) {
if ((par5 % 2) == 1) {
ExplosivePrimed entitytntprimed = new ExplosivePrimed(
par1World,
(double) ((float) par2 + 0.5F),
(double) ((float) par3 + 0.5F),
(double) ((float) par4 + 0.5F),
par6EntityLivingBase);
par1World.spawnEntityInWorld(entitytntprimed);
par1World.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F);
}
@@ -106,40 +100,49 @@ public class SlimeExplosive extends TConstructBlock
}
@Override
public boolean onBlockActivated (World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel)
{
public boolean onBlockActivated(
World par1World,
int par2,
int par3,
int par4,
EntityPlayer par5EntityPlayer,
int par6,
float par7,
float par8,
float par9) {
if (par5EntityPlayer.getCurrentEquippedItem() != null
&& par5EntityPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel) {
this.primeTnt(par1World, par2, par3, par4, 1, par5EntityPlayer);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
par5EntityPlayer.getCurrentEquippedItem().damageItem(1, par5EntityPlayer);
return true;
}
else
{
} else {
return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
}
}
@Override
public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if (par5Entity instanceof EntityArrow && !par1World.isRemote)
{
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
if (par5Entity instanceof EntityArrow && !par1World.isRemote) {
EntityArrow entityarrow = (EntityArrow) par5Entity;
if (entityarrow.isBurning())
{
this.primeTnt(par1World, par2, par3, par4, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null);
if (entityarrow.isBurning()) {
this.primeTnt(
par1World,
par2,
par3,
par4,
1,
entityarrow.shootingEntity instanceof EntityLivingBase
? (EntityLivingBase) entityarrow.shootingEntity
: null);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
}
}
@Override
public boolean canDropFromExplosion (Explosion par1Explosion)
{
public boolean canDropFromExplosion(Explosion par1Explosion) {
return false;
}
}
@@ -13,133 +13,123 @@ import tconstruct.library.TConstructRegistry;
import tconstruct.world.TinkerWorld;
import tconstruct.world.model.SlimePadRender;
public class SlimePad extends MantleBlock
{
public class SlimePad extends MantleBlock {
public SlimePad(Material par2Material)
{
public SlimePad(Material par2Material) {
super(par2Material);
setBlockBounds(0.125F, 0.0625F, 0.125F, 0.875F, 0.625F, 0.875F);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
{
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (!world.isBlockIndirectlyGettingPowered(x, y, z)) {
double moveX = 0;
double moveZ = 0;
double speed = 0.25;
int meta = world.getBlockMetadata(x, y, z);
switch (meta % 8)
{
case 6:
moveX += speed;
break;
case 7:
moveX += speed;
moveZ += speed;
break;
case 0:
moveZ += speed;
break;
case 1:
moveZ += speed;
moveX -= speed;
break;
case 2:
moveX -= speed;
break;
case 3:
moveX -= speed;
moveZ -= speed;
break;
case 4:
moveZ -= speed;
break;
case 5:
moveZ -= speed;
moveX += speed;
break;
switch (meta % 8) {
case 6:
moveX += speed;
break;
case 7:
moveX += speed;
moveZ += speed;
break;
case 0:
moveZ += speed;
break;
case 1:
moveZ += speed;
moveX -= speed;
break;
case 2:
moveX -= speed;
break;
case 3:
moveX -= speed;
moveZ -= speed;
break;
case 4:
moveZ -= speed;
break;
case 5:
moveZ -= speed;
moveX += speed;
break;
}
if (entity instanceof EntityItem)
{
if (entity instanceof EntityItem) {
entity.posY += 1;
}
entity.fallDistance = 0.0F;
entity.addVelocity(moveX, speed * 2, moveZ);
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, this.stepSound.getStepResourcePath(), (this.stepSound.getVolume()) / 2.0F, this.stepSound.getPitch() * 0.65F);
world.playSoundEffect(
x + 0.5F,
y + 0.5F,
z + 0.5F,
this.stepSound.getStepResourcePath(),
(this.stepSound.getVolume()) / 2.0F,
this.stepSound.getPitch() * 0.65F);
}
}
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
public boolean isBlockReplaceable(World world, int x, int y, int z) {
return false;
}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7;
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D)
+ (entity.isSneaking() ? 4 : 0)
& 7;
int meta = world.getBlockMetadata(x, y, z) & 8;
world.setBlockMetadataWithNotify(x, y, z, face | meta, 2);
}
@Override
public boolean renderAsNormalBlock ()
{
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube ()
{
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderBlockPass ()
{
public int getRenderBlockPass() {
return 1;
}
@Override
public int getRenderType ()
{
public int getRenderType() {
return SlimePadRender.model;
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
}
public void registerBlockIcons(IIconRegister iconRegister) {}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
public IIcon getIcon(int side, int meta) {
return TinkerWorld.slimeGel.getIcon(side, 1);
}
@SideOnly(Side.CLIENT)
public IIcon getFluidIcon (int meta)
{
public IIcon getFluidIcon(int meta) {
return TinkerWorld.slimeChannel.getIcon(2, 0);
}
@SideOnly(Side.CLIENT)
public IIcon getNubIcon (int meta)
{
public IIcon getNubIcon(int meta) {
return TinkerWorld.slimeGel.getIcon(0, 0);
}
}
@@ -8,30 +8,24 @@ import net.minecraft.util.*;
import net.minecraft.world.World;
import tconstruct.blocks.TConstructBlock;
public class SoilBlock extends TConstructBlock
{
static String[] soilTypes = new String[] { "slimesand", "grout", "slimesandblue", "graveyardsoil", "consecratedsoil", "slimedirt_blue", "nether_grout" };
public class SoilBlock extends TConstructBlock {
static String[] soilTypes = new String[] {
"slimesand", "grout", "slimesandblue", "graveyardsoil", "consecratedsoil", "slimedirt_blue", "nether_grout"
};
public SoilBlock()
{
public SoilBlock() {
super(Material.ground, 3.0F, soilTypes);
this.setHarvestLevel("shovel", -1);
}
@Override
public void onEntityWalking (World world, int x, int y, int z, Entity entity)
{
if (entity instanceof EntityLivingBase)
{
if (((EntityLivingBase) entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
if (entity instanceof EntityLivingBase) {
if (((EntityLivingBase) entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 3)
{
if (metadata == 3) {
((EntityLivingBase) entity).heal(1);
}
else if (metadata == 4)
{
} else if (metadata == 4) {
((EntityLivingBase) entity).attackEntityFrom(DamageSource.magic, 1);
((EntityLivingBase) entity).setFire(1);
}
@@ -40,15 +34,12 @@ public class SoilBlock extends TConstructBlock
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
int meta = world.getBlockMetadata(x, y, z);
if (meta < 3)
{
if (meta < 3) {
entity.motionX *= 0.4;
entity.motionZ *= 0.4;
if (meta != 1 && entity instanceof EntityLivingBase)
{
if (meta != 1 && entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 1));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.jump.id, 1, 1));
}
@@ -56,8 +47,7 @@ public class SoilBlock extends TConstructBlock
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return Blocks.soul_sand.getCollisionBoundingBoxFromPool(world, x, y, z);
}
@@ -13,51 +13,43 @@ import tconstruct.blocks.SlabBase;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.TinkerTools;
public class SoilSlab extends SlabBase
{
public SoilSlab()
{
public class SoilSlab extends SlabBase {
public SoilSlab() {
super(Material.ground);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("tinker:grass_top");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
switch (meta % 8)
{
case 0:
return this.blockIcon;// Block.grass.getIcon(1, 0);
case 1:
return Blocks.dirt.getIcon(side, 0);
case 2:
return Blocks.mycelium.getIcon(1, 0);
default:
return TinkerTools.craftedSoil.getIcon(side, meta - 3);
public IIcon getIcon(int side, int meta) {
switch (meta % 8) {
case 0:
return this.blockIcon; // Block.grass.getIcon(1, 0);
case 1:
return Blocks.dirt.getIcon(side, 0);
case 2:
return Blocks.mycelium.getIcon(1, 0);
default:
return TinkerTools.craftedSoil.getIcon(side, meta - 3);
}
}
@Override
public void getSubBlocks (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 8; iter++)
{
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
for (int iter = 0; iter < 8; iter++) {
list.add(new ItemStack(b, 1, iter));
}
}
@Override
@SideOnly(Side.CLIENT)
public int getBlockColor ()
{
public int getBlockColor() {
double d0 = 0.5D;
double d1 = 1.0D;
return ColorizerGrass.getGrassColor(d0, d1);
@@ -65,8 +57,7 @@ public class SoilSlab extends SlabBase
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor (int par1)
{
public int getRenderColor(int par1) {
// if (par1 % 8 == 0)
return this.getBlockColor();
// return 0xFFFFFF;
@@ -74,16 +65,13 @@ public class SoilSlab extends SlabBase
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier (IBlockAccess world, int x, int y, int z)
{
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
for (int k1 = -1; k1 <= 1; ++k1) {
for (int l1 = -1; l1 <= 1; ++l1) {
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeGrassColor(x, y, z);
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
@@ -7,8 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.IIcon;
public class StoneLadder extends BlockLadder
{
public class StoneLadder extends BlockLadder {
// Override ladder material
public final Material blockMaterial = Material.rock;
@@ -16,24 +15,20 @@ public class StoneLadder extends BlockLadder
private IIcon icon;
// Use the normally protected constructor
public StoneLadder()
{
public StoneLadder() {
super();
this.setBlockName("decoration.stoneladder");
this.setCreativeTab(CreativeTabs.tabDecorations);
}
@Override
public void registerBlockIcons (IIconRegister register)
{
public void registerBlockIcons(IIconRegister register) {
icon = register.registerIcon("tinker:ladder_stone");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int meta, int side)
{
public IIcon getIcon(int meta, int side) {
return icon;
}
}
@@ -1,5 +1,7 @@
package tconstruct.world.blocks;
import static net.minecraftforge.common.util.ForgeDirection.*;
import cpw.mods.fml.relauncher.*;
import java.util.Random;
import mantle.blocks.MantleBlock;
@@ -10,12 +12,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.*;
import net.minecraft.world.World;
import static net.minecraftforge.common.util.ForgeDirection.*;
public class StoneTorch extends MantleBlock
{
public StoneTorch()
{
public class StoneTorch extends MantleBlock {
public StoneTorch() {
super(Material.circuits);
this.setCreativeTab(CreativeTabs.tabDecorations);
setLightLevel(0.9375F);
@@ -26,8 +24,7 @@ public class StoneTorch extends MantleBlock
* box can change after the pool has been cleared to be reused)
*/
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, int par3, int par4)
{
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
return null;
}
@@ -37,8 +34,7 @@ public class StoneTorch extends MantleBlock
* the player can attach torches, redstone wire, etc to this block.
*/
@Override
public boolean isOpaqueCube ()
{
public boolean isOpaqueCube() {
return false;
}
@@ -47,8 +43,7 @@ public class StoneTorch extends MantleBlock
* (examples: signs, buttons, stairs, etc)
*/
@Override
public boolean renderAsNormalBlock ()
{
public boolean renderAsNormalBlock() {
return false;
}
@@ -56,22 +51,17 @@ public class StoneTorch extends MantleBlock
* The type of render function that is called for this block
*/
@Override
public int getRenderType ()
{
public int getRenderType() {
return 2;
}
/**
* Gets if we can place a torch on a block.
*/
private boolean canPlaceTorchOn (World par1World, int par2, int par3, int par4)
{
if (par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3, par4))
{
private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) {
if (par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3, par4)) {
return true;
}
else
{
} else {
Block b = par1World.getBlock(par2, par3, par4);
return (b != null && b.canPlaceTorchOnTop(par1World, par2, par3, par4));
}
@@ -82,9 +72,12 @@ public class StoneTorch extends MantleBlock
* coordinates. Args: world, x, y, z
*/
@Override
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
{
return par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) || par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) || par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true) || par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) || canPlaceTorchOn(par1World, par2, par3 - 1, par4);
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
return par1World.isSideSolid(par2 - 1, par3, par4, EAST, true)
|| par1World.isSideSolid(par2 + 1, par3, par4, WEST, true)
|| par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true)
|| par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true)
|| canPlaceTorchOn(par1World, par2, par3 - 1, par4);
}
/**
@@ -92,71 +85,53 @@ public class StoneTorch extends MantleBlock
* side, hitX, hitY, hitZ, block metadata
*/
@Override
public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
{
public int onBlockPlaced(
World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) {
int j1 = par9;
if (par5 == 1 && this.canPlaceTorchOn(par1World, par2, par3 - 1, par4))
{
if (par5 == 1 && this.canPlaceTorchOn(par1World, par2, par3 - 1, par4)) {
j1 = 5;
}
if (par5 == 2 && par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true))
{
if (par5 == 2 && par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true)) {
j1 = 4;
}
if (par5 == 3 && par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true))
{
if (par5 == 3 && par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true)) {
j1 = 3;
}
if (par5 == 4 && par1World.isSideSolid(par2 + 1, par3, par4, WEST, true))
{
if (par5 == 4 && par1World.isSideSolid(par2 + 1, par3, par4, WEST, true)) {
j1 = 2;
}
if (par5 == 5 && par1World.isSideSolid(par2 - 1, par3, par4, EAST, true))
{
if (par5 == 5 && par1World.isSideSolid(par2 - 1, par3, par4, EAST, true)) {
j1 = 1;
}
return j1;
}
public void updateTick (World par1World, int par2, int par3, int par4, Random random)
{
public void updateTick(World par1World, int par2, int par3, int par4, Random random) {
super.updateTick(par1World, par2, par3, par4, random);
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{
if (par1World.getBlockMetadata(par2, par3, par4) == 0) {
this.onBlockAdded(par1World, par2, par3, par4);
}
}
// JAVADOC METHOD $$ func_149726_b
public void onBlockAdded (World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
{
if (p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_) == 0)
{
if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true))
{
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
if (p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_) == 0) {
if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true)) {
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 1, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true))
{
} else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true)) {
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 2, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true))
{
} else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true)) {
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 3, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true))
{
} else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true)) {
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 4, 2);
}
else if (this.canPlaceTorchOn(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_))
{
} else if (this.canPlaceTorchOn(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_)) {
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 5, 2);
}
}
@@ -166,8 +141,7 @@ public class StoneTorch extends MantleBlock
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister par1IconRegister)
{
public void registerBlockIcons(IIconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("tinker:torch_stone");
}
@@ -177,56 +151,43 @@ public class StoneTorch extends MantleBlock
* neighbor blockID
*/
@Override
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5)
{
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
this.func_94397_d(par1World, par2, par3, par4, par5);
}
protected boolean func_94397_d (World par1World, int par2, int par3, int par4, Block par5)
{
if (this.dropTorchIfCantStay(par1World, par2, par3, par4))
{
protected boolean func_94397_d(World par1World, int par2, int par3, int par4, Block par5) {
if (this.dropTorchIfCantStay(par1World, par2, par3, par4)) {
int i1 = par1World.getBlockMetadata(par2, par3, par4);
boolean flag = false;
if (!par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) && i1 == 1)
{
if (!par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) && i1 == 1) {
flag = true;
}
if (!par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) && i1 == 2)
{
if (!par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) && i1 == 2) {
flag = true;
}
if (!par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true) && i1 == 3)
{
if (!par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true) && i1 == 3) {
flag = true;
}
if (!par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) && i1 == 4)
{
if (!par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) && i1 == 4) {
flag = true;
}
if (!this.canPlaceTorchOn(par1World, par2, par3 - 1, par4) && i1 == 5)
{
if (!this.canPlaceTorchOn(par1World, par2, par3 - 1, par4) && i1 == 5) {
flag = true;
}
if (flag)
{
if (flag) {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
return true;
}
else
{
} else {
return false;
}
}
else
{
} else {
return true;
}
}
@@ -236,21 +197,16 @@ public class StoneTorch extends MantleBlock
* item if it is unable to stay. Returns True if it can stay and False if it
* drops. Args: world, x, y, z
*/
protected boolean dropTorchIfCantStay (World par1World, int par2, int par3, int par4)
{
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
if (par1World.getBlock(par2, par3, par4) == (Block) this)
{
protected boolean dropTorchIfCantStay(World par1World, int par2, int par3, int par4) {
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
if (par1World.getBlock(par2, par3, par4) == (Block) this) {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
//WorldHelper.setBlockToAir(par1World, par2, par3, par4);
// WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
return false;
}
else
{
} else {
return true;
}
}
@@ -260,29 +216,20 @@ public class StoneTorch extends MantleBlock
* returning a ray trace hit. Args: world, x, y, z, startVec, endVec
*/
@Override
public MovingObjectPosition collisionRayTrace (World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
{
public MovingObjectPosition collisionRayTrace(
World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) {
int l = par1World.getBlockMetadata(par2, par3, par4) & 7;
float f = 0.15F;
if (l == 1)
{
if (l == 1) {
this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
}
else if (l == 2)
{
} else if (l == 2) {
this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
}
else if (l == 3)
{
} else if (l == 3) {
this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
}
else if (l == 4)
{
} else if (l == 4) {
this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
}
else
{
} else {
f = 0.1F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
}
@@ -295,8 +242,7 @@ public class StoneTorch extends MantleBlock
/**
* A randomly called display update to be able to add particles or other items for display
*/
public void randomDisplayTick (World par1World, int par2, int par3, int par4, Random par5Random)
{
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
int meta = par1World.getBlockMetadata(par2, par3, par4);
double d0 = (double) ((float) par2 + 0.5F);
double d1 = (double) ((float) par3 + 0.7F);
@@ -304,28 +250,19 @@ public class StoneTorch extends MantleBlock
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;
if (meta == 1)
{
if (meta == 1) {
par1World.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (meta == 2)
{
} else if (meta == 2) {
par1World.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (meta == 3)
{
} else if (meta == 3) {
par1World.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
}
else if (meta == 4)
{
} else if (meta == 4) {
par1World.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
}
else
{
} else {
par1World.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
@@ -5,20 +5,29 @@ import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import tconstruct.blocks.TConstructBlock;
public class TMetalBlock extends TConstructBlock
{
public class TMetalBlock extends TConstructBlock {
static String[] metalTypes = new String[] { "compressed_cobalt", "compressed_ardite", "compressed_manyullyn", "compressed_copper", "compressed_bronze", "compressed_tin", "compressed_aluminum", "compressed_alubrass", "compressed_alumite", "compressed_steel", "compressed_ender" };
static String[] metalTypes = new String[] {
"compressed_cobalt",
"compressed_ardite",
"compressed_manyullyn",
"compressed_copper",
"compressed_bronze",
"compressed_tin",
"compressed_aluminum",
"compressed_alubrass",
"compressed_alumite",
"compressed_steel",
"compressed_ender"
};
public TMetalBlock(Material material, float hardness)
{
public TMetalBlock(Material material, float hardness) {
super(material, hardness, metalTypes);
this.setStepSound(Block.soundTypeMetal);
}
@Override
public boolean isBeaconBase (IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return true;
}
}
@@ -8,13 +8,11 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class WoodRail extends BlockRailBase
{
public class WoodRail extends BlockRailBase {
@SideOnly(Side.CLIENT)
private IIcon theIcon;
public WoodRail()
{
public WoodRail() {
super(false);
}
@@ -23,8 +21,7 @@ public class WoodRail extends BlockRailBase
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon (int par1, int par2)
{
public IIcon getIcon(int par1, int par2) {
return par2 >= 6 ? this.theIcon : this.blockIcon;
}
@@ -34,24 +31,21 @@ public class WoodRail extends BlockRailBase
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerBlockIcons (IIconRegister par1IconRegister)
{
public void registerBlockIcons(IIconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("tinker:woodrail");
this.theIcon = par1IconRegister.registerIcon("tinker:woodrail_turn");
}
protected void func_94358_a (World par1World, int par2, int par3, int par4, int par5, int par6, Block par7)
{
if (par7 != Blocks.air && par7.canProvidePower() && (new Rail(par1World, par2, par3, par4)).func_150650_a() == 3)
{
protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, Block par7) {
if (par7 != Blocks.air
&& par7.canProvidePower()
&& (new Rail(par1World, par2, par3, par4)).func_150650_a() == 3) {
this.func_150052_a(par1World, par2, par3, par4, false);
}
}
@Override
public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z)
{
public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) {
return 0.3f;
}
}
@@ -4,8 +4,7 @@ import net.minecraft.item.Item;
import net.minecraft.world.*;
import tconstruct.world.TinkerWorld;
public class BlueSlime extends SlimeBase
{
public class BlueSlime extends SlimeBase {
public BlueSlime(World world) {
super(world);
}
@@ -14,8 +13,7 @@ public class BlueSlime extends SlimeBase
* Returns the item ID for the item the mob drops on death.
*/
@Override
protected Item getDropItem ()
{
protected Item getDropItem() {
return TinkerWorld.strangeFood;
}
File diff suppressed because it is too large. Load diff
@@ -3,13 +3,10 @@ package tconstruct.world.entity;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.world.World;
public class Crystal extends EntityCreeper
{
public class Crystal extends EntityCreeper {
public Crystal(World par1World)
{
public Crystal(World par1World) {
super(par1World);
// texture = "/mods/tinker/textures/mob/crystalwater.png";
}
}
@@ -3,11 +3,9 @@ package tconstruct.world.entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
public class CrystalGuardian extends EntityLiving
{
public class CrystalGuardian extends EntityLiving {
public CrystalGuardian(World par1World)
{
public CrystalGuardian(World par1World) {
super(par1World);
// this.texture = "/mods/tinker/textures/mob/crystalguardamber.png";
}
@@ -49,17 +49,17 @@ public class KingBlueSlime extends SlimeBase implements IBossDisplayData {
@Override
public void setDead() {
if (!this.worldObj.isRemote && this.getHealth() <= 0)
{
if (!this.worldObj.isRemote && this.getHealth() <= 0) {
// doesn't break into the next smaller one. let's spawn many tiny slimes instead! :D
int c = 15 + this.rand.nextInt(6);
for(; c > 0; c--) {
for (; c > 0; c--) {
BlueSlime entityslime = new BlueSlime(this.worldObj);
entityslime.setSlimeSize(1);
double r = rand.nextDouble() * Math.PI;
double x = Math.cos(r);
double z = Math.sin(r);
entityslime.setLocationAndAngles(this.posX - 1d + x, this.posY + 0.5D, this.posZ - 1d + z, this.rand.nextFloat() * 360.0F, 0.0F);
entityslime.setLocationAndAngles(
this.posX - 1d + x, this.posY + 0.5D, this.posZ - 1d + z, this.rand.nextFloat() * 360.0F, 0.0F);
entityslime.motionX = x;
entityslime.motionY = -0.5d - rand.nextDouble();
entityslime.motionZ = z;
@@ -78,20 +78,19 @@ public class KingBlueSlime extends SlimeBase implements IBossDisplayData {
final ItemStack headStack = new ItemStack(tool.getHeadItem(), 1, 17);
final ItemStack handleStack = new ItemStack(tool.getHandleItem(), 1, 17);
final ItemStack accessoryStack = tool.getAccessoryItem() != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null;
final ItemStack accessoryStack =
tool.getAccessoryItem() != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null;
final ItemStack extraStack = tool.getExtraItem() != null ? new ItemStack(tool.getExtraItem(), 1, 17) : null;
String loc = "tool." + tool.getToolName().toLowerCase() + ".kingslime"; // special localization the same way as materials
String loc = "tool." + tool.getToolName().toLowerCase()
+ ".kingslime"; // special localization the same way as materials
String name;
if(StatCollector.canTranslate(loc))
name = StatCollector.translateToLocal(loc);
else
name = StatCollector.translateToLocal("tool.kingslimeprefix") + " " + tool.getLocalizedToolName();
if (StatCollector.canTranslate(loc)) name = StatCollector.translateToLocal(loc);
else name = StatCollector.translateToLocal("tool.kingslimeprefix") + " " + tool.getLocalizedToolName();
ItemStack toolStack = ToolBuilder.instance.buildTool(headStack, handleStack, accessoryStack, extraStack, name);
if (toolStack != null)
{
if (toolStack != null) {
NBTTagCompound tags = toolStack.getTagCompound().getCompoundTag("InfiTool");
tags.setInteger("Attack", 5 + tool.getDamageVsEntity(null));
tags.setInteger("TotalDurability", 2500);
@@ -99,19 +98,17 @@ public class KingBlueSlime extends SlimeBase implements IBossDisplayData {
tags.setInteger("MiningSpeed", 1400);
this.entityDropItem(toolStack, 0f);
if (rand.nextInt(5) == 0)
{
if (rand.nextInt(5) == 0) {
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 1);
this.entityDropItem(dropStack, 0f);
}
}
}
ToolCore getValidTool ()
{
ToolCore getValidTool() {
ToolCore tool = TConstructRegistry.tools.get(rand.nextInt(TConstructRegistry.tools.size()));
/*if (tool.getExtraItem() != null)
tool = getValidTool();*/
tool = getValidTool();*/
return tool;
}
}
@@ -4,99 +4,82 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class MetalSlime extends BlueSlime
{
public class MetalSlime extends BlueSlime {
public MetalSlime(World world)
{
public MetalSlime(World world) {
super(world);
// this.texture = "/mods/tinker/textures/mob/slimemetal.png";
this.setHealth(getMaxHealthForSize());
}
public boolean attackEntityFrom (DamageSource damageSource, int damage)
{
if (!damageSource.isExplosion() && damageSource.isProjectile())
return false;
public boolean attackEntityFrom(DamageSource damageSource, int damage) {
if (!damageSource.isExplosion() && damageSource.isProjectile()) return false;
return super.attackEntityFrom(damageSource, damage);
}
// Invoked by constructor to set max health dependant on current size
protected float getMaxHealthForSize ()
{
protected float getMaxHealthForSize() {
int i = this.getSlimeSize();
if (i == 1)
return 4;
if (i == 1) return 4;
return (float) Math.min(i * i + 20, 100);
}
@Override
public int getTotalArmorValue ()
{
public int getTotalArmorValue() {
return super.getTotalArmorValue() + 12;
}
@Override
public void setDead ()
{
public void setDead() {
this.isDead = true;
}
/*
* protected void dropFewItems (boolean par1, int par2) { int j =
* this.getDropItemId();
*
*
* if (j > 0) { int k = rand.nextInt(3) + rand.nextInt(this.getSlimeSize());
*
*
* if (par2 > 0) { k += this.rand.nextInt(par2 + 1); }
*
*
* for (int l = 0; l < k; ++l) { this.dropItem(j, 1); } } }
*/
@Override
protected void updateEntityActionState ()
{
protected void updateEntityActionState() {
this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
{
if (entityplayer != null) {
this.faceEntity(entityplayer, 10.0F, 20.0F);
}
else if (this.onGround && this.slimeJumpDelay == 1)
{
} else if (this.onGround && this.slimeJumpDelay == 1) {
this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90;
if (rotationYaw > 360)
rotationYaw -= 360;
if (rotationYaw < 0)
rotationYaw += 360;
if (rotationYaw > 360) rotationYaw -= 360;
if (rotationYaw < 0) rotationYaw += 360;
}
if (this.onGround && this.slimeJumpDelay-- <= 0)
{
if (this.onGround && this.slimeJumpDelay-- <= 0) {
this.slimeJumpDelay = this.getJumpDelay();
if (entityplayer != null)
{
if (entityplayer != null) {
this.slimeJumpDelay /= 3;
}
this.isJumping = true;
if (this.makesSoundOnJump())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
if (this.makesSoundOnJump()) {
this.playSound(
this.getJumpSound(),
this.getSoundVolume(),
((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F;
this.moveForward = (float) (1 * this.getSlimeSize());
}
else
{
} else {
this.isJumping = false;
if (this.onGround)
{
if (this.onGround) {
this.moveStrafing = this.moveForward = 0.0F;
}
}
@@ -25,42 +25,34 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
/** the time between each jump of the slime, used for counting */
protected int slimeJumpDelay = 0;
public SlimeBase(World world)
{
public SlimeBase(World world) {
super(world);
initializeSlime();
}
/** Returns the name of the particle used by the slime */
protected abstract String getSlimeParticle();
/** Returns the name of the sound played when the slime jumps. */
protected String getJumpSound ()
{
protected String getJumpSound() {
return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small");
}
/** Returns true if the slime makes a sound when it jumps (based upon the slime's size) */
protected boolean makesSoundOnJump ()
{
protected boolean makesSoundOnJump() {
return this.getSlimeSize() > 0;
}
/** Returns true if the slime makes a sound when it lands after a jump (based upon the slime's size) */
protected boolean makesSoundOnLand ()
{
protected boolean makesSoundOnLand() {
return this.getSlimeSize() > 2;
}
public int getSlimeSize ()
{
public int getSlimeSize() {
return this.dataWatcher.getWatchableObjectByte(16);
}
public void setSlimeSize (int size)
{
public void setSlimeSize(int size) {
this.dataWatcher.updateObject(16, (byte) size);
this.setSize(0.6F * (float) size, 0.6F * (float) size);
this.setPosition(this.posX, this.posY, this.posZ);
@@ -73,18 +65,15 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
}
/** returns the health for the slime depending on its size */
protected float getMaxHealthForSize ()
{
protected float getMaxHealthForSize() {
int i = this.getSlimeSize();
if (i == 1)
return 4;
if (i == 1) return 4;
return (float) Math.min(i * i + 8, 49);
}
/** Gets the amount of time the slime needs to wait between jumps. */
protected int getJumpDelay ()
{
protected int getJumpDelay() {
return this.rand.nextInt(120) + 40;
}
@@ -92,8 +81,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* Indicates weather the slime is able to damage the player (based upon the
* slime's size)
*/
protected boolean canDamagePlayer ()
{
protected boolean canDamagePlayer() {
return this.getSlimeSize() > 1;
}
@@ -101,8 +89,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* Gets the amount of damage dealt to the player when "attacked" by the
* slime.
*/
protected int getAttackStrength ()
{
protected int getAttackStrength() {
return this.getSlimeSize();
}
@@ -111,19 +98,11 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
*/
protected abstract SlimeBase createInstance(World world);
protected void initializeSlime()
{
protected void initializeSlime() {
int offset = this.rand.nextInt(299);
if (offset < 149)
offset = 1;
else if (offset < 298)
offset = 2;
else
offset = 3;
if (offset < 149) offset = 1;
else if (offset < 298) offset = 2;
else offset = 3;
int size = 1 << offset;
this.yOffset = 0.0F;
this.slimeJumpDelay = this.rand.nextInt(120) + 40;
@@ -131,36 +110,36 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
}
@Override
protected void entityInit ()
{
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, (byte) 1);
}
@Override
public void jump ()
{
public void jump() {
this.motionY = 0.05 * getSlimeSize() + 0.37;
if (this.isPotionActive(Potion.jump))
{
this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
if (this.isPotionActive(Potion.jump)) {
this.motionY +=
(double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
}
if (this.isSprinting())
{
if (this.isSprinting()) {
float f = this.rotationYaw * 0.017453292F;
this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
}
if (!(this instanceof IBossDisplayData) && this.getBrightness(1.0F) > 0.9F && rand.nextInt(5) == 0 && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))
{
if (!(this instanceof IBossDisplayData)
&& this.getBrightness(1.0F) > 0.9F
&& rand.nextInt(5) == 0
&& this.worldObj.canBlockSeeTheSky(
MathHelper.floor_double(this.posX),
MathHelper.floor_double(this.posY),
MathHelper.floor_double(this.posZ))) {
int size = this.getSlimeSize() - 1;
if (size <= 0)
this.kill();
else
this.setSlimeSize(size);
if (size <= 0) this.kill();
else this.setSlimeSize(size);
}
this.isAirBorne = true;
@@ -171,10 +150,10 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate ()
{
if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && this.getSlimeSize() > 0)
{
public void onUpdate() {
if (!this.worldObj.isRemote
&& this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL
&& this.getSlimeSize() > 0) {
this.isDead = true;
}
@@ -184,121 +163,117 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
super.onUpdate();
int i;
if (this.onGround && !flag)
{
if (this.onGround && !flag) {
i = this.getSlimeSize();
for (int j = 0; j < i * 8; ++j)
{
for (int j = 0; j < i * 8; ++j) {
float f = this.rand.nextFloat() * (float) Math.PI * 2.0F;
float offset = this.rand.nextFloat() * 0.5F + 0.5F;
float xPos = MathHelper.sin(f) * (float) i * 0.5F * offset;
float zPos = MathHelper.cos(f) * (float) i * 0.5F * offset;
TinkerWorld.proxy.spawnParticle(this.getSlimeParticle(), this.posX + (double) xPos, this.boundingBox.minY, this.posZ + (double) zPos, 0.0D, 0.0D, 0.0D);
TinkerWorld.proxy.spawnParticle(
this.getSlimeParticle(),
this.posX + (double) xPos,
this.boundingBox.minY,
this.posZ + (double) zPos,
0.0D,
0.0D,
0.0D);
}
if (this.makesSoundOnLand())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
if (this.makesSoundOnLand()) {
this.playSound(
this.getJumpSound(),
this.getSoundVolume(),
((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.sizeOffset = -0.5F;
}
else if (!this.onGround && flag)
{
} else if (!this.onGround && flag) {
this.sizeOffset = 1.0F;
}
this.alterSquishAmount();
if (this.worldObj.isRemote)
{
if (this.worldObj.isRemote) {
i = this.getSlimeSize();
this.setSize(0.6F * (float) i, 0.6F * (float) i);
}
}
protected void alterSquishAmount ()
{
protected void alterSquishAmount() {
this.sizeOffset *= 0.6F;
}
@Override
protected void updateEntityActionState ()
{
protected void updateEntityActionState() {
this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
{
if (entityplayer != null) {
this.faceEntity(entityplayer, 10.0F, 20.0F);
}
else if (this.onGround && this.slimeJumpDelay == 1)
{
} else if (this.onGround && this.slimeJumpDelay == 1) {
this.rotationYaw = this.rotationYaw + rand.nextFloat() * 180 - 90;
if (rotationYaw > 360)
rotationYaw -= 360;
if (rotationYaw < 0)
rotationYaw += 360;
if (rotationYaw > 360) rotationYaw -= 360;
if (rotationYaw < 0) rotationYaw += 360;
}
if (this.onGround && this.slimeJumpDelay-- <= 0)
{
if (this.onGround && this.slimeJumpDelay-- <= 0) {
this.slimeJumpDelay = this.getJumpDelay();
if (entityplayer != null)
{
if (entityplayer != null) {
this.slimeJumpDelay /= 12;
}
this.isJumping = true;
if (this.makesSoundOnJump())
{
this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
if (this.makesSoundOnJump()) {
this.playSound(
this.getJumpSound(),
this.getSoundVolume(),
((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F;
this.moveForward = (float) this.getSlimeSize();
}
else
{
} else {
this.isJumping = false;
if (this.onGround)
{
if (this.onGround) {
this.moveStrafing = this.moveForward = 0.0F;
}
}
}
@Override
public void onCollideWithPlayer (EntityPlayer par1EntityPlayer)
{
if (this.canDamagePlayer())
{
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) {
if (this.canDamagePlayer()) {
int i = this.getSlimeSize();
if (this.canEntityBeSeen(par1EntityPlayer) && this.getDistanceSqToEntity(par1EntityPlayer) < 0.6D * (double) i * 0.6D * (double) i && par1EntityPlayer.attackEntityFrom(DamageSource.causeMobDamage(this), this.getAttackStrength()))
{
if (this.canEntityBeSeen(par1EntityPlayer)
&& this.getDistanceSqToEntity(par1EntityPlayer) < 0.6D * (double) i * 0.6D * (double) i
&& par1EntityPlayer.attackEntityFrom(DamageSource.causeMobDamage(this), this.getAttackStrength())) {
this.playSound("mob.attack", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
}
}
}
@Override
public void setDead ()
{
public void setDead() {
int size = this.getSlimeSize();
if (!this.worldObj.isRemote && size > 1 && this.getHealth() <= 0 && size < 8)
{
if (!this.worldObj.isRemote && size > 1 && this.getHealth() <= 0 && size < 8) {
float f = (-0.5F) * (float) size / 4.0F;
float f1 = (-0.5F) * (float) size / 4.0F;
SlimeBase entityslime = this.createInstance(this.worldObj);
entityslime.setSlimeSize(size / 2);
entityslime.setLocationAndAngles(this.posX + (double) f, this.posY + 0.5D, this.posZ + (double) f1, this.rand.nextFloat() * 360.0F, 0.0F);
entityslime.setLocationAndAngles(
this.posX + (double) f,
this.posY + 0.5D,
this.posZ + (double) f1,
this.rand.nextFloat() * 360.0F,
0.0F);
this.worldObj.spawnEntityInWorld(entityslime);
}
@@ -307,56 +282,49 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
// Drops items depending on slime size
@Override
protected void dropFewItems (boolean par1, int par2)
{
protected void dropFewItems(boolean par1, int par2) {
int size = this.getSlimeSize();
Item j = this.getDropItem();
if (j != null && (rand.nextInt(2) == 0) || size >= 8)
{
if (j != null && (rand.nextInt(2) == 0) || size >= 8) {
int k = rand.nextInt(3) + rand.nextInt(this.getSlimeSize());
if (par2 > 0)
{
if (par2 > 0) {
k += this.rand.nextInt(par2 + 1);
}
for (int l = 0; l < k; ++l)
{
for (int l = 0; l < k; ++l) {
this.entityDropItem(new ItemStack(j), 1);
}
}
}
@Override
protected void fall (float distance)
{
protected void fall(float distance) {
// we call the event for proper behaviour with other stuff
ForgeHooks.onLivingFall(this, distance);
// but don't calc damage or anything
}
@Override
public boolean getCanSpawnHere ()
{
public boolean getCanSpawnHere() {
// needs free space
if(!this.worldObj.checkNoEntityCollision(this.boundingBox) || !this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() || this.worldObj.isAnyLiquid(this.boundingBox))
return false;
if (!this.worldObj.checkNoEntityCollision(this.boundingBox)
|| !this.worldObj
.getCollidingBoundingBoxes(this, this.boundingBox)
.isEmpty()
|| this.worldObj.isAnyLiquid(this.boundingBox)) return false;
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.boundingBox.minY);
int z = MathHelper.floor_double(this.posZ);
if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) > this.rand.nextInt(32))
{
if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) > this.rand.nextInt(32)) {
return false;
}
else
{
} else {
int light = this.worldObj.getBlockLightValue(x, y, z);
if (this.worldObj.isThundering())
{
if (this.worldObj.isThundering()) {
int i1 = this.worldObj.skylightSubtracted;
this.worldObj.skylightSubtracted = 10;
light = this.worldObj.getBlockLightValue(x, y, z);
@@ -369,8 +337,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
// slime jockeys!
@Override
public double getMountedYOffset()
{
public double getMountedYOffset() {
return this.height * 0.3;
}
@@ -378,8 +345,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* Returns the sound this mob makes when it is hurt.
*/
@Override
protected String getHurtSound ()
{
protected String getHurtSound() {
return getJumpSound();
}
@@ -387,8 +353,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* Returns the sound this mob makes on death.
*/
@Override
protected String getDeathSound ()
{
protected String getDeathSound() {
return getJumpSound();
}
@@ -396,14 +361,12 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* Returns the volume for the sounds this mob makes.
*/
@Override
protected float getSoundVolume ()
{
protected float getSoundVolume() {
return Math.min(0.05F * (float) this.getSlimeSize(), 0.3f);
}
@Override
public int getVerticalFaceSpeed ()
{
public int getVerticalFaceSpeed() {
return 0;
}
@@ -411,8 +374,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
{
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("Size", this.getSlimeSize() - 1);
}
@@ -421,8 +383,7 @@ public abstract class SlimeBase extends EntityLiving implements IMob {
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
{
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
super.readEntityFromNBT(par1NBTTagCompound);
this.setSlimeSize(par1NBTTagCompound.getInteger("Size") + 1);
}
@@ -6,21 +6,28 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class OreberryBushGen extends WorldGenerator
{
public class OreberryBushGen extends WorldGenerator {
private Block blockB;
private int metadata;
int chance;
private Block[] replaceBlocks;
public OreberryBushGen(Block block, int meta, int chance)
{
this(block, meta, chance, Blocks.stone, (Block) Blocks.grass, Blocks.dirt, Blocks.water, Blocks.sand, Blocks.gravel, Blocks.snow);
public OreberryBushGen(Block block, int meta, int chance) {
this(
block,
meta,
chance,
Blocks.stone,
(Block) Blocks.grass,
Blocks.dirt,
Blocks.water,
Blocks.sand,
Blocks.gravel,
Blocks.snow);
blockB = block;
}
public OreberryBushGen(Block block, int meta, int chance, Block... target)
{
public OreberryBushGen(Block block, int meta, int chance, Block... target) {
blockB = block;
metadata = meta;
this.chance = chance;
@@ -28,85 +35,61 @@ public class OreberryBushGen extends WorldGenerator
}
@Override
public boolean generate (World world, Random random, int x, int y, int z)
{
public boolean generate(World world, Random random, int x, int y, int z) {
int type = random.nextInt(chance);
if (type == 11)
generateMediumNode(world, random, x, y, z);
else if (type >= 5)
generateSmallNode(world, random, x, y, z);
else
generateTinyNode(world, random, x, y, z);
if (type == 11) generateMediumNode(world, random, x, y, z);
else if (type >= 5) generateSmallNode(world, random, x, y, z);
else generateTinyNode(world, random, x, y, z);
return true;
}
public void generateMediumNode (World world, Random random, int x, int y, int z)
{
public void generateMediumNode(World world, Random random, int x, int y, int z) {
for (int xPos = -1; xPos <= 1; xPos++)
for (int yPos = -1; yPos <= 1; yPos++)
for (int zPos = -1; zPos <= 1; zPos++)
if (random.nextInt(4) == 0)
generateBerryBlock(world, x + xPos, y + yPos, z + zPos, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x + xPos, y + yPos, z + zPos, random);
generateSmallNode(world, random, x, y, z);
}
public void generateSmallNode (World world, Random random, int x, int y, int z)
{
public void generateSmallNode(World world, Random random, int x, int y, int z) {
generateBerryBlock(world, x, y, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x + 1, y, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x - 1, y, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y, z + 1, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y, z - 1, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y + 1, z, random);
if (random.nextBoolean())
generateBerryBlock(world, x, y + 1, z, random);
if (random.nextBoolean()) generateBerryBlock(world, x + 1, y, z, random);
if (random.nextBoolean()) generateBerryBlock(world, x - 1, y, z, random);
if (random.nextBoolean()) generateBerryBlock(world, x, y, z + 1, random);
if (random.nextBoolean()) generateBerryBlock(world, x, y, z - 1, random);
if (random.nextBoolean()) generateBerryBlock(world, x, y + 1, z, random);
if (random.nextBoolean()) generateBerryBlock(world, x, y + 1, z, random);
}
public void generateTinyNode (World world, Random random, int x, int y, int z)
{
public void generateTinyNode(World world, Random random, int x, int y, int z) {
generateBerryBlock(world, x, y, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x + 1, y, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x - 1, y, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y, z + 1, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y, z - 1, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y + 1, z, random);
if (random.nextInt(4) == 0)
generateBerryBlock(world, x, y + 1, z, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x + 1, y, z, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x - 1, y, z, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x, y, z + 1, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x, y, z - 1, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x, y + 1, z, random);
if (random.nextInt(4) == 0) generateBerryBlock(world, x, y + 1, z, random);
}
void generateBerryBlock (World world, int x, int y, int z, Random random)
{
void generateBerryBlock(World world, int x, int y, int z, Random random) {
/*
* if (!Block.opaqueCubeLookup[world.getBlockId(x, y, z)]) {
* setBlockAndMetadata(world, x, y, z, blockID, metadata); }
*/
Block block = world.getBlock(x, y, z);
if (block == null || (block != Blocks.end_portal_frame && !world.getBlock(x, y, z).func_149730_j()))
if (block == null
|| (block != Blocks.end_portal_frame && !world.getBlock(x, y, z).func_149730_j()))
world.setBlock(x, y, z, this.blockB, metadata, 2);
else
{
for (int iter = 0; iter < replaceBlocks.length; iter++)
{
if (world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, replaceBlocks[iter]))
{
else {
for (int iter = 0; iter < replaceBlocks.length; iter++) {
if (world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, replaceBlocks[iter])) {
world.setBlock(x, y, z, this.blockB, metadata, 2);
break;
}
}
}
}
}
@@ -2,34 +2,28 @@ package tconstruct.world.gen;
import net.minecraft.world.WorldProvider;
public class OverworldProvider extends WorldProvider
{
public class OverworldProvider extends WorldProvider {
@Override
public String getDimensionName ()
{
public String getDimensionName() {
return "Overworld";
}
@Override
public boolean getWorldHasVoidParticles ()
{
public boolean getWorldHasVoidParticles() {
return this.terrainType.hasVoidParticles(this.hasNoSky);
}
@Override
public float calculateCelestialAngle (long worldtime, float par3)
{
public float calculateCelestialAngle(long worldtime, float par3) {
int timeOfDay = 18000;
float f1 = ((float) timeOfDay + par3) / 24000.0F - 0.25F;
if (f1 < 0.0F)
{
if (f1 < 0.0F) {
++f1;
}
if (f1 > 1.0F)
{
if (f1 > 1.0F) {
--f1;
}
@@ -43,14 +37,14 @@ public class OverworldProvider extends WorldProvider
* public float calculateCelestialAngle(long worldtime, float par3) { int
* timeOfDay = (int)(worldtime % 43200L); float f1 = ((float)timeOfDay +
* par3) / 43200.0F - 0.25F;
*
*
* if (f1 < 0.0F) { ++f1; }
*
*
* if (f1 > 1.0F) { --f1; }
*
*
* float f2 = f1; f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) +
* 1.0D) / 2.0D); f1 = f2 + (f1 - f2) / 3.0F; return f1; }
*
*
* public int getMoonPhase(long par1) { return (int)(par1 / 43200L) % 8; }
*/
}
@@ -6,10 +6,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class PlantGen extends WorldGenerator
{
public class PlantGen extends WorldGenerator {
/** The ID of the plant block used in this plant generator. */
public final Block plant;
public final int metadata;
public int chances = 64;
int xSize = 8;
@@ -17,14 +17,12 @@ public class PlantGen extends WorldGenerator
int zSize = 8;
boolean clumped = true;
public PlantGen(Block b, int meta)
{
public PlantGen(Block b, int meta) {
this.plant = b;
this.metadata = meta;
}
public PlantGen(Block b, int meta, int count, int range, int height, int width, boolean clumped)
{
public PlantGen(Block b, int meta, int count, int range, int height, int width, boolean clumped) {
this.plant = b;
this.metadata = meta;
this.chances = count;
@@ -35,20 +33,19 @@ public class PlantGen extends WorldGenerator
}
@Override
public boolean generate (World world, Random random, int x, int y, int z)
{
for (int iter = 0; iter < chances; ++iter)
{
public boolean generate(World world, Random random, int x, int y, int z) {
for (int iter = 0; iter < chances; ++iter) {
int posX = clumped ? x + random.nextInt(xSize) - random.nextInt(xSize) : x + random.nextInt(xSize);
int posY = clumped ? y + random.nextInt(ySize) - random.nextInt(ySize) : y + random.nextInt(ySize);
int posZ = clumped ? z + random.nextInt(zSize) - random.nextInt(zSize) : z + random.nextInt(zSize);
if (world.getBlock(posX, posY, posZ) == Blocks.air && (!world.provider.hasNoSky || posY < 127) && this.plant.canBlockStay(world, posX, posY, posZ))
{
if (world.getBlock(posX, posY, posZ) == Blocks.air
&& (!world.provider.hasNoSky || posY < 127)
&& this.plant.canBlockStay(world, posX, posY, posZ)) {
world.setBlock(posX, posY, posZ, this.plant, this.metadata, 2);
}
}
return true;
}
}
}
@@ -1,16 +1,12 @@
package tconstruct.world.gen;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.IWorldGenerator;
import java.awt.geom.Ellipse2D;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.*;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.feature.WorldGenerator;
@@ -18,42 +14,43 @@ import tconstruct.tools.TinkerTools;
import tconstruct.util.config.*;
import tconstruct.world.TinkerWorld;
public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
{
public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator {
private Block liquidBlock;
private int gelMeta;
int randomness = 2;
Random random = new Random();
Block base = TinkerTools.craftedSoil;// Block.dirt.blockID;
Block base = TinkerTools.craftedSoil; // Block.dirt.blockID;
Block top = TinkerWorld.slimeGrass;
SlimeTreeGen trees = new SlimeTreeGen(false, 5, 4, 1, 0);
public SlimeIslandGen(Block slimePool, int meta)
{
public SlimeIslandGen(Block slimePool, int meta) {
this.liquidBlock = slimePool;
this.gelMeta = meta;
}
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) // IWorldGenerator
// version
{
public void generate(
Random random,
int chunkX,
int chunkZ,
World world,
IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) // IWorldGenerator
// version
{
// dim 0 only?
if ((chunkGenerator instanceof ChunkProviderFlat || world.provider.terrainType == WorldType.FLAT) && !PHConstruct.genIslandsFlat)
{
if ((chunkGenerator instanceof ChunkProviderFlat || world.provider.terrainType == WorldType.FLAT)
&& !PHConstruct.genIslandsFlat) {
return;
}
if (DimensionBlacklist.isDimInBlacklist(world.provider.dimensionId))
{
if (random.nextInt(PHConstruct.islandRarity) == 0)
generateIsland(world, random, chunkX * 16, chunkZ * 16);
if (DimensionBlacklist.isDimInBlacklist(world.provider.dimensionId)) {
if (random.nextInt(PHConstruct.islandRarity) == 0) generateIsland(world, random, chunkX * 16, chunkZ * 16);
}
}
// Island is biased towards one direction. Quadrants would be more useful
public void generateIsland (World world, Random rand, int xChunk, int zChunk)
{
public void generateIsland(World world, Random rand, int xChunk, int zChunk) {
int xRange = random.nextInt(13) + 20;
int yCenter = 50 + world.getHeightValue(xChunk, zChunk) + random.nextInt(50);
int zRange = random.nextInt(13) + 20;
@@ -62,14 +59,10 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
Ellipse2D.Double ellipse = new Ellipse2D.Double(0, 0, xRange, zRange);
// Basic shape
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 0; y <= height; y++)
{
if (ellipse.contains(x, z))
{
for (int x = 0; x <= xRange; x++) {
for (int z = 0; z <= zRange; z++) {
for (int y = 0; y <= height; y++) {
if (ellipse.contains(x, z)) {
world.setBlock(x + xChunk, y + yCenter, z + zChunk, base, 5, 2);
}
}
@@ -78,23 +71,20 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
// Erode bottom
height = 8;
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 0; y >= -height; y--)
{
for (int x = 0; x <= xRange; x++) {
for (int z = 0; z <= zRange; z++) {
for (int y = 0; y >= -height; y--) {
int xPos = x + xChunk;
int yPos = y + yCenter + height;
int zPos = z + zChunk;
if (world.getBlock(xPos - 1, yPos + 1, zPos) == base && world.getBlock(xPos + 1, yPos + 1, zPos) == base && world.getBlock(xPos, yPos + 1, zPos - 1) == base && world.getBlock(xPos - 1, yPos + 1, zPos + 1) == base && random.nextInt(100) > randomness)
{
if (world.getBlock(xPos - 1, yPos + 1, zPos) == base
&& world.getBlock(xPos + 1, yPos + 1, zPos) == base
&& world.getBlock(xPos, yPos + 1, zPos - 1) == base
&& world.getBlock(xPos - 1, yPos + 1, zPos + 1) == base
&& random.nextInt(100) > randomness) {
;
}
else
{
} else {
world.setBlock(xPos, yPos, zPos, Blocks.air, 0, 2);
}
}
}
@@ -102,21 +92,18 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
// Erode top
height = 3;
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 1; y <= height; y++)
{
for (int x = 0; x <= xRange; x++) {
for (int z = 0; z <= zRange; z++) {
for (int y = 1; y <= height; y++) {
int xPos = x + xChunk;
int yPos = y + yCenter + initialHeight - height + 1;
int zPos = z + zChunk;
if (world.getBlock(xPos - 1, yPos - 1, zPos) == base && world.getBlock(xPos + 1, yPos - 1, zPos) == base && world.getBlock(xPos, yPos - 1, zPos - 1) == base && world.getBlock(xPos - 1, yPos - 1, zPos + 1) == base)
{
if (world.getBlock(xPos - 1, yPos - 1, zPos) == base
&& world.getBlock(xPos + 1, yPos - 1, zPos) == base
&& world.getBlock(xPos, yPos - 1, zPos - 1) == base
&& world.getBlock(xPos - 1, yPos - 1, zPos + 1) == base) {
;
}
else
{
} else {
world.setBlock(xPos, yPos, zPos, Blocks.air, 0, 2);
}
}
@@ -124,53 +111,49 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
}
// Replace blocks
for (int x = 0; x <= xRange; x++)
{
for (int z = 0; z <= zRange; z++)
{
for (int y = 0; y <= height; y++)
{
for (int x = 0; x <= xRange; x++) {
for (int z = 0; z <= zRange; z++) {
for (int y = 0; y <= height; y++) {
int xPos = x + xChunk;
int yPos = y + yCenter + initialHeight - height;
int zPos = z + zChunk;
if (world.getBlock(xPos, yPos, zPos) == base)
{
if (world.getBlock(xPos, yPos, zPos) == base) {
Block block = world.getBlock(xPos, yPos + 1, zPos);
if (block == null || block == Blocks.air)
world.setBlock(xPos, yPos, zPos, top, 0, 2);
if (block == null || block == Blocks.air) world.setBlock(xPos, yPos, zPos, top, 0, 2);
}
}
}
}
// Decorate
if (!DimensionBlacklist.isDimNoPool(world.provider.dimensionId))
{
if (!DimensionBlacklist.isDimNoPool(world.provider.dimensionId)) {
generateSlimePool(world, rand, xChunk + xRange / 2, yCenter + initialHeight, zChunk + zRange / 2);
}
PlantGen tallGrass = new PlantGen(TinkerWorld.slimeTallGrass, 0, 128, xRange, 1, zRange, false);
tallGrass.generate(world, rand, xChunk, yCenter + initialHeight + 1, zChunk);
for (int i = 0; i < 3; i++)
{
trees.generate(world, random, xChunk + random.nextInt(xRange), yCenter + initialHeight + 3, zChunk + random.nextInt(zRange));
for (int i = 0; i < 3; i++) {
trees.generate(
world,
random,
xChunk + random.nextInt(xRange),
yCenter + initialHeight + 3,
zChunk + random.nextInt(zRange));
}
}
public void generateSlimePool (World world, Random rand, int x, int y, int z)
{
public void generateSlimePool(World world, Random rand, int x, int y, int z) {
this.generate(world, rand, x, y, z);
}
@Override
public boolean generate (World world, Random rand, int x, int y, int z) // WorldGenerator
// version
{
public boolean generate(World world, Random rand, int x, int y, int z) // WorldGenerator
// version
{
x -= 8;
z -= 8;
/*
* for (z -= 8; y > 5 && world.isAirBlock(x, y, z); --y) { ; }
*
*
* if (y <= 4) { return false; } else {
*/
y -= 4;
@@ -178,8 +161,7 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
int var7 = rand.nextInt(4) + 4;
int xPos;
for (xPos = 0; xPos < var7; ++xPos)
{
for (xPos = 0; xPos < var7; ++xPos) {
double noise1 = rand.nextDouble() * 6.0D + 3.0D;
double noise2 = rand.nextDouble() * 4.0D + 2.0D;
double noise3 = rand.nextDouble() * 6.0D + 3.0D;
@@ -187,19 +169,15 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
double noise5 = rand.nextDouble() * (8.0D - noise2 - 4.0D) + 2.0D + noise2 / 2.0D;
double noise6 = rand.nextDouble() * (16.0D - noise3 - 2.0D) + 1.0D + noise3 / 2.0D;
for (int xIter = 1; xIter < 15; ++xIter)
{
for (int zIter = 1; zIter < 15; ++zIter)
{
for (int yIter = 1; yIter < 7; ++yIter)
{
for (int xIter = 1; xIter < 15; ++xIter) {
for (int zIter = 1; zIter < 15; ++zIter) {
for (int yIter = 1; yIter < 7; ++yIter) {
double var24 = ((double) xIter - noise4) / (noise1 / 2.0D);
double var26 = ((double) yIter - noise5) / (noise2 / 2.0D);
double var28 = ((double) zIter - noise6) / (noise3 / 2.0D);
double validSpot = var24 * var24 + var26 * var26 + var28 * var28;
if (validSpot < 1.0D)
{
if (validSpot < 1.0D) {
validLocations[(xIter * 16 + zIter) * 8 + yIter] = true;
}
}
@@ -211,25 +189,28 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
int zPos;
boolean var33;
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 0; yPos < 8; ++yPos)
{
var33 = !validLocations[(xPos * 16 + zPos) * 8 + yPos] && (xPos < 15 && validLocations[((xPos + 1) * 16 + zPos) * 8 + yPos] || xPos > 0 && validLocations[((xPos - 1) * 16 + zPos) * 8 + yPos] || zPos < 15 && validLocations[(xPos * 16 + zPos + 1) * 8 + yPos] || zPos > 0 && validLocations[(xPos * 16 + (zPos - 1)) * 8 + yPos] || yPos < 7 && validLocations[(xPos * 16 + zPos) * 8 + yPos + 1] || yPos > 0 && validLocations[(xPos * 16 + zPos) * 8 + (yPos - 1)]);
for (xPos = 0; xPos < 16; ++xPos) {
for (zPos = 0; zPos < 16; ++zPos) {
for (yPos = 0; yPos < 8; ++yPos) {
var33 = !validLocations[(xPos * 16 + zPos) * 8 + yPos]
&& (xPos < 15 && validLocations[((xPos + 1) * 16 + zPos) * 8 + yPos]
|| xPos > 0 && validLocations[((xPos - 1) * 16 + zPos) * 8 + yPos]
|| zPos < 15 && validLocations[(xPos * 16 + zPos + 1) * 8 + yPos]
|| zPos > 0 && validLocations[(xPos * 16 + (zPos - 1)) * 8 + yPos]
|| yPos < 7 && validLocations[(xPos * 16 + zPos) * 8 + yPos + 1]
|| yPos > 0 && validLocations[(xPos * 16 + zPos) * 8 + (yPos - 1)]);
if (var33)
{
Material var12 = world.getBlock(x + xPos, y + yPos, z + zPos).getMaterial();
if (var33) {
Material var12 =
world.getBlock(x + xPos, y + yPos, z + zPos).getMaterial();
if (yPos >= 4 && var12.isLiquid())
{
if (yPos >= 4 && var12.isLiquid()) {
return false;
}
if (yPos < 4 && !var12.isSolid() && world.getBlock(x + xPos, y + yPos, z + zPos) != this.liquidBlock)
{
if (yPos < 4
&& !var12.isSolid()
&& world.getBlock(x + xPos, y + yPos, z + zPos) != this.liquidBlock) {
return false;
}
}
@@ -237,28 +218,22 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
}
}
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 0; yPos < 8; ++yPos)
{
if (validLocations[(xPos * 16 + zPos) * 8 + yPos])
{
for (xPos = 0; xPos < 16; ++xPos) {
for (zPos = 0; zPos < 16; ++zPos) {
for (yPos = 0; yPos < 8; ++yPos) {
if (validLocations[(xPos * 16 + zPos) * 8 + yPos]) {
world.setBlock(x + xPos, y + yPos, z + zPos, yPos >= 4 ? Blocks.air : this.liquidBlock);
}
}
}
}
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 4; yPos < 8; ++yPos)
{
if (validLocations[(xPos * 16 + zPos) * 8 + yPos] && world.getBlock(x + xPos, y + yPos - 1, z + zPos) == base && world.getSavedLightValue(EnumSkyBlock.Sky, x + xPos, y + yPos, z + zPos) > 0)
{
for (xPos = 0; xPos < 16; ++xPos) {
for (zPos = 0; zPos < 16; ++zPos) {
for (yPos = 4; yPos < 8; ++yPos) {
if (validLocations[(xPos * 16 + zPos) * 8 + yPos]
&& world.getBlock(x + xPos, y + yPos - 1, z + zPos) == base
&& world.getSavedLightValue(EnumSkyBlock.Sky, x + xPos, y + yPos, z + zPos) > 0) {
world.setBlock(x + xPos, y + yPos - 1, z + zPos, top, 0, 2);
}
}
@@ -266,18 +241,26 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
}
// Generate blocks around
if (this.liquidBlock.getMaterial() == Material.water)
{
for (xPos = 0; xPos < 16; ++xPos)
{
for (zPos = 0; zPos < 16; ++zPos)
{
for (yPos = 0; yPos < 8; ++yPos)
{
var33 = !validLocations[(xPos * 16 + zPos) * 8 + yPos] && (xPos < 15 && validLocations[((xPos + 1) * 16 + zPos) * 8 + yPos] || xPos > 0 && validLocations[((xPos - 1) * 16 + zPos) * 8 + yPos] || zPos < 15 && validLocations[(xPos * 16 + zPos + 1) * 8 + yPos] || zPos > 0 && validLocations[(xPos * 16 + (zPos - 1)) * 8 + yPos] || yPos < 7 && validLocations[(xPos * 16 + zPos) * 8 + yPos + 1] || yPos > 0 && validLocations[(xPos * 16 + zPos) * 8 + (yPos - 1)]);
if (this.liquidBlock.getMaterial() == Material.water) {
for (xPos = 0; xPos < 16; ++xPos) {
for (zPos = 0; zPos < 16; ++zPos) {
for (yPos = 0; yPos < 8; ++yPos) {
var33 = !validLocations[(xPos * 16 + zPos) * 8 + yPos]
&& (xPos < 15 && validLocations[((xPos + 1) * 16 + zPos) * 8 + yPos]
|| xPos > 0 && validLocations[((xPos - 1) * 16 + zPos) * 8 + yPos]
|| zPos < 15 && validLocations[(xPos * 16 + zPos + 1) * 8 + yPos]
|| zPos > 0 && validLocations[(xPos * 16 + (zPos - 1)) * 8 + yPos]
|| yPos < 7 && validLocations[(xPos * 16 + zPos) * 8 + yPos + 1]
|| yPos > 0 && validLocations[(xPos * 16 + zPos) * 8 + (yPos - 1)]);
if (var33 && (yPos < 4 || rand.nextInt(2) != 0) && world.getBlock(x + xPos, y + yPos, z + zPos).getMaterial().isSolid() && world.getBlock(x + xPos, y + yPos + 1, z + zPos).getMaterial() != Material.water)
{
if (var33
&& (yPos < 4 || rand.nextInt(2) != 0)
&& world.getBlock(x + xPos, y + yPos, z + zPos)
.getMaterial()
.isSolid()
&& world.getBlock(x + xPos, y + yPos + 1, z + zPos)
.getMaterial()
!= Material.water) {
world.setBlock(x + xPos, y + yPos, z + zPos, TinkerWorld.slimeGel, gelMeta, 2);
}
}
@@ -9,8 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.tools.TinkerTools;
import tconstruct.world.TinkerWorld;
public class SlimeTreeGen extends WorldGenerator
{
public class SlimeTreeGen extends WorldGenerator {
public final int minTreeHeight;
public final int treeHeightRange;
public final int metaWood;
@@ -18,8 +17,7 @@ public class SlimeTreeGen extends WorldGenerator
public final boolean seekHeight;
public final boolean notify;
public SlimeTreeGen(boolean notify, int treeHeight, int treeRange, int woodMeta, int leavesMeta)
{
public SlimeTreeGen(boolean notify, int treeHeight, int treeRange, int woodMeta, int leavesMeta) {
super(notify);
this.notify = notify;
this.minTreeHeight = treeHeight;
@@ -30,26 +28,22 @@ public class SlimeTreeGen extends WorldGenerator
}
@Override
public boolean generate (World world, Random random, int xPos, int yPos, int zPos)
{
public boolean generate(World world, Random random, int xPos, int yPos, int zPos) {
int height = random.nextInt(this.treeHeightRange) + this.minTreeHeight;
boolean flag = true;
if (seekHeight)
{
if (seekHeight) {
yPos = findGround(world, xPos, yPos, zPos);
if (yPos == -1)
return false;
if (yPos == -1) return false;
}
if (yPos >= 1 && yPos + height + 1 <= 256)
{
if (yPos >= 1 && yPos + height + 1 <= 256) {
Block soil = world.getBlock(xPos, yPos - 1, zPos);
boolean isSoil = (soil != null && soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, TinkerWorld.slimeSapling));
boolean isSoil = (soil != null
&& soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, TinkerWorld.slimeSapling));
if (isSoil)
{
//TODO Fix this for 1.7
//if (!checkClear(world, xPos, yPos, zPos, height))
if (isSoil) {
// TODO Fix this for 1.7
// if (!checkClear(world, xPos, yPos, zPos, height))
// return false;
soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos);
@@ -61,39 +55,32 @@ public class SlimeTreeGen extends WorldGenerator
return false;
}
boolean checkClear (World world, int x, int y, int z, int treeHeight)
{
for (int yPos = 0; yPos < treeHeight + 1; yPos++)
{
boolean checkClear(World world, int x, int y, int z, int treeHeight) {
for (int yPos = 0; yPos < treeHeight + 1; yPos++) {
int range = 1;
if (yPos == 0)
range = 0;
else if (yPos >= treeHeight - 1)
range = 2;
if (yPos == 0) range = 0;
else if (yPos >= treeHeight - 1) range = 2;
for (int xPos = range; xPos <= range; xPos++)
{
for (int zPos = range; zPos <= range; zPos++)
{
for (int xPos = range; xPos <= range; xPos++) {
for (int zPos = range; zPos <= range; zPos++) {
Block blockID = world.getBlock(x + xPos, y + yPos, z + zPos);
if (blockID != null && blockID != TinkerWorld.slimeSapling && !blockID.isLeaves(world, x + xPos, y + yPos, z + zPos))
return false;
if (blockID != null
&& blockID != TinkerWorld.slimeSapling
&& !blockID.isLeaves(world, x + xPos, y + yPos, z + zPos)) return false;
}
}
}
return true;
}
int findGround (World world, int x, int y, int z)
{
int findGround(World world, int x, int y, int z) {
int ret = -1;
int height = y;
do
{
do {
Block heightID = world.getBlock(x, height, z);
if ((heightID == TinkerTools.craftedSoil || heightID == TinkerWorld.slimeGrass) && !world.getBlock(x, height + 1, z).isOpaqueCube())
{
if ((heightID == TinkerTools.craftedSoil || heightID == TinkerWorld.slimeGrass)
&& !world.getBlock(x, height + 1, z).isOpaqueCube()) {
ret = height + 1;
break;
}
@@ -102,10 +89,8 @@ public class SlimeTreeGen extends WorldGenerator
return ret;
}
void placeCanopy (World world, Random random, int xPos, int yPos, int zPos, int height)
{
for (int i = 0; i < 4; i++)
{
void placeCanopy(World world, Random random, int xPos, int yPos, int zPos, int height) {
for (int i = 0; i < 4; i++) {
placeDiamondLayer(world, xPos, yPos + height - i, zPos, i + 1);
}
@@ -118,66 +103,62 @@ public class SlimeTreeGen extends WorldGenerator
this.setBlockAndMetadata(world, xPos - 1, yPos + height - 3, zPos + 1, Blocks.air, 0);
this.setBlockAndMetadata(world, xPos - 1, yPos + height - 3, zPos - 1, Blocks.air, 0);
//Drippers
// Drippers
this.setBlockAndMetadata(world, xPos + 3, yPos + height - 4, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 3, yPos + height - 4, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 4, zPos - 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 4, zPos + 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 4, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 4, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 4, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 4, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos + 2, yPos + height - 4, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos + 2, yPos + height - 4, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos - 2, yPos + height - 4, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos - 2, yPos + height - 4, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 3, yPos + height - 5, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 3, yPos + height - 5, zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 5, zPos - 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos, yPos + height - 5, zPos + 3, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 5, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos + 2, yPos + height - 5, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 5, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(world, xPos - 2, yPos + height - 5, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos + 2, yPos + height - 5, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos + 2, yPos + height - 5, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos - 2, yPos + height - 5, zPos + 2, TinkerWorld.slimeLeaves, this.metaLeaves);
this.setBlockAndMetadata(
world, xPos - 2, yPos + height - 5, zPos - 2, TinkerWorld.slimeLeaves, this.metaLeaves);
}
void placeDiamondLayer (World world, int xPos, int yPos, int zPos, int range)
{
for (int x = -range; x <= range; x++)
{
for (int z = -range; z <= range; z++)
{
if (Math.abs(x) + Math.abs(z) <= range)
{
void placeDiamondLayer(World world, int xPos, int yPos, int zPos, int range) {
for (int x = -range; x <= range; x++) {
for (int z = -range; z <= range; z++) {
if (Math.abs(x) + Math.abs(z) <= range) {
this.setBlockAndMetadata(world, x + xPos, yPos, z + zPos, TinkerWorld.slimeLeaves, this.metaLeaves);
}
}
}
}
void placeTrunk (World world, int xPos, int yPos, int zPos, int height)
{
for (int localHeight = 0; localHeight < height; ++localHeight)
{
void placeTrunk(World world, int xPos, int yPos, int zPos, int height) {
for (int localHeight = 0; localHeight < height; ++localHeight) {
Block blockID = world.getBlock(xPos, yPos + localHeight, zPos);
if (blockID == Blocks.air || blockID == null || blockID.isLeaves(world, xPos, yPos + localHeight, zPos))
{
if (blockID == Blocks.air || blockID == null || blockID.isLeaves(world, xPos, yPos + localHeight, zPos)) {
this.setBlockAndMetadata(world, xPos, yPos + localHeight, zPos, TinkerWorld.slimeGel, this.metaWood);
}
}
}
protected void setBlockAndMetadata (World world, int x, int y, int z, Block blockID, int blockMeta)
{
protected void setBlockAndMetadata(World world, int x, int y, int z, Block blockID, int blockMeta) {
Block block = world.getBlock(x, y, z);
if (block == null || block.canPlaceBlockAt(world, x, y, z))
{
if (this.notify)
{
if (block == null || block.canPlaceBlockAt(world, x, y, z)) {
if (this.notify) {
world.setBlock(x, y, z, blockID, blockMeta, 3);
}
else
{
} else {
world.setBlock(x, y, z, blockID, blockMeta, 2);
}
}
}
}
}
@@ -8,24 +8,34 @@ import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import tconstruct.util.config.PHConstruct;
public class SurfaceOreGen extends WorldGenerator
{
public class SurfaceOreGen extends WorldGenerator {
/** The block of the ore to be placed using this generator. */
private Block minableBlock;
private int minableBlockMeta = 0;
/** The number of blocks to generate. */
private int numberOfBlocks;
private Block[] replaceBlocks;
private boolean alterSize;
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize)
{
this(b, meta, number, changeSize, Blocks.stone, (Block) Blocks.grass, Blocks.dirt, Blocks.water, Blocks.sand, Blocks.gravel, Blocks.snow);
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize) {
this(
b,
meta,
number,
changeSize,
Blocks.stone,
(Block) Blocks.grass,
Blocks.dirt,
Blocks.water,
Blocks.sand,
Blocks.gravel,
Blocks.snow);
}
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize, Block... target)
{
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize, Block... target) {
this.minableBlock = b;
this.numberOfBlocks = number;
this.replaceBlocks = target;
@@ -33,26 +43,20 @@ public class SurfaceOreGen extends WorldGenerator
minableBlockMeta = meta;
}
int findGround (World world, int x, int y, int z)
{
int findGround(World world, int x, int y, int z) {
int returnHeight = -1;
Block block = world.getBlock(x, y - 1, z);
if (!world.getBlock(x, y, z).isOpaqueCube() && (block == Blocks.dirt || block == Blocks.grass))
{
if (!world.getBlock(x, y, z).isOpaqueCube() && (block == Blocks.dirt || block == Blocks.grass)) {
return y;
}
int height = PHConstruct.seaLevel + 64;
do
{
if (height < PHConstruct.seaLevel - 30)
{
do {
if (height < PHConstruct.seaLevel - 30) {
break;
}
Block b = world.getBlock(x, height, z);
if (b == Blocks.dirt || b == Blocks.grass)
{
if (!world.getBlock(x, height + 1, z).isOpaqueCube())
{
if (b == Blocks.dirt || b == Blocks.grass) {
if (!world.getBlock(x, height + 1, z).isOpaqueCube()) {
returnHeight = height + 1;
}
break;
@@ -63,19 +67,15 @@ public class SurfaceOreGen extends WorldGenerator
}
@Override
public boolean generate (World world, Random random, int startX, int startY, int startZ)
{
if (alterSize)
{
public boolean generate(World world, Random random, int startX, int startY, int startZ) {
if (alterSize) {
startY = findGround(world, startX, startY, startZ);
if (startY == -1)
return false;
if (startY == -1) return false;
}
float f = random.nextFloat() * (float) Math.PI;
int blockNumber = numberOfBlocks;
if (alterSize)
blockNumber = numberOfBlocks * 2 / 5 + random.nextInt(numberOfBlocks * 3 / 5);
if (alterSize) blockNumber = numberOfBlocks * 2 / 5 + random.nextInt(numberOfBlocks * 3 / 5);
double d0 = (double) ((float) (startX + 8) + MathHelper.sin(f) * (float) blockNumber / 8.0F);
double d1 = (double) ((float) (startX + 8) - MathHelper.sin(f) * (float) blockNumber / 8.0F);
double d2 = (double) ((float) (startZ + 8) + MathHelper.cos(f) * (float) blockNumber / 8.0F);
@@ -83,14 +83,15 @@ public class SurfaceOreGen extends WorldGenerator
double d4 = (double) (startY + random.nextInt(3) - 2);
double d5 = (double) (startY + random.nextInt(3) - 2);
for (int l = 0; l <= blockNumber; ++l)
{
for (int l = 0; l <= blockNumber; ++l) {
double d6 = d0 + (d1 - d0) * (double) l / (double) blockNumber;
double d7 = d4 + (d5 - d4) * (double) l / (double) blockNumber;
double d8 = d2 + (d3 - d2) * (double) l / (double) blockNumber;
double d9 = random.nextDouble() * (double) blockNumber / 16.0D;
double d10 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
double d11 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
double d10 =
(double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
double d11 =
(double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);
int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);
int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);
@@ -98,33 +99,26 @@ public class SurfaceOreGen extends WorldGenerator
int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);
int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);
for (int k2 = i1; k2 <= l1; ++k2)
{
for (int k2 = i1; k2 <= l1; ++k2) {
double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D);
if (d12 * d12 < 1.0D)
{
for (int l2 = j1; l2 <= i2; ++l2)
{
if (d12 * d12 < 1.0D) {
for (int l2 = j1; l2 <= i2; ++l2) {
double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D);
if (d12 * d12 + d13 * d13 < 1.0D)
{
for (int i3 = k1; i3 <= j2; ++i3)
{
if (d12 * d12 + d13 * d13 < 1.0D) {
for (int i3 = k1; i3 <= j2; ++i3) {
double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D);
Block block = world.getBlock(k2, l2, i3);
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
{
if (block == null || !world.getBlock(k2, l2, i3).isOpaqueCube())
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) {
if (block == null
|| !world.getBlock(k2, l2, i3).isOpaqueCube())
world.setBlock(k2, l2, i3, this.minableBlock, minableBlockMeta, 2);
else
{
for (int iter = 0; iter < replaceBlocks.length; iter++)
{
if (world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, replaceBlocks[iter]))
{
else {
for (int iter = 0; iter < replaceBlocks.length; iter++) {
if (world.getBlock(k2, l2, i3)
.isReplaceableOreGen(world, k2, l2, i3, replaceBlocks[iter])) {
world.setBlock(k2, l2, i3, this.minableBlock, minableBlockMeta, 2);
break;
}
@@ -11,10 +11,8 @@ import net.minecraft.world.gen.feature.WorldGenMinable;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
public class TBaseWorldGenerator implements IWorldGenerator
{
public TBaseWorldGenerator()
{
public class TBaseWorldGenerator implements IWorldGenerator {
public TBaseWorldGenerator() {
copper = new WorldGenMinable(TinkerWorld.oreSlag, 3, 8, Blocks.stone);
tin = new WorldGenMinable(TinkerWorld.oreSlag, 4, 8, Blocks.stone);
aluminum = new WorldGenMinable(TinkerWorld.oreSlag, 5, 6, Blocks.stone);
@@ -31,90 +29,77 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
if (world.provider.isHellWorld)
{
public void generate(
Random random,
int chunkX,
int chunkZ,
World world,
IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
if (world.provider.isHellWorld) {
generateNether(random, chunkX * 16, chunkZ * 16, world);
}
else if (world.provider.terrainType != WorldType.FLAT || PHConstruct.genOresFlat)
{
} else if (world.provider.terrainType != WorldType.FLAT || PHConstruct.genOresFlat) {
generateSurface(random, chunkX * 16, chunkZ * 16, world);
if (world.provider.dimensionId == 0)
generateOreBushes(random, chunkX * 16, chunkZ * 16, world);
if (world.provider.dimensionId == 0) generateOreBushes(random, chunkX * 16, chunkZ * 16, world);
}
if (PHConstruct.superfunWorld && world.provider.dimensionId == 0)
{
if (PHConstruct.superfunWorld && world.provider.dimensionId == 0) {
superfunGenerate(random, chunkX * 16, chunkZ * 16, world);
}
if (PHConstruct.worldBorder)
{
if (PHConstruct.worldBorder) {
generateChunkBorder(random, chunkX * 16, chunkZ * 16, world);
}
}
void generateSurface (Random random, int xChunk, int zChunk, World world)
{
void generateSurface(Random random, int xChunk, int zChunk, World world) {
String biomeName = world.getWorldChunkManager().getBiomeGenAt(xChunk, zChunk).biomeName;
generateUndergroundOres(random, xChunk, zChunk, world);
if (biomeName == "Extreme Hills Edge" || biomeName == "Extreme Hills")
{
if (biomeName == "Extreme Hills Edge" || biomeName == "Extreme Hills") {
generateUndergroundOres(random, xChunk, zChunk, world);
}
}
void generateUndergroundOres (Random random, int xChunk, int zChunk, World world)
{
void generateUndergroundOres(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos;
if (PHConstruct.generateCopper)
{
for (int q = 0; q <= PHConstruct.copperuDensity; q++)
{
if (PHConstruct.generateCopper) {
for (int q = 0; q <= PHConstruct.copperuDensity; q++) {
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.copperuMinY + random.nextInt(PHConstruct.copperuMaxY - PHConstruct.copperuMinY);
zPos = zChunk + random.nextInt(16);
copper.generate(world, random, xPos, yPos, zPos);
}
}
if (PHConstruct.generateTin)
{
for (int q = 0; q <= PHConstruct.tinuDensity; q++)
{
if (PHConstruct.generateTin) {
for (int q = 0; q <= PHConstruct.tinuDensity; q++) {
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.tinuMinY + random.nextInt(PHConstruct.tinuMaxY - PHConstruct.tinuMinY);
zPos = zChunk + random.nextInt(16);
tin.generate(world, random, xPos, yPos, zPos);
}
}
if (PHConstruct.generateAluminum)
{
for (int q = 0; q <= PHConstruct.aluminumuDensity; q++)
{
if (PHConstruct.generateAluminum) {
for (int q = 0; q <= PHConstruct.aluminumuDensity; q++) {
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.aluminumuMinY + random.nextInt(PHConstruct.aluminumuMaxY - PHConstruct.aluminumuMinY);
yPos = PHConstruct.aluminumuMinY
+ random.nextInt(PHConstruct.aluminumuMaxY - PHConstruct.aluminumuMinY);
zPos = zChunk + random.nextInt(16);
aluminum.generate(world, random, xPos, yPos, zPos);
}
}
}
void generateOreBushes (Random random, int xChunk, int zChunk, World world)
{
void generateOreBushes(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos;
if (PHConstruct.generateIronBush && random.nextInt(PHConstruct.ironBushRarity + 1) == 0)
{
for (int i = 0; i < PHConstruct.ironBushDensity; i++)
{
if (PHConstruct.generateIronBush && random.nextInt(PHConstruct.ironBushRarity + 1) == 0) {
for (int i = 0; i < PHConstruct.ironBushDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.seaLevel - 32;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.seaLevel, 0);
if (yPos != -1)
{
if (yPos != -1) {
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Iron: "+coord.toString());
@@ -123,16 +108,13 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
}
if (PHConstruct.generateGoldBush && random.nextInt(PHConstruct.goldBushRarity + 1) == 0)
{
for (int i = 0; i < PHConstruct.goldBushDensity; i++)
{
if (PHConstruct.generateGoldBush && random.nextInt(PHConstruct.goldBushRarity + 1) == 0) {
for (int i = 0; i < PHConstruct.goldBushDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = 16;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, 32, 0);
if (yPos != -1)
{
if (yPos != -1) {
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Gold: "+coord.toString());
@@ -141,19 +123,18 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
}
if (PHConstruct.generateCopperBush && random.nextInt(PHConstruct.copperBushRarity + 1) == 0)// &&
// random.nextInt(PHConstruct.copperbRarity)
// ==
// 0)
if (PHConstruct.generateCopperBush && random.nextInt(PHConstruct.copperBushRarity + 1) == 0) // &&
// random.nextInt(PHConstruct.copperbRarity)
// ==
// 0)
{
for (int i = 0; i < PHConstruct.copperBushDensity; i++)
{
for (int i = 0; i < PHConstruct.copperBushDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = (PHConstruct.copperBushMaxY + PHConstruct.copperBushMinY) / 2;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.copperBushMaxY, PHConstruct.copperBushMinY);
if (yPos != -1)
{
yPos = findAdequateLocation(
world, xPos, yPos, zPos, PHConstruct.copperBushMaxY, PHConstruct.copperBushMinY);
if (yPos != -1) {
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Copper: "+coord.toString());
@@ -162,18 +143,16 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
}
if (PHConstruct.generateTinBush && random.nextInt(PHConstruct.tinBushRarity + 1) == 0)// &&
// random.nextInt(PHConstruct.tinbRarity)
// == 0)
if (PHConstruct.generateTinBush && random.nextInt(PHConstruct.tinBushRarity + 1) == 0) // &&
// random.nextInt(PHConstruct.tinbRarity)
// == 0)
{
for (int i = 0; i < PHConstruct.tinBushDensity; i++)
{
for (int i = 0; i < PHConstruct.tinBushDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = (PHConstruct.tinBushMaxY + PHConstruct.tinBushMinY) / 2;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.tinBushMaxY, PHConstruct.tinBushMinY);
if (yPos != -1)
{
if (yPos != -1) {
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Tin: "+coord.toString());
@@ -182,19 +161,18 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
}
if (PHConstruct.generateAluminumBush && random.nextInt(PHConstruct.aluminumBushRarity + 1) == 0)// &&
// random.nextInt(PHConstruct.aluminumbRarity)
// ==
// 0)
if (PHConstruct.generateAluminumBush && random.nextInt(PHConstruct.aluminumBushRarity + 1) == 0) // &&
// random.nextInt(PHConstruct.aluminumbRarity)
// ==
// 0)
{
for (int i = 0; i < PHConstruct.aluminumBushDensity; i++)
{
for (int i = 0; i < PHConstruct.aluminumBushDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = (PHConstruct.aluminumBushMaxY + PHConstruct.aluminumBushMinY) / 2;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, PHConstruct.aluminumBushMaxY, PHConstruct.aluminumBushMinY);
if (yPos != -1)
{
yPos = findAdequateLocation(
world, xPos, yPos, zPos, PHConstruct.aluminumBushMaxY, PHConstruct.aluminumBushMinY);
if (yPos != -1) {
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Aluminum: "+coord.toString());
@@ -203,16 +181,13 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
}
if (PHConstruct.generateEssenceBush && random.nextInt(PHConstruct.essenceBushRarity) == 0)
{
for (int i = 0; i < PHConstruct.silverBushDensity; i++)
{
if (PHConstruct.generateEssenceBush && random.nextInt(PHConstruct.essenceBushRarity) == 0) {
for (int i = 0; i < PHConstruct.silverBushDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = PHConstruct.seaLevel - 16;
zPos = zChunk + random.nextInt(16);
yPos = findAdequateLocation(world, xPos, yPos, zPos, 32, 0);
if (yPos != -1)
{
if (yPos != -1) {
/*
* CoordTuple coord = new CoordTuple(xPos, yPos, zPos);
* TConstruct.logger.info("Silver: "+coord.toString());
@@ -223,39 +198,30 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
void generateNether (Random random, int xChunk, int zChunk, World world)
{
void generateNether(Random random, int xChunk, int zChunk, World world) {
int xPos, yPos, zPos;
if (PHConstruct.generateCobalt)
{
for (int i = 0; i < PHConstruct.cobaltDensity; i++)
{
if (PHConstruct.generateCobalt) {
for (int i = 0; i < PHConstruct.cobaltDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(64) + 32;
zPos = zChunk + random.nextInt(16);
cobalt.generate(world, random, xPos, yPos, zPos);
}
for (int i = 0; i < PHConstruct.cobaltDensity; i++)
{
for (int i = 0; i < PHConstruct.cobaltDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(128);
zPos = zChunk + random.nextInt(16);
cobalt.generate(world, random, xPos, yPos, zPos);
}
}
if (PHConstruct.generateArdite)
{
for (int i = 0; i < PHConstruct.arditeDensity; i++)
{
if (PHConstruct.generateArdite) {
for (int i = 0; i < PHConstruct.arditeDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(64) + 32;
zPos = zChunk + random.nextInt(16);
ardite.generate(world, random, xPos, yPos, zPos);
}
for (int i = 0; i < PHConstruct.arditeDensity; i++)
{
for (int i = 0; i < PHConstruct.arditeDensity; i++) {
xPos = xChunk + random.nextInt(16);
yPos = random.nextInt(128);
zPos = zChunk + random.nextInt(16);
@@ -264,19 +230,16 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
int findAdequateLocation (World world, int x, int y, int z, int heightLimit, int depthLimit)
{
int findAdequateLocation(World world, int x, int y, int z, int heightLimit, int depthLimit) {
int height = y;
do
{
do {
if (world.getBlock(x, height, z) == Blocks.air && world.getBlock(x, height + 1, z) != Blocks.air)
return height + 1;
height++;
} while (height < heightLimit);
height = y;
do
{
do {
if (world.getBlock(x, height, z) == Blocks.air && world.getBlock(x, height - 1, z) != Blocks.air)
return height - 1;
height--;
@@ -285,28 +248,22 @@ public class TBaseWorldGenerator implements IWorldGenerator
return -1;
}
void superfunGenerate (Random random, int chunkX, int chunkZ, World world)
{
void superfunGenerate(Random random, int chunkX, int chunkZ, World world) {
/*
* for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++)
* world.setBlock(x+chunkX, 192, z+chunkZ, Block.glowStone);
*/
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
for (int y = 0; y < 128; y++)
{
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < 128; y++) {
Block block = world.getBlock(x + chunkX, y, z + chunkZ);
if (block != null)
{
if (block != null) {
if (block.getMaterial() == Material.leaves)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.lava, 0, 0);
if (block.getMaterial() == Material.wood)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.netherrack, 0, 0);
if (block == Blocks.stone)
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.end_stone, 0, 0);
if (block == Blocks.stone) world.setBlock(x + chunkX, y, z + chunkZ, Blocks.end_stone, 0, 0);
if (y > 40 && (block.getMaterial() == Material.ground || block.getMaterial() == Material.grass))
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.soul_sand, 0, 0);
if (block.getMaterial() == Material.sand)
@@ -317,16 +274,14 @@ public class TBaseWorldGenerator implements IWorldGenerator
}
}
void generateChunkBorder (Random random, int chunkX, int chunkZ, World world)
{
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
if (x + chunkX == PHConstruct.worldBorderSize || x + chunkX == -PHConstruct.worldBorderSize || z + chunkZ == PHConstruct.worldBorderSize || z + chunkZ == -PHConstruct.worldBorderSize)
{
for (int y = 0; y < 256; y++)
{
void generateChunkBorder(Random random, int chunkX, int chunkZ, World world) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
if (x + chunkX == PHConstruct.worldBorderSize
|| x + chunkX == -PHConstruct.worldBorderSize
|| z + chunkZ == PHConstruct.worldBorderSize
|| z + chunkZ == -PHConstruct.worldBorderSize) {
for (int y = 0; y < 256; y++) {
world.setBlock(x + chunkX, y, z + chunkZ, Blocks.bedrock, 0, 0);
}
}
@@ -1,5 +1,8 @@
package tconstruct.world.gen;
import static net.minecraft.world.biome.BiomeGenBase.*;
import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND;
import com.google.common.collect.*;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.util.Random;
@@ -9,11 +12,7 @@ import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
import static net.minecraft.world.biome.BiomeGenBase.*;
import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND;
public class TerrainGenEventHandler
{
public class TerrainGenEventHandler {
private final SurfaceOreGen ironSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 0, 12, true);
private final SurfaceOreGen goldSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 1, 20, true);
private final SurfaceOreGen copperSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 2, 12, true);
@@ -21,67 +20,57 @@ public class TerrainGenEventHandler
private final SurfaceOreGen aluminumSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 4, 12, true);
private final SurfaceOreGen cobaltSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 5, 30, true);
private static ImmutableCollection<BiomeGenBase> EXTRA_ORE_BIOMES = ImmutableList.of(extremeHills, extremeHillsEdge);
private static ImmutableCollection<BiomeGenBase> EXTRA_ORE_BIOMES =
ImmutableList.of(extremeHills, extremeHillsEdge);
@SubscribeEvent
public void onDecorateEvent (Decorate e)
{
public void onDecorateEvent(Decorate e) {
// Trigger just before sand pass one--which comes just after vanilla ore
// generation.
if (e.type != SAND)
return;
if (e.type != SAND) return;
BiomeGenBase biome = e.world.getWorldChunkManager().getBiomeGenAt(e.chunkX, e.chunkZ);
int iterations = EXTRA_ORE_BIOMES.contains(biome) ? 2 : 1;
for (int i = 0; i < iterations; i++)
{
for (int i = 0; i < iterations; i++) {
generateSurfaceOres(e.rand, e.chunkX, e.chunkZ, e.world);
}
}
private void generateSurfaceOres (Random random, int xChunk, int zChunk, World world)
{
if(random == null)
return;
private void generateSurfaceOres(Random random, int xChunk, int zChunk, World world) {
if (random == null) return;
int xPos, yPos, zPos;
if (PHConstruct.generateIronSurface && random.nextInt(PHConstruct.ironsRarity) == 0)
{
if (PHConstruct.generateIronSurface && random.nextInt(PHConstruct.ironsRarity) == 0) {
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
ironSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateGoldSurface && random.nextInt(PHConstruct.goldsRarity) == 0)
{
if (PHConstruct.generateGoldSurface && random.nextInt(PHConstruct.goldsRarity) == 0) {
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
goldSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateCopperSurface && random.nextInt(PHConstruct.coppersRarity) == 0)
{
if (PHConstruct.generateCopperSurface && random.nextInt(PHConstruct.coppersRarity) == 0) {
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
copperSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateTinSurface && random.nextInt(PHConstruct.tinsRarity) == 0)
{
if (PHConstruct.generateTinSurface && random.nextInt(PHConstruct.tinsRarity) == 0) {
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
tinSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateAluminumSurface && random.nextInt(PHConstruct.aluminumsRarity) == 0)
{
if (PHConstruct.generateAluminumSurface && random.nextInt(PHConstruct.aluminumsRarity) == 0) {
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
aluminumSurface.generate(world, random, xPos, yPos, zPos);
}
if (PHConstruct.generateCobaltSurface && random.nextInt(PHConstruct.cobaltsRarity) == 0)
{
if (PHConstruct.generateCobaltSurface && random.nextInt(PHConstruct.cobaltsRarity) == 0) {
xPos = xChunk + random.nextInt(16);
yPos = 64 + PHConstruct.seaLevel;
zPos = zChunk + random.nextInt(16);
@@ -9,95 +9,91 @@ import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraft.world.World;
public class BarricadeItem extends ItemBlock
{
public class BarricadeItem extends ItemBlock {
private Block b;
public BarricadeItem(Block b)
{
public BarricadeItem(Block b) {
super(b);
this.b = b;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(StatCollector.translateToLocal("barricade.tooltip"));
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ) {
Block b = world.getBlock(x, y, z);
if (b == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1)
{
if (b == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1) {
side = 1;
}
else if (b != Blocks.vine && b != Blocks.tallgrass && b != Blocks.deadbush && (b == null || !b.canPlaceBlockAt(world, x, y, z)))
{
if (side == 0)
{
} else if (b != Blocks.vine
&& b != Blocks.tallgrass
&& b != Blocks.deadbush
&& (b == null || !b.canPlaceBlockAt(world, x, y, z))) {
if (side == 0) {
--y;
}
if (side == 1)
{
if (side == 1) {
++y;
}
if (side == 2)
{
if (side == 2) {
--z;
}
if (side == 3)
{
if (side == 3) {
++z;
}
if (side == 4)
{
if (side == 4) {
--x;
}
if (side == 5)
{
if (side == 5) {
++x;
}
}
if (stack.stackSize == 0)
{
if (stack.stackSize == 0) {
return false;
}
else if (!player.canPlayerEdit(x, y, z, side, stack))
{
} else if (!player.canPlayerEdit(x, y, z, side, stack)) {
return false;
}
else if (y == 255 && this.b.getMaterial().isSolid())
{
} else if (y == 255 && this.b.getMaterial().isSolid()) {
return false;
}
else if (world.canPlaceEntityOnSide(this.b, x, y, z, false, side, player, stack))
{
} else if (world.canPlaceEntityOnSide(this.b, x, y, z, false, side, player, stack)) {
Block block = this.b;
// int meta = this.getMetadata(stack.getItemDamage());
int rotation = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int meta = rotation * 4;
int metadata = this.b.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, meta);
if (placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
{
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.soundName, (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) {
world.playSoundEffect(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
block.stepSound.soundName,
(block.stepSound.getVolume() + 1.0F) / 2.0F,
block.stepSound.getPitch() * 0.8F);
--stack.stackSize;
}
return true;
}
else
{
} else {
return false;
}
}
@@ -8,42 +8,41 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
public class CraftedSoilItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "Slime", "Grout", "BlueSlime", "GraveyardSoil", "ConsecratedSoil", "blue", "dirt", "Grout" };
public class CraftedSoilItemBlock extends MultiItemBlock {
public static final String blockTypes[] = {
"Slime", "Grout", "BlueSlime", "GraveyardSoil", "ConsecratedSoil", "blue", "dirt", "Grout"
};
public CraftedSoilItemBlock(Block b)
{
public CraftedSoilItemBlock(Block b) {
super(b, "CraftedSoil", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName (ItemStack itemstack)
{
public String getUnlocalizedName(ItemStack itemstack) {
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, this.blockTypes.length - 1);
if (pos <= 4)
return super.getUnlocalizedName(itemstack);
return (new StringBuilder()).append("block.slime.soil.").append(this.blockTypes[pos]).toString();
if (pos <= 4) return super.getUnlocalizedName(itemstack);
return (new StringBuilder())
.append("block.slime.soil.")
.append(this.blockTypes[pos])
.toString();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 1:
if(StatCollector.canTranslate("grout.tooltip"))
list.add(StatCollector.translateToLocal("grout.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("craftedsoil1.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("craftedsoil2.tooltip"));
break;
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage()) {
case 1:
if (StatCollector.canTranslate("grout.tooltip"))
list.add(StatCollector.translateToLocal("grout.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("craftedsoil1.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("craftedsoil2.tooltip"));
break;
}
}
}
@@ -3,15 +3,12 @@ package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class GravelOreItem extends MultiItemBlock
{
public static final String blockTypes[] = { "iron", "gold", "copper", "tin", "aluminum", "cobalt" };
public class GravelOreItem extends MultiItemBlock {
public static final String blockTypes[] = {"iron", "gold", "copper", "tin", "aluminum", "cobalt"};
public GravelOreItem(Block b)
{
public GravelOreItem(Block b) {
super(b, "block.ore.gravel", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -10,19 +10,14 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class HamboneItemBlock extends ItemBlock
{
public HamboneItemBlock(Block b)
{
public class HamboneItemBlock extends ItemBlock {
public HamboneItemBlock(Block b) {
super(b);
itemUseDuration = 32;
if (Loader.isModLoaded("HungerOverhaul"))
{
if (Loader.isModLoaded("HungerOverhaul")) {
healAmount = 8;
saturationModifier = 0.8f;
}
else
{
} else {
healAmount = 20;
saturationModifier = 3.0f;
}
@@ -31,8 +26,7 @@ public class HamboneItemBlock extends ItemBlock
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add("\u00A74" + StatCollector.translateToLocal("hambone1.tooltip"));
list.add(StatCollector.translateToLocal("hambone2.tooltip"));
}
@@ -42,6 +36,7 @@ public class HamboneItemBlock extends ItemBlock
/** The amount this food item heals the player. */
private final int healAmount;
private final float saturationModifier;
/** Whether wolves like this food (true for raw and cooked porkchop). */
@@ -73,14 +68,13 @@ public class HamboneItemBlock extends ItemBlock
* super(par1); this.itemUseDuration = 32; this.healAmount = par2;
* this.isWolfsFavoriteMeat = par4; this.saturationModifier = par3;
* this.setCreativeTab(CreativeTabs.tabFood); }
*
*
* public ItemFood(int par1, int par2, boolean par3) { this(par1, par2,
* 0.6F, par3); }
*/
@Override
public ItemStack onEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
--par1ItemStack.stackSize;
par3EntityPlayer.getFoodStats().addStats(getHealAmount(), getSaturationModifier());
par2World.playSoundAtEntity(par3EntityPlayer, "random.burp", 0.5F, par2World.rand.nextFloat() * 0.1F + 0.9F);
@@ -88,11 +82,10 @@ public class HamboneItemBlock extends ItemBlock
return par1ItemStack;
}
protected void onFoodEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par2World.isRemote && this.potionId > 0 && par2World.rand.nextFloat() < this.potionEffectProbability)
{
par3EntityPlayer.addPotionEffect(new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier));
protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!par2World.isRemote && this.potionId > 0 && par2World.rand.nextFloat() < this.potionEffectProbability) {
par3EntityPlayer.addPotionEffect(
new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier));
}
}
@@ -100,8 +93,7 @@ public class HamboneItemBlock extends ItemBlock
* How long it takes to use or consume an item
*/
@Override
public int getMaxItemUseDuration (ItemStack par1ItemStack)
{
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
return 32;
}
@@ -110,8 +102,7 @@ public class HamboneItemBlock extends ItemBlock
* is being used
*/
@Override
public EnumAction getItemUseAction (ItemStack par1ItemStack)
{
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.eat;
}
@@ -120,34 +111,29 @@ public class HamboneItemBlock extends ItemBlock
* pressed. Args: itemStack, world, entityPlayer
*/
@Override
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.canEat(this.alwaysEdible))
{
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (par3EntityPlayer.canEat(this.alwaysEdible)) {
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public int getHealAmount ()
{
public int getHealAmount() {
return this.healAmount;
}
/**
* gets the saturationModifier of the ItemFood
*/
public float getSaturationModifier ()
{
public float getSaturationModifier() {
return this.saturationModifier;
}
/**
* Whether wolves like this food (true for raw and cooked porkchop).
*/
public boolean isWolfsFavoriteMeat ()
{
public boolean isWolfsFavoriteMeat() {
return this.isWolfsFavoriteMeat;
}
}
@@ -7,25 +7,20 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class MetalOreItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "NetherSlag", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag" };
public class MetalOreItemBlock extends MultiItemBlock {
public static final String blockTypes[] = {"NetherSlag", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag"};
public MetalOreItemBlock(Block b)
{
public MetalOreItemBlock(Block b) {
super(b, "MetalOre", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (stack.hasTagCompound())
{
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack.hasTagCompound()) {
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Liquid");
if (liquidTag != null)
{
if (liquidTag != null) {
list.add("Contains " + liquidTag.getString("LiquidName"));
list.add(liquidTag.getInteger("Amount") + " mB");
}
@@ -13,69 +13,68 @@ import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.world.TinkerWorld;
public class OreberryBushItem extends MultiItemBlock
{
public class OreberryBushItem extends MultiItemBlock {
public Block blockB;
public static final String blockTypes[] = { "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin" };
public static final String blockTypes[] = {
"iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron", "gold", "copper", "tin", "iron",
"gold", "copper", "tin"
};
public OreberryBushItem(Block b)
{
public OreberryBushItem(Block b) {
super(b, "block.oreberry", blockTypes);
blockB = b;
setHasSubtypes(true);
}
@Override
public int getMetadata (int meta)
{
public int getMetadata(int meta) {
return meta % 4;
}
/* Place bushes on dirt, grass, or other bushes only */
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10)
{
if (side != 1)
return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
{
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float par8,
float par9,
float par10) {
if (side != 1) return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) {
Block block = world.getBlock(x, y, z);
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerry) && WorldHelper.isAirBlock(world, x, y + 1, z))
{
if (block != null
&& block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerry)
&& WorldHelper.isAirBlock(world, x, y + 1, z)) {
world.setBlock(x, y + 1, z, blockB, stack.getItemDamage() % 4, 3);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
if (!player.capabilities.isCreativeMode) stack.stackSize--;
if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
return true;
}
else
return false;
}
else
return false;
} else return false;
} else return false;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage() % 4)
{
case 0:
list.add(StatCollector.translateToLocal("oreberrybush1.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush2.tooltip"));
break;
case 2:
list.add(StatCollector.translateToLocal("oreberrybush3.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("oreberrybush4.tooltip"));
break;
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage() % 4) {
case 0:
list.add(StatCollector.translateToLocal("oreberrybush1.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush2.tooltip"));
break;
case 2:
list.add(StatCollector.translateToLocal("oreberrybush3.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("oreberrybush4.tooltip"));
break;
}
}
}
@@ -13,67 +13,79 @@ import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.world.TinkerWorld;
public class OreberryBushSecondItem extends MultiItemBlock
{
public class OreberryBushSecondItem extends MultiItemBlock {
public Block blockB;
public static final String blockTypes[] = { "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "" };
public static final String blockTypes[] = {
"aluminum",
"essence",
"",
"",
"aluminum",
"essence",
"",
"",
"aluminum",
"essence",
"",
"",
"aluminum",
"essence",
"",
""
};
public OreberryBushSecondItem(Block b)
{
public OreberryBushSecondItem(Block b) {
super(b, "block.oreberry", blockTypes);
blockB = b;
setHasSubtypes(true);
}
@Override
public int getMetadata (int meta)
{
public int getMetadata(int meta) {
return meta % 4;
}
/* Place bushes on dirt, grass, or other bushes only */
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if (side != 1)
return false;
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ) {
if (side != 1) return false;
int meta = stack.getItemDamage();
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y + 1, z) >= 13)
return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
{
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y + 1, z) >= 13) return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) {
Block block = world.getBlock(x, y, z);
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerrySecond) && WorldHelper.isAirBlock(world, x, y + 1, z))
{
if (block != null
&& block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerrySecond)
&& WorldHelper.isAirBlock(world, x, y + 1, z)) {
world.setBlock(x, y + 1, z, blockB, stack.getItemDamage() % 4, 3);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
if (!player.capabilities.isCreativeMode) stack.stackSize--;
if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
return true;
}
else
return false;
}
else
return false;
} else return false;
} else return false;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage() % 4)
{
case 0:
list.add(StatCollector.translateToLocal("oreberrybush5.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush6.tooltip"));
break;
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage() % 4) {
case 0:
list.add(StatCollector.translateToLocal("oreberrybush5.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush6.tooltip"));
break;
}
}
}
@@ -3,15 +3,12 @@ package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeGelItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "blue", "green", "purple", "magma", "yellow", "red", "metal" };
public class SlimeGelItemBlock extends MultiItemBlock {
public static final String blockTypes[] = {"blue", "green", "purple", "magma", "yellow", "red", "metal"};
public SlimeGelItemBlock(Block b)
{
public SlimeGelItemBlock(Block b) {
super(b, "block.slime.congealed", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -3,15 +3,12 @@ package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeGrassItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "blue", "dirt" };
public class SlimeGrassItemBlock extends MultiItemBlock {
public static final String blockTypes[] = {"blue", "dirt"};
public SlimeGrassItemBlock(Block b)
{
public SlimeGrassItemBlock(Block b) {
super(b, "block.slime.grass", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -3,15 +3,12 @@ package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeLeavesItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "blue" };
public class SlimeLeavesItemBlock extends MultiItemBlock {
public static final String blockTypes[] = {"blue"};
public SlimeLeavesItemBlock(Block b)
{
public SlimeLeavesItemBlock(Block b) {
super(b, "block.slime.leaves", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -3,15 +3,12 @@ package tconstruct.world.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class SlimeSaplingItemBlock extends MultiItemBlock
{
public static final String blockTypes[] = { "bluegreen" };
public class SlimeSaplingItemBlock extends MultiItemBlock {
public static final String blockTypes[] = {"bluegreen"};
public SlimeSaplingItemBlock(Block b)
{
public SlimeSaplingItemBlock(Block b) {
super(b, "block.slime.sapling", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
}
}
@@ -6,12 +6,10 @@ import net.minecraft.block.Block;
import net.minecraft.util.*;
import tconstruct.world.TinkerWorld;
public class SlimeTallGrassItem extends MultiItemBlock
{
public static final String blockTypes[] = { "tallgrass", "tallgrass.fern" };
public class SlimeTallGrassItem extends MultiItemBlock {
public static final String blockTypes[] = {"tallgrass", "tallgrass.fern"};
public SlimeTallGrassItem(Block b)
{
public SlimeTallGrassItem(Block b) {
super(b, "block.slime", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
@@ -19,10 +17,8 @@ public class SlimeTallGrassItem extends MultiItemBlock
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage (int meta)
{
public IIcon getIconFromDamage(int meta) {
int arr = MathHelper.clamp_int(meta, 0, this.blockTypes.length);
return TinkerWorld.slimeTallGrass.getIcon(0, arr);
}
}
@@ -8,12 +8,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class SoilSlabItem extends MultiItemBlock
{
public static final String blockTypes[] = { "grass", "dirt", "mycelium", "slime", "grout", "blueslime", "graveyardsoil", "consecratedsoil" };
public class SoilSlabItem extends MultiItemBlock {
public static final String blockTypes[] = {
"grass", "dirt", "mycelium", "slime", "grout", "blueslime", "graveyardsoil", "consecratedsoil"
};
public SoilSlabItem(Block b)
{
public SoilSlabItem(Block b) {
super(b, "block.soil.slab", blockTypes);
setMaxDamage(0);
setHasSubtypes(true);
@@ -21,16 +21,14 @@ public class SoilSlabItem extends MultiItemBlock
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 3:
list.add(StatCollector.translateToLocal("craftedsoil.slab1.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("craftedsoil.slab2.tooltip"));
break;
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage()) {
case 3:
list.add(StatCollector.translateToLocal("craftedsoil.slab1.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("craftedsoil.slab2.tooltip"));
break;
}
}
}
@@ -8,12 +8,10 @@ import net.minecraft.item.*;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class WoolSlab1Item extends MultiItemBlock
{
public class WoolSlab1Item extends MultiItemBlock {
Block block;
public WoolSlab1Item(Block b)
{
public WoolSlab1Item(Block b) {
super(b, "", "slab", ItemDye.field_150923_a);
this.setSpecialIndex(7, 15);
this.block = b;
@@ -22,25 +20,37 @@ public class WoolSlab1Item extends MultiItemBlock
}
@Override
public String getUnlocalizedName (ItemStack par1ItemStack)
{
public String getUnlocalizedName(ItemStack par1ItemStack) {
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 7);
return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[7 - i] + ".slab";
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ) {
Block b = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
int trueMeta = meta % 8;
boolean flag = (b) != null;
if ((side == 1 && flag || side == 0 && !flag) && b == this.block && trueMeta == stack.getItemDamage())
{
if (world.setBlock(x, y, z, Blocks.wool, trueMeta, 3))
{
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.block.stepSound.soundName, (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getPitch() * 0.8F);
if ((side == 1 && flag || side == 0 && !flag) && b == this.block && trueMeta == stack.getItemDamage()) {
if (world.setBlock(x, y, z, Blocks.wool, trueMeta, 3)) {
world.playSoundEffect(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
this.block.stepSound.soundName,
(this.block.stepSound.getVolume() + 1.0F) / 2.0F,
this.block.stepSound.getPitch() * 0.8F);
--stack.stackSize;
return true;
}
@@ -8,12 +8,10 @@ import net.minecraft.item.*;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class WoolSlab2Item extends MultiItemBlock
{
public class WoolSlab2Item extends MultiItemBlock {
Block block;
public WoolSlab2Item(Block b)
{
public WoolSlab2Item(Block b) {
super(b, "", "slab", ItemDye.field_150923_a);
this.setSpecialIndex(0, 7);
this.block = b;
@@ -22,31 +20,42 @@ public class WoolSlab2Item extends MultiItemBlock
}
@Override
public int getMetadata (int meta)
{
public int getMetadata(int meta) {
return meta;
}
@Override
public String getUnlocalizedName (ItemStack par1ItemStack)
{
public String getUnlocalizedName(ItemStack par1ItemStack) {
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 7, 15);
return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[15 - i] + ".slab";
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ) {
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
int trueMeta = meta % 8;
boolean flag = (block) != null;
if ((side == 1 && flag || side == 0 && !flag) && block == this.block && trueMeta == stack.getItemDamage())
{
if (world.setBlock(x, y, z, Blocks.wool, trueMeta + 8, 3))
{
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.block.stepSound.soundName, (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getPitch() * 0.8F);
if ((side == 1 && flag || side == 0 && !flag) && block == this.block && trueMeta == stack.getItemDamage()) {
if (world.setBlock(x, y, z, Blocks.wool, trueMeta + 8, 3)) {
world.playSoundEffect(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
this.block.stepSound.soundName,
(this.block.stepSound.getVolume() + 1.0F) / 2.0F,
this.block.stepSound.getPitch() * 0.8F);
--stack.stackSize;
return true;
}
@@ -10,18 +10,15 @@ import net.minecraft.potion.*;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class GoldenHead extends ItemFood
{
public GoldenHead(int par2, float par3, boolean par4)
{
public class GoldenHead extends ItemFood {
public GoldenHead(int par2, float par3, boolean par4) {
super(par2, par3, par4);
this.setHasSubtypes(true);
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect (ItemStack par1ItemStack)
{
public boolean hasEffect(ItemStack par1ItemStack) {
return par1ItemStack.getItemDamage() > 0;
}
@@ -30,25 +27,19 @@ public class GoldenHead extends ItemFood
/**
* Return an item rarity from EnumRarity
*/
public EnumRarity getRarity (ItemStack par1ItemStack)
{
public EnumRarity getRarity(ItemStack par1ItemStack) {
return par1ItemStack.getItemDamage() == 0 ? EnumRarity.rare : EnumRarity.epic;
}
@Override
protected void onFoodEaten (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par1ItemStack.getItemDamage() > 0)
{
if (!par2World.isRemote)
{
protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (par1ItemStack.getItemDamage() > 0) {
if (!par2World.isRemote) {
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 3));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
}
}
else
{
} else {
super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer);
}
}
@@ -58,22 +49,19 @@ public class GoldenHead extends ItemFood
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
public void getSubItems(Item b, CreativeTabs par2CreativeTabs, List par3List) {
par3List.add(new ItemStack(b, 1, 0));
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IIconRegister iconRegister)
{
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon("tinker:skull_char_gold");
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add("\u00a75\u00a7o" + StatCollector.translateToLocal("goldenhead1.tooltip"));
list.add("\u00a75\u00a7o" + StatCollector.translateToLocal("goldenhead2.tooltip"));
}
@@ -11,62 +11,55 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
public class OreBerries extends CraftingItem
{
static String[] names = new String[] { "iron", "gold", "copper", "tin", "aluminum", "essence" };
static String[] tex = new String[] { "oreberry_iron", "oreberry_gold", "oreberry_copper", "oreberry_tin", "oreberry_aluminum", "oreberry_essence" };
public class OreBerries extends CraftingItem {
static String[] names = new String[] {"iron", "gold", "copper", "tin", "aluminum", "essence"};
static String[] tex = new String[] {
"oreberry_iron", "oreberry_gold", "oreberry_copper", "oreberry_tin", "oreberry_aluminum", "oreberry_essence"
};
public OreBerries()
{
public OreBerries() {
super(names, tex, "oreberries/", "tinker", TConstructRegistry.materialTab);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 0:
list.add(StatCollector.translateToLocal("oreberries1.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberries2.tooltip"));
break;
case 2:
list.add(StatCollector.translateToLocal("oreberries3.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("oreberries4.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("oreberries5.tooltip"));
break;
case 5:
list.add(StatCollector.translateToLocal("oreberries6.tooltip"));
break;
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage()) {
case 0:
list.add(StatCollector.translateToLocal("oreberries1.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberries2.tooltip"));
break;
case 2:
list.add(StatCollector.translateToLocal("oreberries3.tooltip"));
break;
case 3:
list.add(StatCollector.translateToLocal("oreberries4.tooltip"));
break;
case 4:
list.add(StatCollector.translateToLocal("oreberries5.tooltip"));
break;
case 5:
list.add(StatCollector.translateToLocal("oreberries6.tooltip"));
break;
}
}
@Override
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
{
if (stack.getItemDamage() == 5)
{
EntityXPOrb entity = new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(14) + 6);
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (stack.getItemDamage() == 5) {
EntityXPOrb entity =
new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(14) + 6);
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
if (!player.capabilities.isCreativeMode) stack.stackSize--;
}
return stack;
}
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
{
if (!world.isRemote)
{
public static void spawnEntity(double x, double y, double z, Entity entity, World world, EntityPlayer player) {
if (!world.isRemote) {
world.spawnEntityInWorld(entity);
}
}
}
@@ -7,16 +7,14 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.*;
import net.minecraft.util.*;
public class SpecialFood extends ItemFood
{
public class SpecialFood extends ItemFood {
protected int[] hunger;
protected float[] saturation;
protected String[] unlocalizedNames;
protected String[] iconNames;
protected IIcon[] icons;
public SpecialFood(int[] hunger, float[] saturation, String[] textureNames, String[] iconNames)
{
public SpecialFood(int[] hunger, float[] saturation, String[] textureNames, String[] iconNames) {
super(0, 0, false);
this.hunger = hunger;
this.saturation = saturation;
@@ -25,49 +23,40 @@ public class SpecialFood extends ItemFood
}
@Override
public int func_150905_g (ItemStack stack)
{
public int func_150905_g(ItemStack stack) {
return hunger[stack.getItemDamage()];
}
@Override
public float func_150906_h (ItemStack stack)
{
public float func_150906_h(ItemStack stack) {
return saturation[stack.getItemDamage()];
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage (int meta)
{
if (meta >= icons.length)
return icons[0];
public IIcon getIconFromDamage(int meta) {
if (meta >= icons.length) return icons[0];
return icons[meta];
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IIconRegister iconRegister)
{
public void registerIcons(IIconRegister iconRegister) {
this.icons = new IIcon[iconNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
for (int i = 0; i < this.icons.length; ++i) {
this.icons[i] = iconRegister.registerIcon("tinker:" + iconNames[i]);
}
}
@Override
public String getUnlocalizedName (ItemStack stack)
{
public String getUnlocalizedName(ItemStack stack) {
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
return getUnlocalizedName() + "." + unlocalizedNames[arr];
}
@Override
public void getSubItems (Item b, CreativeTabs tab, List list)
{
for (int i = 0; i < unlocalizedNames.length; i++)
list.add(new ItemStack(b, 1, i));
public void getSubItems(Item b, CreativeTabs tab, List list) {
for (int i = 0; i < unlocalizedNames.length; i++) list.add(new ItemStack(b, 1, i));
}
}
@@ -8,39 +8,37 @@ import net.minecraft.potion.*;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class StrangeFood extends SpecialFood
{
public StrangeFood()
{
super(new int[] { 2, 2, 4 }, new float[] { 1f, 1f, 0.6f }, new String[] { "edibleslime", "edibleblood", "bacon" }, new String[] { "food/edibleslime", "food/edibleblood", "food/bacon" });
public class StrangeFood extends SpecialFood {
public StrangeFood() {
super(
new int[] {2, 2, 4},
new float[] {1f, 1f, 0.6f},
new String[] {"edibleslime", "edibleblood", "bacon"},
new String[] {"food/edibleslime", "food/edibleblood", "food/bacon"});
this.setHasSubtypes(true);
}
@Override
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
{
if (stack.getItemDamage() == 1)
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 20 * 15, 0));
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
if (stack.getItemDamage() == 1) player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 20 * 15, 0));
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
int type = stack.getItemDamage();
switch (type)
{
case 0:
list.add("\u00a7b\u00a7o" + StatCollector.translateToLocal("strangefood1.tooltip"));
list.add("\u00a7b\u00a7o" + StatCollector.translateToLocal("strangefood2.tooltip"));
break;
case 1:
list.add("\u00a74\u00a7o" + StatCollector.translateToLocal("strangefood3.tooltip"));
list.add("\u00a74\u00a7o" + StatCollector.translateToLocal("strangefood4.tooltip"));
break;
case 2:
list.add("\u00a7c" + StatCollector.translateToLocal("strangefood7.tooltip"));
break;
switch (type) {
case 0:
list.add("\u00a7b\u00a7o" + StatCollector.translateToLocal("strangefood1.tooltip"));
list.add("\u00a7b\u00a7o" + StatCollector.translateToLocal("strangefood2.tooltip"));
break;
case 1:
list.add("\u00a74\u00a7o" + StatCollector.translateToLocal("strangefood3.tooltip"));
list.add("\u00a74\u00a7o" + StatCollector.translateToLocal("strangefood4.tooltip"));
break;
case 2:
list.add("\u00a7c" + StatCollector.translateToLocal("strangefood7.tooltip"));
break;
}
}
}
@@ -6,119 +6,100 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.util.ItemHelper;
public class BarricadeRender implements ISimpleBlockRenderingHandler
{
public class BarricadeRender implements ISimpleBlockRenderingHandler {
public static int model;
public BarricadeRender()
{
public BarricadeRender() {
model = RenderingRegistry.getNextAvailableRenderId();
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block barricade, int modelId, RenderBlocks renderer)
{
if (modelId == model)
{
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block barricade, int modelId, RenderBlocks renderer) {
if (modelId == model) {
int meta = world.getBlockMetadata(x, y, z);
int type = meta % 4;
if (meta / 4 == 0)
{
if (meta / 4 == 0) {
// if (type >= 0)
// TODO setRenderBounds
renderer.setRenderBounds(0.125, 0.0, 0.5, 0.375, 1.0, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
if (type >= 1) {
renderer.setRenderBounds(0.625, 0.0, 0.5, 0.875, 1.0, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
if (type >= 2) {
renderer.setRenderBounds(0.0, 0.125, 0.25, 1.0, 0.375, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
if (type >= 3) {
renderer.setRenderBounds(0.0, 0.625, 0.25, 1.0, 0.875, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
if (meta / 4 == 1)
{
if (meta / 4 == 1) {
// if (type >= 0)
renderer.setRenderBounds(0.25, 0.0, 0.125, 0.5, 1.0, 0.375);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
if (type >= 1) {
renderer.setRenderBounds(0.25, 0.0, 0.625, 0.5, 1.0, 0.875);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
if (type >= 2) {
renderer.setRenderBounds(0.5, 0.125, 0.0, 0.75, 0.375, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
if (type >= 3) {
renderer.setRenderBounds(0.5, 0.625, 0.0, 0.75, 0.875, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
if (meta / 4 == 2)
{
if (meta / 4 == 2) {
// if (type >= 0)
renderer.setRenderBounds(0.125, 0.0, 0.25, 0.375, 1.0, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
if (type >= 1) {
renderer.setRenderBounds(0.625, 0.0, 0.25, 0.875, 1.0, 0.5);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
if (type >= 2) {
renderer.setRenderBounds(0.0, 0.125, 0.5, 1.0, 0.375, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
if (type >= 3) {
renderer.setRenderBounds(0.0, 0.625, 0.5, 1.0, 0.875, 0.75);
renderer.renderStandardBlock(barricade, x, y, z);
}
}
if (meta / 4 == 3)
{
if (meta / 4 == 3) {
// if (type >= 0)
renderer.setRenderBounds(0.5, 0.0, 0.125, 0.75, 1.0, 0.375);
renderer.renderStandardBlock(barricade, x, y, z);
if (type >= 1)
{
if (type >= 1) {
renderer.setRenderBounds(0.5, 0.0, 0.625, 0.75, 1.0, 0.875);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 2)
{
if (type >= 2) {
renderer.setRenderBounds(0.25, 0.125, 0.0, 0.5, 0.375, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
if (type >= 3)
{
if (type >= 3) {
renderer.setRenderBounds(0.25, 0.625, 0.0, 0.5, 0.875, 1.0);
renderer.renderStandardBlock(barricade, x, y, z);
}
@@ -130,10 +111,8 @@ public class BarricadeRender implements ISimpleBlockRenderingHandler
}
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if (modelID == model) {
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
@@ -142,15 +121,12 @@ public class BarricadeRender implements ISimpleBlockRenderingHandler
}
@Override
public boolean shouldRender3DInInventory (int modelId)
{
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId ()
{
public int getRenderId() {
return model;
}
}
@@ -2,13 +2,12 @@ package tconstruct.world.model;
import net.minecraft.client.model.ModelBase;
public class CrystalModelSmall extends ModelBase
{
public class CrystalModelSmall extends ModelBase {
/*
* ModelRenderer body; ModelRendererTurbo top; ModelRendererTurbo bottom;
*
*
* public CrystalModelSmall() { textureWidth = 32; textureHeight = 32;
*
*
* body = new ModelRenderer(this, 0, 8); body.addBox(-2F, 0F, -2F, 4, 6, 4);
* body.setRotationPoint(0F, 0F, 0F); setRotation(body, 0, 0.7853982F, 0);
* top = new ModelRendererTurbo(this, 0, 0, 32, 32); top.addCone(0, 0, 0,
@@ -17,16 +16,16 @@ public class CrystalModelSmall extends ModelBase
* new ModelRendererTurbo(this, 0, 18, 32, 32); top.addCone(0, 10, 0, 2.8F,
* 4, 4, 0, ModelRendererTurbo.MR_TOP, 4, 8); bottom.setRotationPoint(0F,
* 6F, 0F); //setRotation(bottom, 0F, 0F, 0F); }
*
*
* public void render (Entity entity, float f, float f1, float f2, float f3,
* float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5);
* setRotationAngles(f, f1, f2, f3, f4, f5, entity); body.render(f5);
* top.render(f5); bottom.render(f5); }
*
*
* private void setRotation (ModelRenderer model, float x, float y, float z)
* { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z;
* }
*
*
* public void setRotationAngles (float f, float f1, float f2, float f3,
* float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2,
* f3, f4, f5, entity); }
@@ -8,27 +8,23 @@ import net.minecraft.util.ResourceLocation;
import tconstruct.world.entity.Crystal;
@SideOnly(Side.CLIENT)
public class CrystalRender extends RenderLiving
{
public class CrystalRender extends RenderLiving {
/** The creeper model. */
private ModelBase creeperModel = new CrystalModelSmall();
public CrystalRender()
{
public CrystalRender() {
super(new CrystalModelSmall(), 0.5F);
}
/**
* A method used to render a creeper's powered form as a pass model.
*/
protected int renderCreeperPassModel (Crystal par1EntityCreeper, int par2, float par3)
{
protected int renderCreeperPassModel(Crystal par1EntityCreeper, int par2, float par3) {
return -1;
}
protected int func_77061_b (Crystal par1EntityCreeper, int par2, float par3)
{
protected int func_77061_b(Crystal par1EntityCreeper, int par2, float par3) {
return -1;
}
@@ -45,27 +41,23 @@ public class CrystalRender extends RenderLiving
* Returns an ARGB int color back. Args: entityLiving, lightBrightness,
* partialTickTime
*/
protected int getColorMultiplier (EntityLiving par1EntityLiving, float par2, float par3)
{
protected int getColorMultiplier(EntityLiving par1EntityLiving, float par2, float par3) {
return super.getColorMultiplier(par1EntityLiving, par2, par3);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3) {
return this.renderCreeperPassModel((Crystal) par1EntityLiving, par2, par3);
}
protected int inheritRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
{
protected int inheritRenderPass(EntityLiving par1EntityLiving, int par2, float par3) {
return this.func_77061_b((Crystal) par1EntityLiving, par2, par3);
}
@Override
protected ResourceLocation getEntityTexture (Entity par1Entity)
{
protected ResourceLocation getEntityTexture(Entity par1Entity) {
return texture;
}
@@ -6,29 +6,22 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import tconstruct.util.ItemHelper;
public class OreberryRender implements ISimpleBlockRenderingHandler
{
public class OreberryRender implements ISimpleBlockRenderingHandler {
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
if (modelId == model)
{
if (modelId == model) {
int md = world.getBlockMetadata(x, y, z);
if (md < 4)
{
if (md < 4) {
renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (md < 8)
{
} else if (md < 8) {
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
}
else
{
} else {
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -38,24 +31,20 @@ public class OreberryRender implements ISimpleBlockRenderingHandler
}
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if (modelID == model) {
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
public boolean shouldRender3DInInventory(int modelID) {
return true;
}
@Override
public int getRenderId ()
{
public int getRenderId() {
return model;
}
}
@@ -6,45 +6,37 @@ import net.minecraft.client.renderer.*;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
public class PunjiRender implements ISimpleBlockRenderingHandler
{
public class PunjiRender implements ISimpleBlockRenderingHandler {
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if (modelID == model) {
renderer.setRenderBounds(0.4375, 0.0, 0.4375, 0.5625, 1.0f, 0.5625);
renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
if (modelID == model) {
int metadata = world.getBlockMetadata(x, y, z);
renderer.setRenderBounds(0.4375, 0.0, 0.4375, 0.5625, 0.375f, 0.5625);
renderer.renderStandardBlock(block, x, y, z);
if (metadata >= 1)
{
if (metadata >= 1) {
renderer.setRenderBounds(0.125, 0.0, 0.125, 0.25, 0.375f, 0.25);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata >= 2)
{
if (metadata >= 2) {
renderer.setRenderBounds(0.75, 0.0, 0.75, 0.875, 0.375f, 0.875);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata >= 3)
{
if (metadata >= 3) {
renderer.setRenderBounds(0.125, 0.0, 0.75, 0.25, 0.375f, 0.875);
renderer.renderStandardBlock(block, x, y, z);
}
if (metadata >= 4)
{
if (metadata >= 4) {
renderer.setRenderBounds(0.75, 0.0, 0.125, 0.875, 0.375f, 0.25);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -68,19 +60,16 @@ public class PunjiRender implements ISimpleBlockRenderingHandler
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
public boolean shouldRender3DInInventory(int modelID) {
return true;
}
@Override
public int getRenderId ()
{
public int getRenderId() {
return model;
}
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
@@ -9,18 +9,16 @@ import org.lwjgl.opengl.GL11;
import tconstruct.mechworks.landmine.Helper;
/**
*
*
* @author fuj1n
*
*
*/
public class RenderLandmine implements ISimpleBlockRenderingHandler
{
public class RenderLandmine implements ISimpleBlockRenderingHandler {
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, 0F, -0.5F);
@@ -31,22 +29,19 @@ public class RenderLandmine implements ISimpleBlockRenderingHandler
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == getRenderId())
{
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
if (modelId == getRenderId()) {
renderBasedOnSide(world, x, y, z, block, modelId, renderer);
return true;
}
else
{
} else {
return false;
}
}
@SuppressWarnings("incomplete-switch")
public void renderBasedOnSide (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
public void renderBasedOnSide(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int l = world.getBlockMetadata(x, y, z);
int i1 = l & 7;
boolean flag = (l & 8) > 0;
@@ -55,41 +50,37 @@ public class RenderLandmine implements ISimpleBlockRenderingHandler
// TConstruct.logger.info(i1 + " for " + dir);
switch (dir)
{
case DOWN:
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
break;
case UP:
renderer.setRenderBounds(0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F, 1.0F - 0.0625F);
break;
case NORTH:
renderer.setRenderBounds(0.0625F, 0.0625F, 0.0F, 1.0F - 0.0625F, 1.0F - 0.0625F, 0.0625F);
break;
case SOUTH:
renderer.setRenderBounds(0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F);
break;
case EAST:
renderer.setRenderBounds(1.0F - 0.0625F, 0.0625F, 0.0625F, 1.0F, 1.0F - 0.0625F, 1.0F - 0.0625F);
break;
case WEST:
renderer.setRenderBounds(0.0F, 0.0625F, 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F);
break;
switch (dir) {
case DOWN:
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
break;
case UP:
renderer.setRenderBounds(0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F, 1.0F - 0.0625F);
break;
case NORTH:
renderer.setRenderBounds(0.0625F, 0.0625F, 0.0F, 1.0F - 0.0625F, 1.0F - 0.0625F, 0.0625F);
break;
case SOUTH:
renderer.setRenderBounds(0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F, 1.0F);
break;
case EAST:
renderer.setRenderBounds(1.0F - 0.0625F, 0.0625F, 0.0625F, 1.0F, 1.0F - 0.0625F, 1.0F - 0.0625F);
break;
case WEST:
renderer.setRenderBounds(0.0F, 0.0625F, 0.0625F, 0.0625F, 1.0F - 0.0625F, 1.0F - 0.0625F);
break;
}
renderer.renderStandardBlock(block, x, y, z);
}
@Override
public int getRenderId ()
{
public int getRenderId() {
return model;
}
@Override
public boolean shouldRender3DInInventory (int modelId)
{
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -7,24 +7,20 @@ import net.minecraft.util.*;
import net.minecraft.world.IBlockAccess;
import tconstruct.util.ItemHelper;
public class SlimeChannelRender implements ISimpleBlockRenderingHandler
{
public class SlimeChannelRender implements ISimpleBlockRenderingHandler {
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if (modelID == model) {
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
if (modelID == model) {
renderRotatedBlock(block, x, y, z, world, renderer);
return true;
}
@@ -36,10 +32,8 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
static final float LIGHT_XZ_NEG = 0.8F;
static final float LIGHT_XZ_POS = 0.6F;
public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer)
{
if (true)
{
public boolean renderRotatedBlock(Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer) {
if (true) {
Tessellator tessellator = Tessellator.instance;
int bMeta = world.getBlockMetadata(x, y, z);
IIcon iconStill = block.getIcon(1, bMeta);
@@ -47,8 +41,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
double u1, u2, u3, u4, v1, v2, v3, v4;
if (flowDir < -999.0F)
{
if (flowDir < -999.0F) {
u2 = iconStill.getInterpolatedU(0.0D);
v2 = iconStill.getInterpolatedV(0.0D);
u1 = u2;
@@ -57,9 +50,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
v4 = v1;
u3 = u4;
v3 = v2;
}
else
{
} else {
float xFlow = MathHelper.sin(flowDir) * 0.25F;
float zFlow = MathHelper.cos(flowDir) * 0.25F;
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
@@ -89,7 +80,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
* 0) renderer.uvRotateTop = 2; if (direction == 1) renderer.uvRotateTop
* = 1; if (direction == 2) renderer.uvRotateTop = 0; if (direction ==
* 3) renderer.uvRotateTop = 3;
*
*
* boolean flag = renderer.renderStandardBlock(block, x, y, z);
* renderer.uvRotateTop = 0; return flag;
*/
@@ -97,14 +88,12 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
public boolean shouldRender3DInInventory(int modelID) {
return true;
}
@Override
public int getRenderId ()
{
public int getRenderId() {
return model;
}
}
@@ -5,8 +5,7 @@ import net.minecraft.client.model.*;
import net.minecraft.entity.Entity;
@SideOnly(Side.CLIENT)
public class SlimeModel extends ModelBase
{
public class SlimeModel extends ModelBase {
/** The slime's bodies, both the inside box and the outside box */
ModelRenderer slimeBodies;
@@ -19,13 +18,11 @@ public class SlimeModel extends ModelBase
/** The slime's mouth */
ModelRenderer slimeMouth;
public SlimeModel(int par1)
{
public SlimeModel(int par1) {
this.slimeBodies = new ModelRenderer(this, 0, par1);
this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8);
if (par1 > 0)
{
if (par1 > 0) {
this.slimeBodies = new ModelRenderer(this, 0, par1);
this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6);
this.slimeRightEye = new ModelRenderer(this, 32, 0);
@@ -41,13 +38,11 @@ public class SlimeModel extends ModelBase
* Sets the models various rotation angles then renders the model.
*/
@Override
public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
this.slimeBodies.render(par7);
if (this.slimeRightEye != null)
{
if (this.slimeRightEye != null) {
this.slimeRightEye.render(par7);
this.slimeLeftEye.render(par7);
this.slimeMouth.render(par7);
@@ -9,15 +9,12 @@ import tconstruct.util.ItemHelper;
import tconstruct.world.TinkerWorld;
import tconstruct.world.blocks.SlimePad;
public class SlimePadRender implements ISimpleBlockRenderingHandler
{
public class SlimePadRender implements ISimpleBlockRenderingHandler {
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if (modelID == model) {
ItemHelper.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, metadata);
renderer.setRenderBounds(0f, 0.0625f, 0f, 1f, 0.5f, 1f);
ItemHelper.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, 1);
@@ -25,59 +22,68 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
if (modelID == model) {
renderer.setRenderBounds(0f, 0, 0f, 1f, 0.5f, 1f);
int metadata = world.getBlockMetadata(x, y, z);
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getFluidIcon(metadata), ((SlimePad) block).getFluidIcon(metadata), x, y, z, renderer, world);
BlockSkinRenderHelper.renderLiquidBlock(
((SlimePad) block).getFluidIcon(metadata),
((SlimePad) block).getFluidIcon(metadata),
x,
y,
z,
renderer,
world);
renderer.setRenderBounds(0.125f,0.0625f,0.125f, 0.875f,0.625f,0.875f);
renderer.setRenderBounds(0.125f, 0.0625f, 0.125f, 0.875f, 0.625f, 0.875f);
renderer.renderStandardBlock(block, x, y, z);
float[] size = size(metadata % 8);
renderer.setRenderBounds(size[0], 0.5f, size[1], size[2], 0.6875f, size[3]);
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getNubIcon(metadata), ((SlimePad) block).getNubIcon(metadata), x, y, z, renderer, world);
BlockSkinRenderHelper.renderLiquidBlock(
((SlimePad) block).getNubIcon(metadata),
((SlimePad) block).getNubIcon(metadata),
x,
y,
z,
renderer,
world);
return true;
}
return false;
}
float[] size (int meta)
{
float[] size(int meta) {
// xMin, zMin, xMax, zMax
switch (meta)
{
case 0:
return new float[] { 0.375f, 0.6875f, 0.625f, 0.9375f };
case 1:
return new float[] { 0.0625f, 0.6875f, 0.3125f, 0.9375f };
case 2:
return new float[] { 0.0625f, 0.375f, 0.3125f, 0.625f };
case 3:
return new float[] { 0.0625f, 0.0625f, 0.3125f, 0.3125f };
case 4:
return new float[] { 0.375f, 0.0625f, 0.625f, 0.3125f };
case 5:
return new float[] { 0.6875f, 0.0625f, 0.9375f, 0.3125f };
case 6:
return new float[] { 0.6875f, 0.375f, 0.9375f, 0.625f };
case 7:
return new float[] { 0.6875f, 0.6875f, 0.9375f, 0.9375f };
switch (meta) {
case 0:
return new float[] {0.375f, 0.6875f, 0.625f, 0.9375f};
case 1:
return new float[] {0.0625f, 0.6875f, 0.3125f, 0.9375f};
case 2:
return new float[] {0.0625f, 0.375f, 0.3125f, 0.625f};
case 3:
return new float[] {0.0625f, 0.0625f, 0.3125f, 0.3125f};
case 4:
return new float[] {0.375f, 0.0625f, 0.625f, 0.3125f};
case 5:
return new float[] {0.6875f, 0.0625f, 0.9375f, 0.3125f};
case 6:
return new float[] {0.6875f, 0.375f, 0.9375f, 0.625f};
case 7:
return new float[] {0.6875f, 0.6875f, 0.9375f, 0.9375f};
}
return new float[] { 0.375f, 0.375f, 0.625f, 0.625f };
return new float[] {0.375f, 0.375f, 0.625f, 0.625f};
}
@Override
public boolean shouldRender3DInInventory (int modelID)
{
public boolean shouldRender3DInInventory(int modelID) {
return true;
}
@Override
public int getRenderId ()
{
public int getRenderId() {
return model;
}
}
@@ -11,46 +11,35 @@ import tconstruct.world.entity.KingBlueSlime;
import tconstruct.world.entity.SlimeBase;
@SideOnly(Side.CLIENT)
public class SlimeRender extends RenderLiving
{
public class SlimeRender extends RenderLiving {
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
private ModelBase scaleAmount;
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3) {
super(par1ModelBase, par3);
this.scaleAmount = par2ModelBase;
}
@Override
public void doRender (EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) {
super.doRender(par1EntityLiving, par2, par4, par6, par8, par9);
if(par1EntityLiving instanceof KingBlueSlime)
BossStatus.setBossStatus((KingBlueSlime) par1EntityLiving, true);
if (par1EntityLiving instanceof KingBlueSlime) BossStatus.setBossStatus((KingBlueSlime) par1EntityLiving, true);
}
/**
* Determines whether Slime Render should pass or not.
*/
protected int shouldSlimeRenderPass (SlimeBase slime, int par2, float par3)
{
if (slime.isInvisible())
{
protected int shouldSlimeRenderPass(SlimeBase slime, int par2, float par3) {
if (slime.isInvisible()) {
return 0;
}
else if (par2 == 0)
{
} else if (par2 == 0) {
this.setRenderPassModel(this.scaleAmount);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
else
{
if (par2 == 1)
{
} else {
if (par2 == 1) {
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
@@ -62,10 +51,10 @@ public class SlimeRender extends RenderLiving
/**
* sets the scale for the slime based on getSlimeSize in EdibleSlime
*/
protected void scaleSlime (SlimeBase par1EdibleSlime, float par2)
{
protected void scaleSlime(SlimeBase par1EdibleSlime, float par2) {
float f1 = (float) par1EdibleSlime.getSlimeSize();
float f2 = (par1EdibleSlime.sizeHeight + (par1EdibleSlime.sizeFactor - par1EdibleSlime.sizeHeight) * par2) / (f1 * 0.5F + 1.0F);
float f2 = (par1EdibleSlime.sizeHeight + (par1EdibleSlime.sizeFactor - par1EdibleSlime.sizeHeight) * par2)
/ (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
}
@@ -75,8 +64,7 @@ public class SlimeRender extends RenderLiving
* the model is rendered. Args: entityLiving, partialTickTime
*/
@Override
protected void preRenderCallback (EntityLivingBase par1EntityLiving, float par2)
{
protected void preRenderCallback(EntityLivingBase par1EntityLiving, float par2) {
this.scaleSlime((SlimeBase) par1EntityLiving, par2);
}
@@ -84,14 +72,12 @@ public class SlimeRender extends RenderLiving
* Queries whether should render the specified pass or not.
*/
@Override
protected int shouldRenderPass (EntityLivingBase par1EntityLiving, int par2, float par3)
{
protected int shouldRenderPass(EntityLivingBase par1EntityLiving, int par2, float par3) {
return this.shouldSlimeRenderPass((SlimeBase) par1EntityLiving, par2, par3);
}
@Override
protected ResourceLocation getEntityTexture (Entity par1Entity)
{
protected ResourceLocation getEntityTexture(Entity par1Entity) {
return texture;
}
}
@@ -8,25 +8,26 @@ import net.minecraft.world.gen.structure.*;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import tconstruct.smeltery.TinkerSmeltery;
public class ComponentSmeltery extends StructureVillagePieces.House1
{
public class ComponentSmeltery extends StructureVillagePieces.House1 {
private int averageGroundLevel = -1;
public ComponentSmeltery()
{
}
public ComponentSmeltery() {}
public ComponentSmeltery(Start villagePiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
public ComponentSmeltery(
Start villagePiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) {
super();
this.coordBaseMode = par5;
this.boundingBox = par4StructureBoundingBox;
}
public static ComponentSmeltery buildComponent (Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 9, 3, 7, p4);
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentSmeltery(villagePiece, p5, random, structureboundingbox, p4) : null;
public static ComponentSmeltery buildComponent(
Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) {
StructureBoundingBox structureboundingbox =
StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 9, 3, 7, p4);
return canVillageGoDeeper(structureboundingbox)
&& StructureComponent.findIntersecting(pieces, structureboundingbox) == null
? new ComponentSmeltery(villagePiece, p5, random, structureboundingbox, p4)
: null;
}
/**
@@ -34,14 +35,11 @@ public class ComponentSmeltery extends StructureVillagePieces.House1
* Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts (World world, Random random, StructureBoundingBox sbb)
{
if (this.averageGroundLevel < 0)
{
public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb) {
if (this.averageGroundLevel < 0) {
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if (this.averageGroundLevel < 0)
{
if (this.averageGroundLevel < 0) {
return true;
}
@@ -52,13 +50,13 @@ public class ComponentSmeltery extends StructureVillagePieces.House1
* arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
* maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace)
*/
this.fillWithBlocks(world, sbb, 1, 0, 0, 7, 0, 6, Blocks.stonebrick, Blocks.stonebrick, false); //Base
this.fillWithBlocks(world, sbb, 1, 0, 0, 7, 0, 6, Blocks.stonebrick, Blocks.stonebrick, false); // Base
this.fillWithBlocks(world, sbb, 0, 0, 1, 0, 0, 5, Blocks.stonebrick, Blocks.stonebrick, false);
this.fillWithBlocks(world, sbb, 8, 0, 1, 8, 0, 5, Blocks.stonebrick, Blocks.stonebrick, false);
this.fillWithBlocks(world, sbb, 0, 1, 0, 9, 3, 7, Blocks.air, Blocks.air, false);
this.fillWithMetaBlocks(world, sbb, 2, 0, 1, 6, 2, 5, TinkerSmeltery.smeltery, 2, TinkerSmeltery.smeltery, 2, false); //Basin
this.fillWithMetaBlocks(
world, sbb, 2, 0, 1, 6, 2, 5, TinkerSmeltery.smeltery, 2, TinkerSmeltery.smeltery, 2, false); // Basin
this.fillWithBlocks(world, sbb, 3, 1, 2, 5, 2, 4, Blocks.air, Blocks.air, false);
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 0, 1, 1, 2, sbb);
@@ -66,19 +64,15 @@ public class ComponentSmeltery extends StructureVillagePieces.House1
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 0, 7, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, TinkerSmeltery.searedBlock, 2, 7, 1, 4, sbb);
for (int l = 1; l < 6; ++l)
{
for (int i1 = 0; i1 < 9; ++i1)
{
for (int l = 1; l < 6; ++l) {
for (int i1 = 0; i1 < 9; ++i1) {
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.func_151554_b(world, Blocks.stonebrick, 0, i1, -1, l, sbb);
}
}
for (int l = 0; l < 7; ++l)
{
for (int i1 = 1; i1 < 8; ++i1)
{
for (int l = 0; l < 7; ++l) {
for (int i1 = 1; i1 < 8; ++i1) {
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.func_151554_b(world, Blocks.stonebrick, 0, i1, -1, l, sbb);
}
@@ -86,12 +80,25 @@ public class ComponentSmeltery extends StructureVillagePieces.House1
return true;
}
protected void fillWithMetaBlocks (World par1World, StructureBoundingBox par2StructureBoundingBox, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block placeBlockID, int placeBlockMeta, Block replaceBlockID, int replaceBlockMeta, boolean alwaysReplace)
{
protected void fillWithMetaBlocks(
World par1World,
StructureBoundingBox par2StructureBoundingBox,
int minX,
int minY,
int minZ,
int maxX,
int maxY,
int maxZ,
Block placeBlockID,
int placeBlockMeta,
Block replaceBlockID,
int replaceBlockMeta,
boolean alwaysReplace) {
Block i2 = this.func_151558_b(placeBlockID, placeBlockMeta);
int j2 = this.func_151557_c(placeBlockID, placeBlockMeta);
Block k2 = this.func_151558_b(replaceBlockID, replaceBlockMeta);
int l2 = this.func_151557_c(replaceBlockID, replaceBlockMeta);
super.fillWithMetadataBlocks(par1World, par2StructureBoundingBox, minX, minY, minZ, maxX, maxY, maxZ, i2, j2, k2, l2, alwaysReplace);
super.fillWithMetadataBlocks(
par1World, par2StructureBoundingBox, minX, minY, minZ, maxX, maxY, maxZ, i2, j2, k2, l2, alwaysReplace);
}
}
@@ -10,25 +10,26 @@ import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.*;
import tconstruct.world.TinkerWorld;
public class ComponentToolWorkshop extends StructureVillagePieces.House1
{
public class ComponentToolWorkshop extends StructureVillagePieces.House1 {
private int averageGroundLevel = -1;
public ComponentToolWorkshop()
{
}
public ComponentToolWorkshop() {}
public ComponentToolWorkshop(Start villagePiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
public ComponentToolWorkshop(
Start villagePiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) {
super();
this.coordBaseMode = par5;
this.boundingBox = par4StructureBoundingBox;
}
public static ComponentToolWorkshop buildComponent (Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 7, 6, 7, p4);
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentToolWorkshop(villagePiece, p5, random, structureboundingbox, p4) : null;
public static ComponentToolWorkshop buildComponent(
Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) {
StructureBoundingBox structureboundingbox =
StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 7, 6, 7, p4);
return canVillageGoDeeper(structureboundingbox)
&& StructureComponent.findIntersecting(pieces, structureboundingbox) == null
? new ComponentToolWorkshop(villagePiece, p5, random, structureboundingbox, p4)
: null;
}
/**
@@ -36,14 +37,11 @@ public class ComponentToolWorkshop extends StructureVillagePieces.House1
* Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts (World world, Random random, StructureBoundingBox sbb)
{
if (this.averageGroundLevel < 0)
{
public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb) {
if (this.averageGroundLevel < 0) {
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if (this.averageGroundLevel < 0)
{
if (this.averageGroundLevel < 0) {
return true;
}
@@ -55,7 +53,6 @@ public class ComponentToolWorkshop extends StructureVillagePieces.House1
* int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId,
* int replaceBlockId, boolean alwaysreplace)
*/
this.fillWithBlocks(world, sbb, 0, 0, 0, 6, 0, 6, Blocks.cobblestone, Blocks.cobblestone, false); // Base
this.fillWithBlocks(world, sbb, 0, 5, 0, 6, 5, 6, Blocks.fence, Blocks.fence, false);
this.fillWithBlocks(world, sbb, 1, 0, 1, 5, 0, 5, Blocks.planks, Blocks.planks, false);
@@ -88,7 +85,7 @@ public class ComponentToolWorkshop extends StructureVillagePieces.House1
this.fillWithBlocks(world, sbb, 1, 4, 1, 5, 4, 5, Blocks.planks, Blocks.planks, false);
// world, blockID, metadata, x, y, z, bounds
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 1, 2, 0, sbb);// Glass and door
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 1, 2, 0, sbb); // Glass and door
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 2, 2, 0, sbb);
this.placeDoorAtCurrentPosition(world, sbb, random, 3, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1));
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 4, 2, 0, sbb);
@@ -119,27 +116,49 @@ public class ComponentToolWorkshop extends StructureVillagePieces.House1
this.placeBlockAtCurrentPosition(world, Blocks.ladder, i, 3, 4, 5, sbb);
this.placeBlockAtCurrentPosition(world, TinkerTools.toolStationWood, 0, 1, 1, 1, sbb); // Inside
this.generateStructurePatternChestContents(world, sbb, random, 1, 1, 2, TinkerWorld.tinkerHousePatterns.getItems(random), TinkerWorld.tinkerHousePatterns.getCount(random));
this.generateStructurePatternChestContents(
world,
sbb,
random,
1,
1,
2,
TinkerWorld.tinkerHousePatterns.getItems(random),
TinkerWorld.tinkerHousePatterns.getCount(random));
// this.placeBlockAtCurrentPosition(world, TRepo.toolStationWood, 5, 1,
// 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, TinkerTools.toolStationWood, 1, 1, 1, 3, sbb);
this.generateStructureCraftingStationContents(world, sbb, random, 1, 1, 4, TinkerWorld.tinkerHouseChest.getItems(random), TinkerWorld.tinkerHouseChest.getCount(random));
this.generateStructureCraftingStationContents(
world,
sbb,
random,
1,
1,
4,
TinkerWorld.tinkerHouseChest.getItems(random),
TinkerWorld.tinkerHouseChest.getCount(random));
// this.placeBlockAtCurrentPosition(world, TRepo.craftingStationWood, 0,
// 1, 1, 4, sbb);
this.placeBlockAtCurrentPosition(world, TinkerTools.toolStationWood, 10, 1, 1, 5, sbb);
// ChestGenHooks info = ChestGenHooks.getInfo("TinkerHouse");
this.generateStructureChestContents(world, sbb, random, 4, 1, 5, TinkerWorld.tinkerHouseChest.getItems(random), TinkerWorld.tinkerHouseChest.getCount(random));
this.generateStructureChestContents(
world,
sbb,
random,
4,
1,
5,
TinkerWorld.tinkerHouseChest.getItems(random),
TinkerWorld.tinkerHouseChest.getCount(random));
// this.placeBlockAtCurrentPosition(world, Block.chest, i, 4, 1, 5,
// sbb);
i = this.getMetadataWithOffset(Blocks.piston, 3);
this.placeBlockAtCurrentPosition(world, Blocks.piston, i, 5, 1, 5, sbb);
for (int l = 0; l < 7; ++l)
{
for (int i1 = 0; i1 < 7; ++i1)
{
for (int l = 0; l < 7; ++l) {
for (int i1 = 0; i1 < 7; ++i1) {
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
@@ -149,50 +168,58 @@ public class ComponentToolWorkshop extends StructureVillagePieces.House1
return true;
}
protected boolean generateStructureCraftingStationContents (World world, StructureBoundingBox par2StructureBoundingBox, Random random, int x, int y, int z, WeightedRandomChestContent[] content, int par8)
{
protected boolean generateStructureCraftingStationContents(
World world,
StructureBoundingBox par2StructureBoundingBox,
Random random,
int x,
int y,
int z,
WeightedRandomChestContent[] content,
int par8) {
int posX = this.getXWithOffset(x, z);
int posY = this.getYWithOffset(y);
int posZ = this.getZWithOffset(x, z);
if (par2StructureBoundingBox.isVecInside(posX, posY, posZ) && world.getBlock(posX, posY, posZ) != Blocks.chest)
{
if (par2StructureBoundingBox.isVecInside(posX, posY, posZ)
&& world.getBlock(posX, posY, posZ) != Blocks.chest) {
world.setBlock(posX, posY, posZ, TinkerTools.craftingStationWood, 5, 2);
CraftingStationLogic logic = (CraftingStationLogic) world.getTileEntity(posX, posY, posZ);
if (logic != null)
{
if (logic != null) {
WeightedRandomChestContent.generateChestContents(random, content, logic, par8);
}
return true;
}
else
{
} else {
return false;
}
}
protected boolean generateStructurePatternChestContents (World world, StructureBoundingBox par2StructureBoundingBox, Random random, int x, int y, int z, WeightedRandomChestContent[] content, int par8)
{
protected boolean generateStructurePatternChestContents(
World world,
StructureBoundingBox par2StructureBoundingBox,
Random random,
int x,
int y,
int z,
WeightedRandomChestContent[] content,
int par8) {
int posX = this.getXWithOffset(x, z);
int posY = this.getYWithOffset(y);
int posZ = this.getZWithOffset(x, z);
if (par2StructureBoundingBox.isVecInside(posX, posY, posZ) && world.getBlock(posX, posY, posZ) != Blocks.chest)
{
if (par2StructureBoundingBox.isVecInside(posX, posY, posZ)
&& world.getBlock(posX, posY, posZ) != Blocks.chest) {
world.setBlock(posX, posY, posZ, TinkerTools.toolStationWood, 5, 2);
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(posX, posY, posZ);
if (logic != null)
{
if (logic != null) {
WeightedRandomChestContent.generateChestContents(random, content, logic, par8);
}
return true;
}
else
{
} else {
return false;
}
}
@@ -202,8 +229,7 @@ public class ComponentToolWorkshop extends StructureVillagePieces.House1
* of villagers already spawned.
*/
@Override
protected int getVillagerType (int par1)
{
protected int getVillagerType(int par1) {
return 78943;
}
}
@@ -10,15 +10,13 @@ import tconstruct.mechworks.TinkerMechworks;
import tconstruct.tools.TinkerTools;
import tconstruct.world.TinkerWorld;
public class TVillageTrades implements IVillageTradeHandler
{
public class TVillageTrades implements IVillageTradeHandler {
private final List<ItemStack> allowedIngredients = new ArrayList<ItemStack>();
private final int max = 17;
private final int min = 7;
public TVillageTrades()
{
public TVillageTrades() {
super();
// vanilla blocks
@@ -35,40 +33,32 @@ public class TVillageTrades implements IVillageTradeHandler
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 1));
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 5));
allowedIngredients.add(new ItemStack(TinkerTools.toolStationWood, 3, 10));
for (int sc = 0; sc < 4; sc++)
{
for (int sc = 0; sc < 4; sc++) {
allowedIngredients.add(new ItemStack(TinkerMechworks.landmine, 64, sc));
}
}
@Override
public void manipulateTradesForVillager (EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
if (villager.getProfession() == 78943)
{
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
if (villager.getProfession() == 78943) {
ItemStack ingredient;
ItemStack ingredient2;
ItemStack result;
for (int sc = 8; sc < 12; sc++)
{
for (int sc = 8; sc < 12; sc++) {
int num = getNextInt(random, min, max);
ingredient = getIngredient(random, num);
if (ingredient.stackSize < 13)
{
if (ingredient.stackSize < 13) {
ingredient2 = getIngredient(random, ingredient);
}
else
{
} else {
ingredient2 = null;
}
result = new ItemStack(TinkerWorld.oreBerry, calcStackSize(ingredient, ingredient2), sc);
// adds iron, gold, copper & tin orebushes to the recipe list
recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
if (sc == 8)
{
if (sc == 8) {
// adds alumine orebush to the recipe list
result = new ItemStack(TinkerWorld.oreBerrySecond, calcStackSize(ingredient, ingredient2), sc);
recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
@@ -77,47 +67,38 @@ public class TVillageTrades implements IVillageTradeHandler
}
}
private int calcStackSize (ItemStack ingredient, ItemStack ingredient2)
{
if (ingredient == null)
return 1;
private int calcStackSize(ItemStack ingredient, ItemStack ingredient2) {
if (ingredient == null) return 1;
int num = ingredient.stackSize;
if (ingredient2 != null)
num += ingredient2.stackSize;
if (ingredient2 != null) num += ingredient2.stackSize;
return Math.max(1, Math.round((num - 5) / 4));
}
private ItemStack getIngredient (Random random, ItemStack ingredient)
{
private ItemStack getIngredient(Random random, ItemStack ingredient) {
int sc;
ItemStack is;
int tries = 0;
while (true)
{
while (true) {
sc = getNextInt(random, 0, allowedIngredients.size() - 1);
is = allowedIngredients.get(sc);
if (is != ingredient || is.getItemDamage() != ingredient.getItemDamage())
break;
if (is != ingredient || is.getItemDamage() != ingredient.getItemDamage()) break;
tries++;
if (tries == 5)
return null;
if (tries == 5) return null;
}
int num = getNextInt(random, 0, Math.min(is.stackSize, max - ingredient.stackSize));
return is.copy().splitStack(num);
}
private ItemStack getIngredient (Random random, int num)
{
private ItemStack getIngredient(Random random, int num) {
int sc = getNextInt(random, 0, allowedIngredients.size() - 1);
ItemStack item = allowedIngredients.get(sc);
return item.copy().splitStack(Math.min(num, item.stackSize));
}
private int getNextInt (Random random, int min, int max)
{
private int getNextInt(Random random, int min, int max) {
return random.nextInt(Math.max(1, (max - min) + 1)) + min;
}
}
@@ -5,24 +5,28 @@ import java.util.*;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
public class VillageSmelteryHandler implements IVillageCreationHandler
{
public class VillageSmelteryHandler implements IVillageCreationHandler {
@Override
public PieceWeight getVillagePieceWeight (Random random, int i)
{
public PieceWeight getVillagePieceWeight(Random random, int i) {
return new PieceWeight(ComponentSmeltery.class, 9, 1);
}
@Override
public Class<?> getComponentClass ()
{
public Class<?> getComponentClass() {
return ComponentSmeltery.class;
}
@Override
public Object buildComponent (PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
public Object buildComponent(
PieceWeight villagePiece,
Start startPiece,
List pieces,
Random random,
int p1,
int p2,
int p3,
int p4,
int p5) {
return ComponentSmeltery.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}
@@ -5,23 +5,28 @@ import java.util.*;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
public class VillageToolStationHandler implements IVillageCreationHandler
{
public class VillageToolStationHandler implements IVillageCreationHandler {
@Override
public PieceWeight getVillagePieceWeight (Random random, int i)
{
public PieceWeight getVillagePieceWeight(Random random, int i) {
return new PieceWeight(ComponentToolWorkshop.class, 30, i + random.nextInt(4));
}
@Override
public Class<?> getComponentClass ()
{
public Class<?> getComponentClass() {
return ComponentToolWorkshop.class;
}
@Override
public Object buildComponent (PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
public Object buildComponent(
PieceWeight villagePiece,
Start startPiece,
List pieces,
Random random,
int p1,
int p2,
int p3,
int p4,
int p5) {
return ComponentToolWorkshop.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}