Added honey
This commit is contained in:
parent
95c9ccefac
commit
25f5dd9b4e
10 changed files with 135 additions and 14 deletions
|
@ -12,7 +12,9 @@ public class Fluids
|
|||
|
||||
public static Optional<? extends Block> springWater = Optional.absent();
|
||||
public static Optional<? extends Block> liquidPoison = Optional.absent();
|
||||
public static Optional<? extends Block> honey = Optional.absent();
|
||||
|
||||
public static Optional<? extends Fluid> springWaterFluid = Optional.absent();
|
||||
public static Optional<? extends Fluid> liquidPoisonFluid = Optional.absent();
|
||||
public static Optional<? extends Fluid> honeyFluid = Optional.absent();
|
||||
}
|
||||
|
|
|
@ -7,8 +7,10 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
|||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import biomesoplenty.api.Fluids;
|
||||
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
|
||||
import biomesoplenty.fluids.BlockFluidHoney;
|
||||
import biomesoplenty.fluids.BlockFluidLiquidPoison;
|
||||
import biomesoplenty.fluids.BlockFluidSpringWater;
|
||||
import biomesoplenty.fluids.HoneyFluid;
|
||||
import biomesoplenty.fluids.LiquidPoisonFluid;
|
||||
import biomesoplenty.fluids.SpringWaterFluid;
|
||||
import biomesoplenty.items.ItemBOPBucket;
|
||||
|
@ -34,6 +36,9 @@ public class BOPFluids
|
|||
|
||||
Fluids.springWaterFluid = Optional.of(new SpringWaterFluid("bop.springWater").setBlockID(BOPConfigurationIDs.springWaterStillID));
|
||||
FluidRegistry.registerFluid(Fluids.springWaterFluid.get());
|
||||
|
||||
Fluids.honeyFluid = Optional.of(new HoneyFluid("bop.honey").setBlockID(BOPConfigurationIDs.honeyStillID));
|
||||
FluidRegistry.registerFluid(Fluids.honeyFluid.get());
|
||||
}
|
||||
|
||||
private static void initializeLiquids()
|
||||
|
@ -41,6 +46,8 @@ public class BOPFluids
|
|||
Fluids.liquidPoison = Optional.of(new BlockFluidLiquidPoison(BOPConfigurationIDs.liquidPoisonStillID, Fluids.liquidPoisonFluid.get(), Material.water).setUnlocalizedName("bop.liquidPoison"));
|
||||
|
||||
Fluids.springWater = Optional.of(new BlockFluidSpringWater(BOPConfigurationIDs.springWaterStillID, Fluids.springWaterFluid.get(), Material.water).setUnlocalizedName("bop.springWater"));
|
||||
|
||||
Fluids.honey = Optional.of(new BlockFluidHoney(BOPConfigurationIDs.honeyStillID, Fluids.honeyFluid.get(), Material.water).setUnlocalizedName("bop.honey"));
|
||||
}
|
||||
|
||||
private static void initializeContainers()
|
||||
|
@ -48,6 +55,7 @@ public class BOPFluids
|
|||
Fluids.bopBucket = Optional.of((new ItemBOPBucket(BOPConfigurationIDs.bopBucketID).setMaxStackSize(1).setUnlocalizedName("bop.bopBucket")));
|
||||
|
||||
FluidContainerRegistry.registerFluidContainer(Fluids.liquidPoisonFluid.get(), new ItemStack(Fluids.bopBucket.get(), 1, 1), new ItemStack(Item.bucketEmpty));
|
||||
FluidContainerRegistry.registerFluidContainer(Fluids.honeyFluid.get(), new ItemStack(Fluids.bopBucket.get(), 1, 3), new ItemStack(Item.bucketEmpty));
|
||||
FluidContainerRegistry.registerFluidContainer(Fluids.springWaterFluid.get(), new ItemStack(Fluids.bopBucket.get(), 1, 2), new ItemStack(Fluids.bopBucket.get(), 1, 0));
|
||||
}
|
||||
|
||||
|
@ -55,5 +63,6 @@ public class BOPFluids
|
|||
{
|
||||
GameRegistry.registerBlock(Fluids.liquidPoison.get(), "liquidPoison");
|
||||
GameRegistry.registerBlock(Fluids.springWater.get(), "springWater");
|
||||
GameRegistry.registerBlock(Fluids.honey.get(), "honey");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,6 +155,7 @@ public class BOPConfigurationIDs
|
|||
//Liquid IDs
|
||||
public static int springWaterStillID;
|
||||
public static int liquidPoisonStillID;
|
||||
public static int honeyStillID;
|
||||
|
||||
//Biome IDs
|
||||
public static int alpsID;
|
||||
|
@ -408,6 +409,11 @@ public class BOPConfigurationIDs
|
|||
flowers2ID = config.getBlock("Flower 2 ID", 1983, null).getInt();
|
||||
|
||||
hiveID = config.getBlock("Hive ID", 1984, null).getInt();
|
||||
|
||||
//Liquid Ids
|
||||
springWaterStillID = config.get("Liquid IDs", "Spring Water Still ID (ID before this must be free!)", 1985, null).getInt();
|
||||
liquidPoisonStillID = config.get("Liquid IDs", "Liquid Poison Still ID (ID before this must be free!)", 1987, null).getInt();
|
||||
honeyStillID = config.get("Liquid IDs", "Honey Still ID (ID before this must be free!)", 1989, null).getInt();
|
||||
|
||||
// Get Item ID's
|
||||
foodID = config.getItem("Food ID", 21003, null).getInt();
|
||||
|
@ -459,10 +465,6 @@ public class BOPConfigurationIDs
|
|||
|
||||
wadingBootsID = config.getItem("Wading Boots ID", 21088).getInt();
|
||||
flippersID = config.getItem("Flippers ID", 21089).getInt();
|
||||
|
||||
//Liquid Ids
|
||||
springWaterStillID = config.get("Liquid IDs", "Spring Water Still ID (ID before this must be free!)", 1971, null).getInt();
|
||||
liquidPoisonStillID = config.get("Liquid IDs", "Liquid Poison Still ID (ID before this must be free!)", 1973, null).getInt();
|
||||
|
||||
//Mob IDs
|
||||
jungleSpiderID = config.get("Mob IDs", "Jungle Spider ID", 101, null).getInt();
|
||||
|
|
81
common/biomesoplenty/fluids/BlockFluidHoney.java
Normal file
81
common/biomesoplenty/fluids/BlockFluidHoney.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package biomesoplenty.fluids;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFluidHoney extends BlockFluidClassic
|
||||
{
|
||||
public static Icon honeyStillIcon;
|
||||
public static Icon honeyFlowingIcon;
|
||||
|
||||
public BlockFluidHoney(int id, Fluid fluid, Material material)
|
||||
{
|
||||
super(id, fluid, material);
|
||||
|
||||
quantaPerBlock = 4;
|
||||
this.setLightOpacity(3);
|
||||
|
||||
for (int i = 8; i < 11; i++)
|
||||
{
|
||||
displacementIds.put(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
|
||||
|
||||
int bId = world.getBlockId(x, y, z);
|
||||
|
||||
if (bId == 0)
|
||||
return true;
|
||||
if (bId == blockID)
|
||||
return false;
|
||||
if (displacementIds.containsKey(bId))
|
||||
return displacementIds.get(bId);
|
||||
Material material = Block.blocksList[bId].blockMaterial;
|
||||
|
||||
if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z, Entity par5Entity)
|
||||
{
|
||||
int meta = par1World.getBlockMetadata(x, y, z);
|
||||
|
||||
if (par5Entity instanceof EntityLivingBase)
|
||||
{
|
||||
//((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
|
||||
//((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
honeyStillIcon = iconRegister.registerIcon("biomesoplenty:honey_still");
|
||||
honeyFlowingIcon = iconRegister.registerIcon("biomesoplenty:honey_flowing");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int par1, int par2)
|
||||
{
|
||||
return par1 != 0 && par1 != 1 ? honeyFlowingIcon : honeyStillIcon;
|
||||
}
|
||||
}
|
30
common/biomesoplenty/fluids/HoneyFluid.java
Normal file
30
common/biomesoplenty/fluids/HoneyFluid.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package biomesoplenty.fluids;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class HoneyFluid extends Fluid
|
||||
{
|
||||
public HoneyFluid(String fluidName)
|
||||
{
|
||||
super(fluidName);
|
||||
|
||||
this.setViscosity(1500);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getStillIcon()
|
||||
{
|
||||
return BlockFluidHoney.honeyStillIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getFlowingIcon()
|
||||
{
|
||||
return BlockFluidHoney.honeyFlowingIcon;
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ public class ItemBOPBucket extends Item
|
|||
{
|
||||
private int isFull;
|
||||
|
||||
private static final String[] bucketTypes = new String[] {"amethyst_empty", "liquid_poison", "amethyst_spring_water"};
|
||||
private static final String[] bucketTypes = new String[] {"amethyst_empty", "liquid_poison", "amethyst_spring_water", "honey"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] textures;
|
||||
|
@ -202,6 +202,9 @@ public class ItemBOPBucket extends Item
|
|||
|
||||
case 2:
|
||||
return Fluids.springWater.get().blockID;
|
||||
|
||||
case 3:
|
||||
return Fluids.honey.get().blockID;
|
||||
|
||||
default:
|
||||
return Fluids.liquidPoison.get().blockID;
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.api.Fluids;
|
||||
import biomesoplenty.entities.EntityWasp;
|
||||
|
||||
public class WorldGenHive extends WorldGenerator
|
||||
|
@ -58,14 +59,7 @@ public class WorldGenHive extends WorldGenerator
|
|||
//Bottom 3
|
||||
generateHiveCubeSmall(world, x, (y - (baseHeight + 7)) + cubeno, z, (baseHeight - 7) + (cubeno * 2), (baseWidth - 4) + cubeno, cubeno, chance);
|
||||
|
||||
if (honeychance != 0)
|
||||
{
|
||||
spawnWasps(world, rand, x, y, z, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnWasps(world, rand, x, y, z, 7);
|
||||
}
|
||||
spawnWasps(world, rand, x, y, z, 15);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -86,7 +80,7 @@ public class WorldGenHive extends WorldGenerator
|
|||
{
|
||||
if (hLayer > (height / 2))
|
||||
{
|
||||
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlock(origx + i, origy - hLayer, origz + j, Block.waterMoving.blockID);
|
||||
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlock(origx + i, origy - hLayer, origz + j, Fluids.honey.get().blockID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
resources/assets/biomesoplenty/textures/items/bucket_honey.png
Normal file
BIN
resources/assets/biomesoplenty/textures/items/bucket_honey.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 325 B |
Loading…
Reference in a new issue