This is..

wow.
I'm...
wow.
/cc AtomSponge
This commit is contained in:
Ellpeck 2015-11-12 21:36:20 +01:00
parent a3b98937e8
commit 9932432854
14 changed files with 45 additions and 66 deletions

View file

@ -21,8 +21,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.Random;
public abstract class BlockContainerBase extends BlockContainer{ public abstract class BlockContainerBase extends BlockContainer{
public BlockContainerBase(Material mat){ public BlockContainerBase(Material mat){
@ -44,20 +42,19 @@ 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){
Random rand = new Random();
ItemStack stack = tile.getStackInSlot(i); ItemStack stack = tile.getStackInSlot(i);
if(stack != null && stack.stackSize > 0){ if(stack != null && stack.stackSize > 0){
float dX = rand.nextFloat()*0.8F+0.1F; float dX = world.rand.nextFloat()*0.8F+0.1F;
float dY = rand.nextFloat()*0.8F+0.1F; float dY = world.rand.nextFloat()*0.8F+0.1F;
float dZ = rand.nextFloat()*0.8F+0.1F; float dZ = world.rand.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 = rand.nextGaussian()*factor; entityItem.motionX = world.rand.nextGaussian()*factor;
entityItem.motionY = rand.nextGaussian()*factor+0.2F; entityItem.motionY = world.rand.nextGaussian()*factor+0.2F;
entityItem.motionZ = rand.nextGaussian()*factor; entityItem.motionZ = world.rand.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
tile.setInventorySlotContents(i, null); tile.setInventorySlotContents(i, null);

View file

@ -78,8 +78,8 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo
if(meta == 1){ if(meta == 1){
for(int i = 0; i < 5; i++){ for(int i = 0; i < 5; i++){
double xRand = new Random().nextDouble()/0.75D-0.5D; double xRand = rand.nextDouble()/0.75D-0.5D;
double zRand = new Random().nextDouble()/0.75D-0.5D; double zRand = rand.nextDouble()/0.75D-0.5D;
world.spawnParticle("crit", (double)x+0.4F, (double)y+0.8F, (double)z+0.4F, xRand, 0.5D, zRand); world.spawnParticle("crit", (double)x+0.4F, (double)y+0.8F, (double)z+0.4F, xRand, 0.5D, zRand);
} }
world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D); world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);

View file

@ -104,6 +104,8 @@ 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);
@ -128,12 +130,11 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
@Override @Override
public String getItemStackDisplayName(ItemStack stack){ public String getItemStackDisplayName(ItemStack stack){
Random rand = new Random();
long sysTime = System.currentTimeMillis(); long sysTime = System.currentTimeMillis();
if(this.lastSysTime+5000 < sysTime){ if(this.lastSysTime+5000 < sysTime){
this.lastSysTime = sysTime; this.lastSysTime = sysTime;
this.toPick = rand.nextInt(NAME_FLAVOUR_AMOUNTS)+1; this.toPick = this.rand.nextInt(NAME_FLAVOUR_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

@ -103,7 +103,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, new Random().nextFloat()*0.1F+0.9F); world.playSoundAtEntity(player, "random.chestopen", 0.2F, world.rand.nextFloat()*0.1F+0.9F);
this.dropItems(world, x, y, z); this.dropItems(world, x, y, z);
player.addStat(TheAchievements.OPEN_TREASURE_CHEST.ach, 1); player.addStat(TheAchievements.OPEN_TREASURE_CHEST.ach, 1);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
@ -154,23 +154,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){
Random rand = new Random(); for(int i = 0; i < MathHelper.getRandomIntegerInRange(world.rand, 3, 6); i++){
for(int i = 0; i < MathHelper.getRandomIntegerInRange(rand, 3, 6); i++){ TreasureChestHandler.Return theReturn = (TreasureChestHandler.Return)WeightedRandom.getRandomItem(world.rand, TreasureChestHandler.returns);
TreasureChestHandler.Return theReturn = (TreasureChestHandler.Return)WeightedRandom.getRandomItem(rand, TreasureChestHandler.returns);
ItemStack itemStack = theReturn.returnItem.copy(); ItemStack itemStack = theReturn.returnItem.copy();
itemStack.stackSize = MathHelper.getRandomIntegerInRange(rand, theReturn.minAmount, theReturn.maxAmount); itemStack.stackSize = MathHelper.getRandomIntegerInRange(world.rand, theReturn.minAmount, theReturn.maxAmount);
float dX = rand.nextFloat()*0.8F+0.1F; float dX = world.rand.nextFloat()*0.8F+0.1F;
float dY = rand.nextFloat()*0.8F+0.1F; float dY = world.rand.nextFloat()*0.8F+0.1F;
float dZ = rand.nextFloat()*0.8F+0.1F; float dZ = world.rand.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 = rand.nextGaussian()*factor; entityItem.motionX = world.rand.nextGaussian()*factor;
entityItem.motionY = rand.nextGaussian()*factor+0.2F; entityItem.motionY = world.rand.nextGaussian()*factor+0.2F;
entityItem.motionZ = rand.nextGaussian()*factor; entityItem.motionZ = world.rand.nextGaussian()*factor;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0; itemStack.stackSize = 0;
} }

View file

@ -24,8 +24,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import java.util.Random;
public class RenderSmileyCloud extends RenderTileEntity{ public class RenderSmileyCloud extends RenderTileEntity{
private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png"); private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png");
@ -44,7 +42,7 @@ public class RenderSmileyCloud extends RenderTileEntity{
GL11.glPushMatrix(); GL11.glPushMatrix();
{ {
if(theCloud.flyHeight == 0){ if(theCloud.flyHeight == 0){
theCloud.flyHeight = new Random().nextInt(30)+30; theCloud.flyHeight = tile.getWorldObj().rand.nextInt(30)+30;
} }
int bobHeight = theCloud.flyHeight; int bobHeight = theCloud.flyHeight;
long theTime = Minecraft.getSystemTime(); long theTime = Minecraft.getSystemTime();

View file

@ -21,7 +21,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import java.util.Random;
import java.util.UUID; import java.util.UUID;
public class EntityLivingEvent{ public class EntityLivingEvent{
@ -32,7 +31,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(new Random().nextInt(ConfigIntValues.CAT_DROP_CHANCE.getValue())+1 == 1){ if(event.entityLiving.worldObj.rand.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

@ -23,8 +23,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import java.util.Random;
public class LivingDropEvent{ public class LivingDropEvent{
@SubscribeEvent @SubscribeEvent
@ -34,23 +32,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(new Random().nextInt(100)+1 <= theDrop.chance){ if(event.entityLiving.worldObj.rand.nextInt(100)+1 <= theDrop.chance){
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSpecialDrop, new Random().nextInt(theDrop.maxAmount)+1, theDrop.ordinal()), 0); event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSpecialDrop, event.entityLiving.worldObj.rand.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(new Random().nextInt(ConfigIntValues.SPIDER_DROP_CHANCE.getValue()) <= 0){ if(event.entityLiving.worldObj.rand.nextInt(ConfigIntValues.SPIDER_DROP_CHANCE.getValue()) <= 0){
event.entityLiving.entityDropItem(new ItemStack(Blocks.web, new Random().nextInt(2)+1), 0); event.entityLiving.entityDropItem(new ItemStack(Blocks.web, event.entityLiving.worldObj.rand.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(new Random().nextInt(ConfigIntValues.BAT_DROP_CHANCE.getValue()) <= 0){ if(event.entityLiving.worldObj.rand.nextInt(ConfigIntValues.BAT_DROP_CHANCE.getValue()) <= 0){
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemMisc, new Random().nextInt(2)+1, TheMiscItems.BAT_WING.ordinal()), 0); event.entityLiving.entityDropItem(new ItemStack(InitItems.itemMisc, event.entityLiving.worldObj.rand.nextInt(2)+1, TheMiscItems.BAT_WING.ordinal()), 0);
} }
} }
} }

View file

@ -30,7 +30,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random;
public class ItemGrowthRing extends ItemEnergy{ public class ItemGrowthRing extends ItemEnergy{
@ -74,7 +73,7 @@ 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(new Random().nextInt(blocks.size())); WorldPos pos = blocks.get(world.rand.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(), world.rand);

View file

@ -25,27 +25,25 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.Random;
public class ItemHairyBall extends Item implements IActAddItemOrBlock{ public class ItemHairyBall extends Item implements IActAddItemOrBlock{
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
if(!world.isRemote){ if(!world.isRemote){
ItemStack returnItem = this.getRandomReturnItem(); ItemStack returnItem = this.getRandomReturnItem(world);
if(!player.inventory.addItemStackToInventory(returnItem)){ if(!player.inventory.addItemStackToInventory(returnItem)){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem); EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem);
entityItem.delayBeforeCanPickup = 0; entityItem.delayBeforeCanPickup = 0;
player.worldObj.spawnEntityInWorld(entityItem); player.worldObj.spawnEntityInWorld(entityItem);
} }
stack.stackSize--; stack.stackSize--;
world.playSoundAtEntity(player, "random.pop", 0.2F, new Random().nextFloat()*0.1F+0.9F); world.playSoundAtEntity(player, "random.pop", 0.2F, world.rand.nextFloat()*0.1F+0.9F);
} }
return stack; return stack;
} }
public ItemStack getRandomReturnItem(){ public ItemStack getRandomReturnItem(World world){
return ((HairyBallHandler.Return)WeightedRandom.getRandomItem(new Random(), HairyBallHandler.returns)).returnItem.copy(); return ((HairyBallHandler.Return)WeightedRandom.getRandomItem(world.rand, HairyBallHandler.returns)).returnItem.copy();
} }
@Override @Override

View file

@ -19,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import java.util.List; import java.util.List;
import java.util.Random;
public class TileEntityFeeder extends TileEntityInventoryBase{ public class TileEntityFeeder extends TileEntityInventoryBase{
@ -45,7 +44,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(new Random().nextInt(this.currentAnimalAmount)); EntityAnimal randomAnimal = animals.get(worldObj.rand.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,12 +83,11 @@ 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);
Random rand = new Random();
for(int i = 0; i < 7; i++){ for(int i = 0; i < 7; i++){
double d = rand.nextGaussian()*0.02D; double d = animal.worldObj.rand.nextGaussian()*0.02D;
double d1 = rand.nextGaussian()*0.02D; double d1 = animal.worldObj.rand.nextGaussian()*0.02D;
double d2 = rand.nextGaussian()*0.02D; double d2 = animal.worldObj.rand.nextGaussian()*0.02D;
worldObj.spawnParticle("heart", (animal.posX+(double)(rand.nextFloat()*animal.width*2.0F))-animal.width, animal.posY+0.5D+(double)(rand.nextFloat()*animal.height), (animal.posZ+(double)(rand.nextFloat()*animal.width*2.0F))-animal.width, d, d1, d2); 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);
} }
} }

View file

@ -21,8 +21,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.FishingHooks; import net.minecraftforge.common.FishingHooks;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.Random;
public class TileEntityFishingNet extends TileEntityBase{ public class TileEntityFishingNet extends TileEntityBase{
public int timeUntilNextDrop; public int timeUntilNextDrop;
@ -42,11 +40,10 @@ public class TileEntityFishingNet extends TileEntityBase{
if(!worldObj.isRemote){ if(!worldObj.isRemote){
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
if(worldObj.getBlock(xCoord, yCoord-1, zCoord).getMaterial() == Material.water){ if(worldObj.getBlock(xCoord, yCoord-1, zCoord).getMaterial() == Material.water){
Random rand = new Random();
if(this.timeUntilNextDrop > 0){ if(this.timeUntilNextDrop > 0){
this.timeUntilNextDrop--; this.timeUntilNextDrop--;
if(timeUntilNextDrop <= 0){ if(timeUntilNextDrop <= 0){
ItemStack fishable = FishingHooks.getRandomFishable(rand, this.worldObj.rand.nextFloat()); ItemStack fishable = FishingHooks.getRandomFishable(worldObj.rand, this.worldObj.rand.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);
@ -59,7 +56,7 @@ public class TileEntityFishingNet extends TileEntityBase{
} }
} }
else{ else{
this.timeUntilNextDrop = ConfigIntValues.FISHER_TIME.getValue()+rand.nextInt(ConfigIntValues.FISHER_TIME.getValue()/2); this.timeUntilNextDrop = ConfigIntValues.FISHER_TIME.getValue()+worldObj.rand.nextInt(ConfigIntValues.FISHER_TIME.getValue()/2);
} }
} }
} }

View file

@ -18,8 +18,6 @@ import net.minecraft.block.IGrowable;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import java.util.Random;
public class TileEntityGreenhouseGlass extends TileEntityBase{ public class TileEntityGreenhouseGlass extends TileEntityBase{
private int timeUntilNextFert; private int timeUntilNextFert;
@ -42,7 +40,7 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
} }
} }
else{ else{
this.timeUntilNextFert = ConfigIntValues.GLASS_TIME_NEEDED.getValue()+new Random().nextInt(ConfigIntValues.GLASS_TIME_NEEDED.getValue()); this.timeUntilNextFert = ConfigIntValues.GLASS_TIME_NEEDED.getValue()+this.worldObj.rand.nextInt(ConfigIntValues.GLASS_TIME_NEEDED.getValue());
} }
} }
} }

View file

@ -22,7 +22,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random;
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{
@ -178,7 +177,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 = new Random().nextInt(100)+1; int rand = this.worldObj.rand.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

@ -21,7 +21,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random;
public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider{ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider{
@ -46,9 +45,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();
Random rand = new Random(); if(worldObj.rand.nextInt(ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue()) == 0){
if(rand.nextInt(ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue()) == 0){ int randomSide = blocksAround.get(worldObj.rand.nextInt(blocksAround.size()));
int randomSide = blocksAround.get(rand.nextInt(blocksAround.size()));
WorldUtil.breakBlockAtSide(WorldUtil.getDirectionBySidesInOrder(randomSide), worldObj, xCoord, yCoord, zCoord); WorldUtil.breakBlockAtSide(WorldUtil.getDirectionBySidesInOrder(randomSide), worldObj, xCoord, yCoord, zCoord);
} }
} }