improved mushroom physics, UFFR assets, ducrete

This commit is contained in:
Boblet 2021-08-24 13:18:09 +02:00
parent 574c46995c
commit 0dca95c044
23 changed files with 307 additions and 197 deletions

View File

@ -263,8 +263,9 @@ public class ModBlocks {
public static Block gravel_diamond;
public static Block asphalt;
public static Block asphalt_light;
public static Block reinforced_brick;
public static Block reinforced_ducrete;
public static Block reinforced_glass;
public static Block reinforced_light;
public static Block reinforced_sand;
@ -283,12 +284,15 @@ public class ModBlocks {
public static Block concrete_colored;
public static Block concrete;
public static Block concrete_asbestos;
public static Block ducrete_smooth;
public static Block ducrete;
public static Block concrete_pillar;
public static Block brick_concrete;
public static Block brick_concrete_mossy;
public static Block brick_concrete_cracked;
public static Block brick_concrete_broken;
public static Block brick_concrete_marked;
public static Block brick_ducrete;
public static Block brick_obsidian;
public static Block brick_light;
public static Block brick_compound;
@ -376,6 +380,7 @@ public class ModBlocks {
public static Block sand_lead;
public static Block sand_uranium;
public static Block sand_polonium;
public static Block sand_quartz;
public static Block sand_gold;
public static Block ash_digamma;
public static Block glass_boron;
@ -384,6 +389,8 @@ public class ModBlocks {
public static Block glass_trinitite;
public static Block glass_polonium;
public static Block glass_ash;
public static Block glass_quartz;
public static Block mush;
public static Block mush_block;
@ -1410,6 +1417,12 @@ public class ModBlocks {
cmb_brick_reinforced = new BlockGeneric(Material.rock).setBlockName("cmb_brick_reinforced").setCreativeTab(MainRegistry.blockTab).setHardness(25.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":cmb_brick_reinforced");
brick_asbestos = new BlockOutgas(Material.rock, true, 5, true).addAsbestos().toBlock().setBlockName("brick_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_asbestos");
ducrete_smooth = new BlockGeneric(Material.rock).setBlockName("ducrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(20.0F).setResistance(8000.0F).setBlockTextureName(RefStrings.MODID + ":ducrete");
ducrete = new BlockGeneric(Material.rock).setBlockName("ducrete").setCreativeTab(MainRegistry.blockTab).setHardness(20.0F).setResistance(8000.0F).setBlockTextureName(RefStrings.MODID + ":ducrete_tile");
brick_ducrete = new BlockGeneric(Material.rock).setBlockName("brick_ducrete").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(12000.0F).setBlockTextureName(RefStrings.MODID + ":brick_ducrete");
reinforced_ducrete = new BlockGeneric(Material.rock).setBlockName("reinforced_ducrete").setCreativeTab(MainRegistry.blockTab).setHardness(20.0F).setResistance(24000.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_ducrete");
tile_lab = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab");
tile_lab_cracked = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab_cracked").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_cracked");
tile_lab_broken = new BlockOutgas(Material.rock, true, 5, true).addAsbestos().toBlock().setBlockName("tile_lab_broken").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_broken");
@ -1490,6 +1503,7 @@ public class ModBlocks {
sand_lead = new BlockFalling(Material.sand).setBlockName("sand_lead").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_lead");
sand_uranium = new BlockFalling(Material.sand).setBlockName("sand_uranium").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_uranium");
sand_polonium = new BlockFalling(Material.sand).setBlockName("sand_polonium").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_polonium");
sand_quartz = new BlockFalling(Material.sand).setBlockName("sand_quartz").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_quartz");
sand_gold = new BlockGoldSand(Material.sand).setBlockName("sand_gold").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_gold");
glass_boron = new BlockNTMGlass(0, RefStrings.MODID + ":glass_boron", Material.glass).setBlockName("glass_boron").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F);
glass_lead = new BlockNTMGlass(0, RefStrings.MODID + ":glass_lead", Material.glass).setBlockName("glass_lead").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F);
@ -1497,7 +1511,8 @@ public class ModBlocks {
glass_trinitite = new BlockNTMGlass(1, RefStrings.MODID + ":glass_trinitite", Material.glass).setBlockName("glass_trinitite").setLightLevel(5F/15F).setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F);
glass_polonium = new BlockNTMGlass(1, RefStrings.MODID + ":glass_polonium", Material.glass).setBlockName("glass_polonium").setLightLevel(5F/15F).setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F);
glass_ash = new BlockNTMGlass(1, RefStrings.MODID + ":glass_ash", Material.glass).setBlockName("glass_ash").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(3F);
glass_quartz = new BlockNTMGlass(0, RefStrings.MODID + ":glass_quartz", Material.packedIce, true).setBlockName("glass_quartz").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGlass).setHardness(1.0F).setResistance(40.0F).setBlockTextureName(RefStrings.MODID + "glass_quartz");
mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush");
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
@ -2306,7 +2321,7 @@ public class ModBlocks {
GameRegistry.registerBlock(deco_rbmk_smooth, deco_rbmk_smooth.getUnlocalizedName());
//Gravel
GameRegistry.registerBlock(gravel_obsidian, gravel_obsidian.getUnlocalizedName());
GameRegistry.registerBlock(gravel_obsidian, ItemBlockBlastInfo.class, gravel_obsidian.getUnlocalizedName());
GameRegistry.registerBlock(gravel_diamond, ItemBlockLore.class, gravel_diamond.getUnlocalizedName());
//Lamps
@ -2317,35 +2332,39 @@ public class ModBlocks {
GameRegistry.registerBlock(lamp_demon, ItemBlockHazard.class, lamp_demon.getUnlocalizedName());
//Reinforced Blocks
GameRegistry.registerBlock(asphalt, asphalt.getUnlocalizedName());
GameRegistry.registerBlock(asphalt_light, asphalt_light.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_brick, reinforced_brick.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_glass, reinforced_glass.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_light, reinforced_light.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_sand, reinforced_sand.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_lamp_off, reinforced_lamp_off.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_lamp_on, reinforced_lamp_on.getUnlocalizedName());
GameRegistry.registerBlock(asphalt, ItemBlockBlastInfo.class, asphalt.getUnlocalizedName());
GameRegistry.registerBlock(asphalt_light, ItemBlockBlastInfo.class, asphalt_light.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_brick, ItemBlockBlastInfo.class, reinforced_brick.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_glass, ItemBlockBlastInfo.class, reinforced_glass.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_light, ItemBlockBlastInfo.class, reinforced_light.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_sand, ItemBlockBlastInfo.class, reinforced_sand.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_lamp_off, ItemBlockBlastInfo.class, reinforced_lamp_off.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_lamp_on, ItemBlockBlastInfo.class, reinforced_lamp_on.getUnlocalizedName());
//Bricks
GameRegistry.registerBlock(reinforced_stone, reinforced_stone.getUnlocalizedName());
GameRegistry.registerBlock(concrete_smooth, concrete_smooth.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_stone, ItemBlockBlastInfo.class, reinforced_stone.getUnlocalizedName());
GameRegistry.registerBlock(reinforced_ducrete, ItemBlockBlastInfo.class, reinforced_ducrete.getUnlocalizedName());
GameRegistry.registerBlock(concrete_smooth, ItemBlockBlastInfo.class, concrete_smooth.getUnlocalizedName());
GameRegistry.registerBlock(concrete_colored, ItemBlockColored.class, concrete_colored.getUnlocalizedName());
GameRegistry.registerBlock(concrete, concrete.getUnlocalizedName());
GameRegistry.registerBlock(concrete_asbestos, concrete_asbestos.getUnlocalizedName());
GameRegistry.registerBlock(concrete_pillar, concrete_pillar.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete, brick_concrete.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_mossy, brick_concrete_mossy.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_cracked, brick_concrete_cracked.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_broken, brick_concrete_broken.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_marked, brick_concrete_marked.getUnlocalizedName());
GameRegistry.registerBlock(brick_obsidian, brick_obsidian.getUnlocalizedName());
GameRegistry.registerBlock(brick_compound, brick_compound.getUnlocalizedName());
GameRegistry.registerBlock(brick_light, brick_light.getUnlocalizedName());
GameRegistry.registerBlock(concrete, ItemBlockBlastInfo.class, concrete.getUnlocalizedName());
GameRegistry.registerBlock(concrete_asbestos, ItemBlockBlastInfo.class, concrete_asbestos.getUnlocalizedName());
GameRegistry.registerBlock(ducrete_smooth, ItemBlockBlastInfo.class, ducrete_smooth.getUnlocalizedName());
GameRegistry.registerBlock(ducrete, ItemBlockBlastInfo.class, ducrete.getUnlocalizedName());
GameRegistry.registerBlock(concrete_pillar, ItemBlockBlastInfo.class, concrete_pillar.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete, ItemBlockBlastInfo.class, brick_concrete.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_mossy, ItemBlockBlastInfo.class, brick_concrete_mossy.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_cracked, ItemBlockBlastInfo.class, brick_concrete_cracked.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_broken, ItemBlockBlastInfo.class, brick_concrete_broken.getUnlocalizedName());
GameRegistry.registerBlock(brick_concrete_marked, ItemBlockBlastInfo.class, brick_concrete_marked.getUnlocalizedName());
GameRegistry.registerBlock(brick_ducrete, ItemBlockBlastInfo.class, brick_ducrete.getUnlocalizedName());
GameRegistry.registerBlock(brick_obsidian, ItemBlockBlastInfo.class, brick_obsidian.getUnlocalizedName());
GameRegistry.registerBlock(brick_compound, ItemBlockBlastInfo.class, brick_compound.getUnlocalizedName());
GameRegistry.registerBlock(brick_light, ItemBlockBlastInfo.class, brick_light.getUnlocalizedName());
GameRegistry.registerBlock(brick_asbestos, ItemBlockHazard.class, brick_asbestos.getUnlocalizedName());
//CMB Building Elements
GameRegistry.registerBlock(cmb_brick, cmb_brick.getUnlocalizedName());
GameRegistry.registerBlock(cmb_brick_reinforced, cmb_brick_reinforced.getUnlocalizedName());
GameRegistry.registerBlock(cmb_brick, ItemBlockBlastInfo.class, cmb_brick.getUnlocalizedName());
GameRegistry.registerBlock(cmb_brick_reinforced, ItemBlockBlastInfo.class, cmb_brick_reinforced.getUnlocalizedName());
//Tiles
GameRegistry.registerBlock(tile_lab, ItemBlockHazard.class, tile_lab.getUnlocalizedName());
@ -2548,6 +2567,7 @@ public class ModBlocks {
GameRegistry.registerBlock(sand_lead, sand_lead.getUnlocalizedName());
GameRegistry.registerBlock(sand_uranium, sand_uranium.getUnlocalizedName());
GameRegistry.registerBlock(sand_polonium, sand_polonium.getUnlocalizedName());
GameRegistry.registerBlock(sand_quartz, sand_quartz.getUnlocalizedName());
GameRegistry.registerBlock(sand_gold, sand_gold.getUnlocalizedName());
GameRegistry.registerBlock(glass_boron, glass_boron.getUnlocalizedName());
GameRegistry.registerBlock(glass_lead, glass_lead.getUnlocalizedName());
@ -2555,6 +2575,7 @@ public class ModBlocks {
GameRegistry.registerBlock(glass_trinitite, glass_trinitite.getUnlocalizedName());
GameRegistry.registerBlock(glass_polonium, glass_polonium.getUnlocalizedName());
GameRegistry.registerBlock(glass_ash, glass_ash.getUnlocalizedName());
GameRegistry.registerBlock(glass_quartz, glass_quartz.getUnlocalizedName());
//Silo Hatch
GameRegistry.registerBlock(seal_frame, seal_frame.getUnlocalizedName());

View File

@ -1,7 +1,9 @@
package com.hbm.blocks.generic;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.main.MainRegistry;
@ -11,131 +13,201 @@ import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockMush extends Block implements IGrowable {
public class BlockMush extends Block implements IGrowable, IPlantable {
public BlockMush(Material p_i45394_1_) {
super(p_i45394_1_);
float f = 0.2F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
float f = 0.2F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.setTickRandomly(true);
}
protected boolean canPlaceBlockOn(Block block) {
return block.func_149730_j();
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
}
@Override
public boolean canBlockStay(World world, int x, int y, int z) {
if(y >= 0 && y < 256) {
Block block = world.getBlock(x, y - 1, z);
return block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this) || canMushGrowHere(world, x, y, z);
} else {
return false;
}
}
protected boolean canPlaceBlockOn(Block p_149854_1_)
{
return p_149854_1_.func_149730_j();
}
@Override
public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.canBlockStay(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);
}
@Override
public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
{
if (p_149718_3_ >= 0 && p_149718_3_ < 256)
{
Block block = p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
return block == ModBlocks.waste_earth || block == ModBlocks.waste_mycelium;
}
else
{
return false;
}
}
private static final Set<Block> canGrowOn = Sets.newHashSet(new Block[] {
ModBlocks.waste_earth,
ModBlocks.waste_mycelium,
ModBlocks.waste_trinitite,
ModBlocks.waste_trinitite_red,
ModBlocks.block_waste,
ModBlocks.block_waste_painted,
ModBlocks.block_waste_vitrified
});
public boolean canMushGrowHere(World world, int x, int y, int z) {
Block block = world.getBlock(x, y - 1, z);
return canGrowOn.contains(block);
}
public boolean func_149884_c(World p_149884_1_, int p_149884_2_, int p_149884_3_, int p_149884_4_, Random p_149884_5_)
{
p_149884_1_.getBlockMetadata(p_149884_2_, p_149884_3_, p_149884_4_);
p_149884_1_.setBlockToAir(p_149884_2_, p_149884_3_, p_149884_4_);
HugeMush worldgenbigmushroom = null;
public boolean growHuge(World world, int x, int y, int z, Random rand) {
world.getBlockMetadata(x, y, z);
world.setBlockToAir(x, y, z);
(new HugeMush()).generate(world, rand, x, y, z);
worldgenbigmushroom = new HugeMush();
worldgenbigmushroom.generate(p_149884_1_, p_149884_5_, p_149884_2_, p_149884_3_, p_149884_4_);
return true;
}
return true;
}
@Override
public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_)
{
return true;
}
/**
* General grow condition ("has space?")
*/
@Override
public boolean func_149851_a(World world, int x, int y, int z, boolean b) {
return this.canMushGrowHere(world, x, y, z);
}
@Override
public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_)
{
return p_149852_2_.nextFloat() < 0.4D;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
/**
* Grow chance (40%)
*/
@Override
public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) {
return p_149852_2_.nextFloat() < 0.4D;
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
@Override
public boolean isOpaqueCube()
{
return false;
}
/**
* On successful bonemeal grow
*/
@Override
public void func_149853_b(World world, Random rand, int x, int y, int z) {
this.growHuge(world, x, y, z, rand);
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
/**
* The type of render function that is called for this block
*/
@Override
public int getRenderType()
{
return 1;
}
@Override
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
{
super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);
this.checkAndDropBlock(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_);
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether
* or not to render the shared face of two adjacent blocks and also whether
* the player can attach torches, redstone wire, etc to this block.
*/
@Override
public boolean isOpaqueCube() {
return false;
}
/**
* checks if the block can stay, if not drop as item
*/
protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_)
{
if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_))
{
this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_), 0);
p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 2);
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand)
{
this.checkAndDropBlock(world, x, y, z);
if(GeneralConfig.enableMycelium && world.getBlock(x, y - 1, z) == ModBlocks.waste_earth && rand.nextInt(5) == 0)
{
world.setBlock(x, y - 1, z, ModBlocks.waste_mycelium);
}
}
/**
* If this block doesn't render as an ordinary block it will return False
* (examples: signs, buttons, stairs, etc)
*/
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_)
{
this.func_149884_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, p_149853_2_);
}
/**
* The type of render function that is called for this block
*/
@Override
public int getRenderType() {
return 1;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
super.onNeighborBlockChange(world, x, y, z, b);
this.checkAndDropBlock(world, x, y, z);
}
/**
* checks if the block can stay, if not drop as item
*/
protected void checkAndDropBlock(World world, int x, int y, int z) {
if(!this.canBlockStay(world, x, y, z)) {
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
this.checkAndDropBlock(world, x, y, z);
if(GeneralConfig.enableMycelium && world.getBlock(x, y - 1, z) == ModBlocks.waste_earth && rand.nextInt(5) == 0) {
world.setBlock(x, y - 1, z, ModBlocks.waste_mycelium);
}
if(rand.nextInt(25) == 0) {
byte range = 4;
int maxShroom = 3;
int ix;
int iy;
int iz;
for(ix = x - range; ix <= x + range; ++ix) {
for(iy = y - range; iy <= y + range; ++iy) {
for(iz = z - 1; iz <= z + 1; ++iz) {
if(world.getBlock(ix, iz, iy) == this) {
--maxShroom;
if(maxShroom <= 0) {
return;
}
}
}
}
}
ix = x + rand.nextInt(5) - 2;
iy = z + rand.nextInt(2) - rand.nextInt(2);
iz = y + rand.nextInt(5) - 2;
for(int l1 = 0; l1 < 4; ++l1) {
if(world.isAirBlock(ix, iy, iz) && this.canMushGrowHere(world, ix, iy, iz)) {
x = ix;
z = iy;
y = iz;
}
ix = x + rand.nextInt(5) - 2;
iy = z + rand.nextInt(2) - rand.nextInt(2);
iz = y + rand.nextInt(5) - 2;
}
if(world.isAirBlock(ix, iy, iz) && this.canMushGrowHere(world, ix, iy, iz)) {
world.setBlock(ix, iy, iz, this, 0, 2);
}
}
}
@Override
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) {
return this;
}
@Override
public int getPlantMetadata(IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x, y, z);
}
}

