Why does this bug me?

This commit is contained in:
Ellpeck 2015-11-22 18:58:23 +01:00
parent 0a78782693
commit 4d910cea70
16 changed files with 71 additions and 59 deletions

View file

@ -11,6 +11,7 @@
package ellpeck.actuallyadditions.blocks; package ellpeck.actuallyadditions.blocks;
import ellpeck.actuallyadditions.tile.TileEntityInventoryBase; import ellpeck.actuallyadditions.tile.TileEntityInventoryBase;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -44,17 +45,17 @@ public abstract class BlockContainerBase extends BlockContainer{
public void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, int x, int y, int z){ public void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, int x, int y, int z){
ItemStack stack = tile.getStackInSlot(i); ItemStack stack = tile.getStackInSlot(i);
if(stack != null && stack.stackSize > 0){ if(stack != null && stack.stackSize > 0){
float dX = world.rand.nextFloat()*0.8F+0.1F; float dX = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dY = world.rand.nextFloat()*0.8F+0.1F; float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = world.rand.nextFloat()*0.8F+0.1F; float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, stack.copy()); EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, stack.copy());
if(stack.hasTagCompound()){ if(stack.hasTagCompound()){
entityItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy()); entityItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
} }
float factor = 0.05F; float factor = 0.05F;
entityItem.motionX = world.rand.nextGaussian()*factor; entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = world.rand.nextGaussian()*factor+0.2F; entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;
entityItem.motionZ = world.rand.nextGaussian()*factor; entityItem.motionZ = Util.RANDOM.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
tile.setInventorySlotContents(i, null); tile.setInventorySlotContents(i, null);

View file

@ -20,6 +20,7 @@ import ellpeck.actuallyadditions.tile.TileEntityInventoryBase;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.StringUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -30,8 +31,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.Random;
public class BlockInputter extends BlockContainerBase implements IActAddItemOrBlock{ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBlock{
public static final int NAME_FLAVOR_AMOUNTS = 15; public static final int NAME_FLAVOR_AMOUNTS = 15;
@ -104,8 +103,6 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
private long lastSysTime; private long lastSysTime;
private int toPick; private int toPick;
private final Random rand = new Random();
public TheItemBlock(Block block){ public TheItemBlock(Block block){
super(block); super(block);
this.setHasSubtypes(false); this.setHasSubtypes(false);
@ -134,7 +131,7 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
if(this.lastSysTime+5000 < sysTime){ if(this.lastSysTime+5000 < sysTime){
this.lastSysTime = sysTime; this.lastSysTime = sysTime;
this.toPick = this.rand.nextInt(NAME_FLAVOR_AMOUNTS)+1; this.toPick = Util.RANDOM.nextInt(NAME_FLAVOR_AMOUNTS)+1;
} }
return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID_LOWER+".blockInputter.add."+this.toPick+".name")+")"; return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID_LOWER+".blockInputter.add."+this.toPick+".name")+")";

View file

@ -16,6 +16,7 @@ import ellpeck.actuallyadditions.achievement.TheAchievements;
import ellpeck.actuallyadditions.recipe.TreasureChestHandler; import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -103,7 +104,7 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
world.playSoundAtEntity(player, "random.chestopen", 0.2F, world.rand.nextFloat()*0.1F+0.9F); world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
this.dropItems(world, x, y, z); this.dropItems(world, x, y, z);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
@ -155,22 +156,22 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{
} }
private void dropItems(World world, int x, int y, int z){ private void dropItems(World world, int x, int y, int z){
for(int i = 0; i < MathHelper.getRandomIntegerInRange(world.rand, 3, 6); i++){ for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){
TreasureChestHandler.Return theReturn = (TreasureChestHandler.Return)WeightedRandom.getRandomItem(world.rand, TreasureChestHandler.returns); TreasureChestHandler.Return theReturn = (TreasureChestHandler.Return)WeightedRandom.getRandomItem(Util.RANDOM, TreasureChestHandler.returns);
ItemStack itemStack = theReturn.returnItem.copy(); ItemStack itemStack = theReturn.returnItem.copy();
itemStack.stackSize = MathHelper.getRandomIntegerInRange(world.rand, theReturn.minAmount, theReturn.maxAmount); itemStack.stackSize = MathHelper.getRandomIntegerInRange(Util.RANDOM, theReturn.minAmount, theReturn.maxAmount);
float dX = world.rand.nextFloat()*0.8F+0.1F; float dX = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dY = world.rand.nextFloat()*0.8F+0.1F; float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = world.rand.nextFloat()*0.8F+0.1F; float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, itemStack.copy()); EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, itemStack.copy());
if(itemStack.hasTagCompound()){ if(itemStack.hasTagCompound()){
entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy()); entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
} }
float factor = 0.05F; float factor = 0.05F;
entityItem.motionX = world.rand.nextGaussian()*factor; entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = world.rand.nextGaussian()*factor+0.2F; entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;
entityItem.motionZ = world.rand.nextGaussian()*factor; entityItem.motionZ = Util.RANDOM.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0; itemStack.stackSize = 0;
} }

