mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Made Treasure Chests have to be right-clicked to drop something
This commit is contained in:
parent
543a3f652b
commit
33cdd6f198
2 changed files with 6 additions and 18 deletions
|
@ -36,8 +36,8 @@ public class BlockTreasureChest extends Block implements INameableItem{
|
|||
public BlockTreasureChest(){
|
||||
super(Material.wood);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(10.0F);
|
||||
this.setHardness(300.0F);
|
||||
this.setResistance(50.0F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
@ -99,17 +99,6 @@ public class BlockTreasureChest extends Block implements INameableItem{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta){
|
||||
player.addStat(TheAchievements.OPEN_TREASURE_CHEST.ach, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z){
|
||||
Random rand = new Random();
|
||||
for(int i = 0; i < MathHelper.getRandomIntegerInRange(rand, 3, 6); i++){
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.world.biome.BiomeGenOcean;
|
|||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class WorldDecorationEvent{
|
||||
|
||||
|
@ -27,7 +26,7 @@ public class WorldDecorationEvent{
|
|||
|
||||
//Generate Treasure Chests
|
||||
if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
|
||||
if(new Random().nextInt(ConfigIntValues.TREASURE_CHEST_CHANCE.getValue()) == 0){
|
||||
if(event.rand.nextInt(ConfigIntValues.TREASURE_CHEST_CHANCE.getValue()) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ);
|
||||
|
@ -36,7 +35,7 @@ public class WorldDecorationEvent{
|
|||
if(genY >= ConfigIntValues.TREASURE_CHEST_MIN_HEIGHT.getValue() && genY <= ConfigIntValues.TREASURE_CHEST_MAX_HEIGHT.getValue()){
|
||||
if(event.world.getBlock(genX, genY, genZ).getMaterial() == Material.water){
|
||||
if(event.world.getBlock(genX, genY-1, genZ).getMaterial().isSolid()){
|
||||
event.world.setBlock(genX, genY, genZ, InitBlocks.blockTreasureChest, 0, 2);
|
||||
event.world.setBlock(genX, genY, genZ, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +48,7 @@ public class WorldDecorationEvent{
|
|||
private void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
|
||||
if(doIt){
|
||||
for(int i = 0; i < amount; i++){
|
||||
if(new Random().nextInt(ConfigIntValues.NORMAL_PLANT_CHANCE.getValue()) == 0){
|
||||
if(event.rand.nextInt(ConfigIntValues.NORMAL_PLANT_CHANCE.getValue()) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ)-1;
|
||||
|
@ -65,7 +64,7 @@ public class WorldDecorationEvent{
|
|||
private void generateRice(DecorateBiomeEvent event){
|
||||
if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
|
||||
for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
|
||||
if(new Random().nextInt(ConfigIntValues.RICE_CHANCE.getValue()) == 0){
|
||||
if(event.rand.nextInt(ConfigIntValues.RICE_CHANCE.getValue()) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ);
|
||||
|
|
Loading…
Reference in a new issue