View File

@ -8,29 +8,35 @@ import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
public class BlockNTMGlass extends BlockBreakable {
int renderLayer;
boolean doesDrop = false;
public BlockNTMGlass(int layer, String name, Material material) {
this(layer, name, material, false);
}
public BlockNTMGlass(int layer, String name, Material material, boolean doesDrop) {
super(name, material, false);
this.renderLayer = layer;
this.doesDrop = doesDrop;
}
public int quantityDropped(Random rand) {
return doesDrop ? 1 : 0;
}
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return renderLayer;
}
public boolean renderAsNormalBlock() {
return false;
}
protected boolean canSilkHarvest() {
return true;
}
public int quantityDropped(Random rand) {
return 0;
}
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return renderLayer;
}
public boolean renderAsNormalBlock() {
return false;
}
protected boolean canSilkHarvest() {
return true;
}
}

View File

@ -22,7 +22,11 @@ import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
public class WasteEarth extends Block {
@ -92,23 +96,6 @@ public class WasteEarth extends Block {
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if((this == ModBlocks.waste_earth || this == ModBlocks.waste_mycelium) && world.getBlock(x, y + 1, z) == Blocks.air && rand.nextInt(1000) == 0) {
Block b0;
int count = 0;
for(int i = -5; i < 5; i++) {
for(int j = -5; j < 6; j++) {
for(int k = -5; k < 5; k++) {
b0 = world.getBlock(x + i, y + j, z + k);
if((b0 instanceof BlockMushroom) || b0 == ModBlocks.mush) {
count++;
}
}
}
}
if(count > 0 && count < 5)
world.setBlock(x, y + 1, z, ModBlocks.mush);
}
if(this == ModBlocks.waste_mycelium && GeneralConfig.enableMycelium) {
for(int i = -1; i < 2; i++) {
for(int j = -1; j < 2; j++) {
@ -121,35 +108,26 @@ public class WasteEarth extends Block {
}
}
}
if(rand.nextInt(10) == 0) {
Block b0;
int count = 0;
for(int i = -5; i < 5; i++) {
for(int j = -5; j < 6; j++) {
for(int k = -5; k < 5; k++) {
b0 = world.getBlock(x + i, y + j, z + k);
if(b0 == ModBlocks.mush) {
count++;
}
}
}
}
if(count < 5)
world.setBlock(x, y + 1, z, ModBlocks.mush);
}
}
if(this == ModBlocks.waste_earth || this == ModBlocks.waste_mycelium) {
if(!world.isRemote) {
if(world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2) {
world.setBlock(x, y, z, Blocks.dirt);
}
if(GeneralConfig.enableAutoCleanup || (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)) {
world.setBlock(x, y, z, Blocks.dirt);
} else if(world.getBlock(x, y + 1, z) instanceof BlockMushroom) {
world.setBlock(x, y + 1, z, ModBlocks.mush);
}
}
if(GeneralConfig.enableAutoCleanup && (this == ModBlocks.waste_earth | this == ModBlocks.waste_mycelium))
if(!world.isRemote)
world.setBlock(x, y, z, Blocks.dirt);
}
@Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
if(this == ModBlocks.waste_earth || this == ModBlocks.waste_mycelium) {
return plantable.getPlantType(world, x, y, z) == EnumPlantType.Cave;
}
return false;
}
}