View file

@ -19,6 +19,7 @@ import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.tile.TileEntityXPSolidifier; import ellpeck.actuallyadditions.tile.TileEntityXPSolidifier;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -147,14 +148,14 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem
} }
private void spawnItem(World world, int x, int y, int z, ItemStack stack){ private void spawnItem(World world, int x, int y, int z, ItemStack stack){
float dX = world.rand.nextFloat()*0.8F+0.1F; float dX = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dY = world.rand.nextFloat()*0.8F+0.1F; float dY = Util.RANDOM.nextFloat()*0.8F+0.1F;
float dZ = world.rand.nextFloat()*0.8F+0.1F; float dZ = Util.RANDOM.nextFloat()*0.8F+0.1F;
EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, stack); EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, stack);
float factor = 0.05F; float factor = 0.05F;
entityItem.motionX = world.rand.nextGaussian()*factor; entityItem.motionX = Util.RANDOM.nextGaussian()*factor;
entityItem.motionY = world.rand.nextGaussian()*factor+0.2F; entityItem.motionY = Util.RANDOM.nextGaussian()*factor+0.2F;
entityItem.motionZ = world.rand.nextGaussian()*factor; entityItem.motionZ = Util.RANDOM.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
} }

View file

@ -15,6 +15,7 @@ import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemWingsOfTheBats; import ellpeck.actuallyadditions.items.ItemWingsOfTheBats;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -31,7 +32,7 @@ public class EntityLivingEvent{
if(event.entityLiving != null && event.entityLiving.worldObj != null && !event.entityLiving.worldObj.isRemote){ if(event.entityLiving != null && event.entityLiving.worldObj != null && !event.entityLiving.worldObj.isRemote){
if((event.entityLiving instanceof EntityOcelot && ((EntityOcelot)event.entityLiving).isTamed()) || (event.entityLiving instanceof EntityPlayer && event.entityLiving.getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){ if((event.entityLiving instanceof EntityOcelot && ((EntityOcelot)event.entityLiving).isTamed()) || (event.entityLiving instanceof EntityPlayer && event.entityLiving.getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){
if(ConfigBoolValues.DO_CAT_DROPS.isEnabled()){ if(ConfigBoolValues.DO_CAT_DROPS.isEnabled()){
if(event.entityLiving.worldObj.rand.nextInt(ConfigIntValues.CAT_DROP_CHANCE.getValue())+1 == 1){ if(Util.RANDOM.nextInt(ConfigIntValues.CAT_DROP_CHANCE.getValue())+1 == 1){
EntityItem item = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX+0.5, event.entityLiving.posY+0.5, event.entityLiving.posZ+0.5, new ItemStack(InitItems.itemHairyBall)); EntityItem item = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX+0.5, event.entityLiving.posY+0.5, event.entityLiving.posZ+0.5, new ItemStack(InitItems.itemHairyBall));
event.entityLiving.worldObj.spawnEntityInWorld(item); event.entityLiving.worldObj.spawnEntityInWorld(item);
} }

View file

@ -16,6 +16,7 @@ import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -32,23 +33,23 @@ public class LivingDropEvent{
for(int i = 0; i < TheSpecialDrops.values().length; i++){ for(int i = 0; i < TheSpecialDrops.values().length; i++){
TheSpecialDrops theDrop = TheSpecialDrops.values()[i]; TheSpecialDrops theDrop = TheSpecialDrops.values()[i];
if(theDrop.canDrop && theDrop.dropFrom.isAssignableFrom(event.entityLiving.getClass())){ if(theDrop.canDrop && theDrop.dropFrom.isAssignableFrom(event.entityLiving.getClass())){
if(event.entityLiving.worldObj.rand.nextInt(100)+1 <= theDrop.chance){ if(Util.RANDOM.nextInt(100)+1 <= theDrop.chance){
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSpecialDrop, event.entityLiving.worldObj.rand.nextInt(theDrop.maxAmount)+1, theDrop.ordinal()), 0); event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSpecialDrop, Util.RANDOM.nextInt(theDrop.maxAmount)+1, theDrop.ordinal()), 0);
} }
} }
} }
//Drop Cobwebs from Spiders //Drop Cobwebs from Spiders
if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.entityLiving instanceof EntitySpider){ if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.entityLiving instanceof EntitySpider){
if(event.entityLiving.worldObj.rand.nextInt(ConfigIntValues.SPIDER_DROP_CHANCE.getValue()) <= 0){ if(Util.RANDOM.nextInt(ConfigIntValues.SPIDER_DROP_CHANCE.getValue()) <= 0){
event.entityLiving.entityDropItem(new ItemStack(Blocks.web, event.entityLiving.worldObj.rand.nextInt(2)+1), 0); event.entityLiving.entityDropItem(new ItemStack(Blocks.web, Util.RANDOM.nextInt(2)+1), 0);
} }
} }
//Drop Wings from Bats //Drop Wings from Bats
if(ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.entityLiving instanceof EntityBat){ if(ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.entityLiving instanceof EntityBat){
if(event.entityLiving.worldObj.rand.nextInt(ConfigIntValues.BAT_DROP_CHANCE.getValue()) <= 0){ if(Util.RANDOM.nextInt(ConfigIntValues.BAT_DROP_CHANCE.getValue()) <= 0){
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemMisc, event.entityLiving.worldObj.rand.nextInt(2)+1, TheMiscItems.BAT_WING.ordinal()), 0); event.entityLiving.entityDropItem(new ItemStack(InitItems.itemMisc, Util.RANDOM.nextInt(2)+1, TheMiscItems.BAT_WING.ordinal()), 0);
} }
} }
} }

View file

@ -14,6 +14,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.WorldPos; import ellpeck.actuallyadditions.util.WorldPos;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockGrass;
@ -73,10 +74,10 @@ public class ItemGrowthRing extends ItemEnergy{
//Fertilizing the Blocks //Fertilizing the Blocks
if(!blocks.isEmpty()){ if(!blocks.isEmpty()){
for(int i = 0; i < ConfigIntValues.GROWTH_RING_GROWTH_PER_CYCLE.getValue(); i++){ for(int i = 0; i < ConfigIntValues.GROWTH_RING_GROWTH_PER_CYCLE.getValue(); i++){
WorldPos pos = blocks.get(world.rand.nextInt(blocks.size())); WorldPos pos = blocks.get(Util.RANDOM.nextInt(blocks.size()));
int metaBefore = pos.getMetadata(); int metaBefore = pos.getMetadata();
pos.getBlock().updateTick(world, pos.getX(), pos.getY(), pos.getZ(), world.rand); pos.getBlock().updateTick(world, pos.getX(), pos.getY(), pos.getZ(), Util.RANDOM);
//Show Particles if Metadata changed //Show Particles if Metadata changed
if(pos.getMetadata() != metaBefore){ if(pos.getMetadata() != metaBefore){

View file

@ -15,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.recipe.HairyBallHandler; import ellpeck.actuallyadditions.recipe.HairyBallHandler;
import ellpeck.actuallyadditions.util.IActAddItemOrBlock; import ellpeck.actuallyadditions.util.IActAddItemOrBlock;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -37,13 +38,13 @@ public class ItemHairyBall extends Item implements IActAddItemOrBlock{
player.worldObj.spawnEntityInWorld(entityItem); player.worldObj.spawnEntityInWorld(entityItem);
} }
stack.stackSize--; stack.stackSize--;
world.playSoundAtEntity(player, "random.pop", 0.2F, world.rand.nextFloat()*0.1F+0.9F); world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
} }
return stack; return stack;
} }
public ItemStack getRandomReturnItem(World world){ public ItemStack getRandomReturnItem(World world){
return ((HairyBallHandler.Return)WeightedRandom.getRandomItem(world.rand, HairyBallHandler.returns)).returnItem.copy(); return ((HairyBallHandler.Return)WeightedRandom.getRandomItem(Util.RANDOM, HairyBallHandler.returns)).returnItem.copy();
} }
@Override @Override

View file

@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.misc;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.StringUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
@ -30,7 +31,7 @@ public class DamageSources extends DamageSource{
@Override @Override
public IChatComponent func_151519_b(EntityLivingBase entity){ public IChatComponent func_151519_b(EntityLivingBase entity){
String locTag = "death."+ModUtil.MOD_ID_LOWER+"."+this.damageType+"."+(entity.worldObj.rand.nextInt(this.messageCount)+1); String locTag = "death."+ModUtil.MOD_ID_LOWER+"."+this.damageType+"."+(Util.RANDOM.nextInt(this.messageCount)+1);
return new ChatComponentText(StringUtil.localizeFormatted(locTag, entity.getCommandSenderName())); return new ChatComponentText(StringUtil.localizeFormatted(locTag, entity.getCommandSenderName()));
} }
} }

View file

@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -45,7 +46,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
if(this.currentTimer >= ConfigIntValues.FEEDER_TIME.getValue()){ if(this.currentTimer >= ConfigIntValues.FEEDER_TIME.getValue()){
this.currentTimer = 0; this.currentTimer = 0;
if(this.slots[0] != null){ if(this.slots[0] != null){
EntityAnimal randomAnimal = animals.get(worldObj.rand.nextInt(this.currentAnimalAmount)); EntityAnimal randomAnimal = animals.get(Util.RANDOM.nextInt(this.currentAnimalAmount));
if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){ if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){
this.feedAnimal(randomAnimal); this.feedAnimal(randomAnimal);
@ -84,10 +85,10 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
public void feedAnimal(EntityAnimal animal){ public void feedAnimal(EntityAnimal animal){
animal.func_146082_f(null); animal.func_146082_f(null);
for(int i = 0; i < 7; i++){ for(int i = 0; i < 7; i++){
double d = animal.worldObj.rand.nextGaussian()*0.02D; double d = Util.RANDOM.nextGaussian()*0.02D;
double d1 = animal.worldObj.rand.nextGaussian()*0.02D; double d1 = Util.RANDOM.nextGaussian()*0.02D;
double d2 = animal.worldObj.rand.nextGaussian()*0.02D; double d2 = Util.RANDOM.nextGaussian()*0.02D;
worldObj.spawnParticle("heart", (animal.posX+(double)(animal.worldObj.rand.nextFloat()*animal.width*2.0F))-animal.width, animal.posY+0.5D+(double)(animal.worldObj.rand.nextFloat()*animal.height), (animal.posZ+(double)(animal.worldObj.rand.nextFloat()*animal.width*2.0F))-animal.width, d, d1, d2); worldObj.spawnParticle("heart", (animal.posX+(double)(Util.RANDOM.nextFloat()*animal.width*2.0F))-animal.width, animal.posY+0.5D+(double)(Util.RANDOM.nextFloat()*animal.height), (animal.posZ+(double)(Util.RANDOM.nextFloat()*animal.width*2.0F))-animal.width, d, d1, d2);
} }
} }

View file

@ -11,6 +11,7 @@
package ellpeck.actuallyadditions.tile; package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -44,7 +45,7 @@ public class TileEntityFishingNet extends TileEntityBase{
if(this.timeUntilNextDrop > 0){ if(this.timeUntilNextDrop > 0){
this.timeUntilNextDrop--; this.timeUntilNextDrop--;
if(timeUntilNextDrop <= 0){ if(timeUntilNextDrop <= 0){
ItemStack fishable = FishingHooks.getRandomFishable(worldObj.rand, this.worldObj.rand.nextFloat()); ItemStack fishable = FishingHooks.getRandomFishable(Util.RANDOM, Util.RANDOM.nextFloat());
TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord);
if(tile != null && tile instanceof IInventory){ if(tile != null && tile instanceof IInventory){
this.insertIntoInventory((IInventory)tile, fishable); this.insertIntoInventory((IInventory)tile, fishable);
@ -57,7 +58,7 @@ public class TileEntityFishingNet extends TileEntityBase{
} }
} }
else{ else{
this.timeUntilNextDrop = ConfigIntValues.FISHER_TIME.getValue()+worldObj.rand.nextInt(ConfigIntValues.FISHER_TIME.getValue()/2); this.timeUntilNextDrop = ConfigIntValues.FISHER_TIME.getValue()+Util.RANDOM.nextInt(ConfigIntValues.FISHER_TIME.getValue()/2);
} }
} }
} }

View file

@ -11,6 +11,7 @@
package ellpeck.actuallyadditions.tile; package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.WorldPos; import ellpeck.actuallyadditions.util.WorldPos;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockGrass;
@ -33,7 +34,7 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
this.timeUntilNextFert--; this.timeUntilNextFert--;
if(timeUntilNextFert <= 0){ if(timeUntilNextFert <= 0){
int metaBefore = blockToFert.getMetadata(); int metaBefore = blockToFert.getMetadata();
worldObj.getBlock(blockToFert.getX(), blockToFert.getY(), blockToFert.getZ()).updateTick(worldObj, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), worldObj.rand); worldObj.getBlock(blockToFert.getX(), blockToFert.getY(), blockToFert.getZ()).updateTick(worldObj, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), Util.RANDOM);
if(blockToFert.getMetadata() != metaBefore){ if(blockToFert.getMetadata() != metaBefore){
worldObj.playAuxSFX(2005, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), 0); worldObj.playAuxSFX(2005, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), 0);
@ -41,7 +42,7 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
} }
} }
else{ else{
this.timeUntilNextFert = ConfigIntValues.GLASS_TIME_NEEDED.getValue()+this.worldObj.rand.nextInt(ConfigIntValues.GLASS_TIME_NEEDED.getValue()); this.timeUntilNextFert = ConfigIntValues.GLASS_TIME_NEEDED.getValue()+Util.RANDOM.nextInt(ConfigIntValues.GLASS_TIME_NEEDED.getValue());
} }
} }
} }

View file

@ -17,6 +17,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -177,7 +178,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
if(outputTwos != null){ if(outputTwos != null){
ItemStack outputTwo = outputTwos.get(0); ItemStack outputTwo = outputTwos.get(0);
if(outputTwo != null){ if(outputTwo != null){
int rand = this.worldObj.rand.nextInt(100)+1; int rand = Util.RANDOM.nextInt(100)+1;
if(rand <= CrusherRecipeRegistry.getOutputTwoChance(this.slots[theInput])){ if(rand <= CrusherRecipeRegistry.getOutputTwoChance(this.slots[theInput])){
if(this.slots[theSecondOutput] == null){ if(this.slots[theSecondOutput] == null){
this.slots[theSecondOutput] = outputTwo.copy(); this.slots[theSecondOutput] = outputTwo.copy();

View file

@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.tile;
import cofh.api.energy.EnergyStorage; import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyProvider;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.WorldPos; import ellpeck.actuallyadditions.util.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -46,8 +47,8 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
this.storage.receiveEnergy(ConfigIntValues.HEAT_COLLECTOR_ENERGY_PRODUCED.getValue(), false); this.storage.receiveEnergy(ConfigIntValues.HEAT_COLLECTOR_ENERGY_PRODUCED.getValue(), false);
this.markDirty(); this.markDirty();
if(worldObj.rand.nextInt(ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue()) == 0){ if(Util.RANDOM.nextInt(ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue()) == 0){
int randomSide = blocksAround.get(worldObj.rand.nextInt(blocksAround.size())); int randomSide = blocksAround.get(Util.RANDOM.nextInt(blocksAround.size()));
WorldUtil.breakBlockAtSide(WorldUtil.getDirectionBySidesInOrder(randomSide), worldObj, xCoord, yCoord, zCoord); WorldUtil.breakBlockAtSide(WorldUtil.getDirectionBySidesInOrder(randomSide), worldObj, xCoord, yCoord, zCoord);
} }
} }

View file

@ -16,6 +16,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler; import ellpeck.actuallyadditions.misc.LaserRelayConnectionHandler;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.WorldPos; import ellpeck.actuallyadditions.util.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
@ -46,7 +47,7 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderParticles(){ public void renderParticles(){
if(this.worldObj.rand.nextInt(2) == 0){ if(Util.RANDOM.nextInt(2) == 0){
WorldPos thisPos = new WorldPos(this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord); WorldPos thisPos = new WorldPos(this.getWorldObj(), this.xCoord, this.yCoord, this.zCoord);
LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos); LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos);
if(network != null){ if(network != null){

View file

@ -15,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.BlockPhantom; import ellpeck.actuallyadditions.blocks.BlockPhantom;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.WorldPos; import ellpeck.actuallyadditions.util.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -91,15 +92,15 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderParticles(){ public void renderParticles(){
if(this.worldObj.rand.nextInt(2) == 0){ if(Util.RANDOM.nextInt(2) == 0){
double d1 = (double)((float)this.boundPosition.getY()+worldObj.rand.nextFloat()); double d1 = (double)((float)this.boundPosition.getY()+Util.RANDOM.nextFloat());
int i1 = worldObj.rand.nextInt(2)*2-1; int i1 = Util.RANDOM.nextInt(2)*2-1;
int j1 = worldObj.rand.nextInt(2)*2-1; int j1 = Util.RANDOM.nextInt(2)*2-1;
double d4 = ((double)worldObj.rand.nextFloat()-0.5D)*0.125D; double d4 = ((double)Util.RANDOM.nextFloat()-0.5D)*0.125D;
double d2 = (double)this.boundPosition.getZ()+0.5D+0.25D*(double)j1; double d2 = (double)this.boundPosition.getZ()+0.5D+0.25D*(double)j1;
double d5 = (double)(worldObj.rand.nextFloat()*1.0F*(float)j1); double d5 = (double)(Util.RANDOM.nextFloat()*1.0F*(float)j1);
double d0 = (double)this.boundPosition.getX()+0.5D+0.25D*(double)i1; double d0 = (double)this.boundPosition.getX()+0.5D+0.25D*(double)i1;
double d3 = (double)(worldObj.rand.nextFloat()*1.0F*(float)i1); double d3 = (double)(Util.RANDOM.nextFloat()*1.0F*(float)i1);
worldObj.spawnParticle("portal", d0, d1, d2, d3, d4, d5); worldObj.spawnParticle("portal", d0, d1, d2, d3, d4, d5);
} }
} }