View File

@ -318,6 +318,7 @@ public class ModItems {
public static Item crystal_lithium;
public static Item crystal_cobalt;
public static Item crystal_starmetal;
public static Item crystal_cinnebar;
public static Item crystal_trixite;
public static Item gem_tantalium;
@ -2689,6 +2690,7 @@ public class ModItems {
crystal_lithium = new ItemHazard().addHydroReactivity().toItem().setUnlocalizedName("crystal_lithium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_lithium");
crystal_cobalt = new Item().setUnlocalizedName("crystal_cobalt").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_cobalt");
crystal_starmetal = new Item().setUnlocalizedName("crystal_starmetal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_starmetal");
crystal_cinnebar = new Item().setUnlocalizedName("crystal_cinnebar").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_cinnebar");
crystal_trixite = new ItemHazard().addRadiation(ItemHazard.trx * ItemHazard.crystal).toItem().setUnlocalizedName("crystal_trixite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":crystal_trixite");
gem_tantalium = new ItemCustomLore().setUnlocalizedName("gem_tantalium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gem_tantalium");
gem_volcanic = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("gem_volcanic").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":gem_volcanic");
@ -5568,6 +5570,7 @@ public class ModItems {
GameRegistry.registerItem(crystal_lithium, crystal_lithium.getUnlocalizedName());
GameRegistry.registerItem(crystal_cobalt, crystal_cobalt.getUnlocalizedName());
GameRegistry.registerItem(crystal_starmetal, crystal_starmetal.getUnlocalizedName());
GameRegistry.registerItem(crystal_cinnebar, crystal_cinnebar.getUnlocalizedName());
GameRegistry.registerItem(crystal_trixite, crystal_trixite.getUnlocalizedName());
GameRegistry.registerItem(gem_tantalium, gem_tantalium.getUnlocalizedName());
GameRegistry.registerItem(gem_volcanic, gem_volcanic.getUnlocalizedName());

View File

@ -0,0 +1,29 @@
package com.hbm.items.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class ItemBlockBlastInfo extends ItemBlock {
public ItemBlockBlastInfo(Block block) {
super(block);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
Item item = stack.getItem();
Block block = Block.getBlockFromItem(item);
if(block == null)
return;
list.add(EnumChatFormatting.GOLD + "Blast Resistance: " + block.getExplosionResistance(null));
}
}

View File

@ -7,7 +7,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
public class ItemBlockColored extends ItemBlock {
public class ItemBlockColored extends ItemBlockBlastInfo {
public ItemBlockColored(Block block) {
super(block);

View File

@ -655,7 +655,8 @@ public class CraftingManager {
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.sand_polonium, 8), new Object[] { "sand", "sand", "sand", "sand", "sand", "sand", "sand", "sand", "dustPolonium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.sand_boron, 8), new Object[] { "sand", "sand", "sand", "sand", "sand", "sand", "sand", "sand", "dustBoron" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.sand_lead, 8), new Object[] { "sand", "sand", "sand", "sand", "sand", "sand", "sand", "sand", "dustLead" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.sand_quartz, 1), new Object[] { "sand", "sand", "dustNetherQuartz", "dustNetherQuartz" }));
GameRegistry.addRecipe(new ItemStack(ModItems.rune_blank, 1), new Object[] { "PSP", "SDS", "PSP", 'P', ModItems.powder_magic, 'S', ModItems.ingot_starmetal, 'D', ModItems.dynosphere_dineutronium_charged });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_isa, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity_counter_resonant });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_dagaz, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity });

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB