Permalink
Browse files

Added Tree Ferns, Refactored Ground Fern a bit (Added TileEntityPlant)

  • Loading branch information...
Ri5ux committed Oct 28, 2018
1 parent d672d65 commit 9d1e9adbe9bddd6e43f5cff350290ce87f8d3c76
@@ -41,6 +41,7 @@
import org.avp.block.BlockSupplyCrate;
import org.avp.block.BlockTempleSpawner;
import org.avp.block.BlockTransformer;
import org.avp.block.BlockTreeFern;
import org.avp.block.BlockTurret;
import org.avp.block.BlockUnidentifiedDirt;
import org.avp.block.BlockUnidentifiedLog;
@@ -178,6 +179,7 @@
public static final Block paradiseLeavesSmall = new BlockParadiseTreeLeaves().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_leaves_small").setCreativeTab(Tab.BLOCKS);
public static final Block paradiseLogSmall = new BlockParadiseLog().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_log_small").setCreativeTab(Tab.BLOCKS);
public static final Block groundFern = new BlockGroundFern().setHardness(5.0F).setResistance(10.0F).setCreativeTab(Tab.BLOCKS).setRegistryName("paradisian_ground_fern");
public static final Block treeFern = new BlockTreeFern().setHardness(5.0F).setResistance(10.0F).setCreativeTab(Tab.BLOCKS).setRegistryName("paradisian_tree_fern");
/** Varda **/
public static final Block gigerLog = new BlockUnidentifiedLog().setHardness(5F).setLightOpacity(0).setCreativeTab(Tab.BLOCKS).setRegistryName("unitree.wood");
@@ -97,6 +97,7 @@
import org.avp.tile.TileEntityTurret;
import org.avp.tile.TileEntityWorkstation;
import org.avp.tile.plants.TileEntityGroundFern;
import org.avp.tile.plants.TileEntityTreeFern;
import org.avp.world.dimension.acheron.BiomeAcheron;
import org.avp.world.dimension.varda.BiomeVarda;
@@ -313,6 +314,7 @@ public void registerTileEntities()
GameRegistry.registerTileEntity(TileEntityRedstoneFluxGenerator.class, new ResourceLocation(AliensVsPredator.Properties.ID, "tile.avp.redstonefluxgenerator"));
GameRegistry.registerTileEntity(TileEntityReflective.class, new ResourceLocation(AliensVsPredator.Properties.ID, "tile.avp.reflective"));
GameRegistry.registerTileEntity(TileEntityGroundFern.class, new ResourceLocation(AliensVsPredator.Properties.ID, "tile.avp.groundfern"));
GameRegistry.registerTileEntity(TileEntityTreeFern.class, new ResourceLocation(AliensVsPredator.Properties.ID, "tile.avp.treefern"));
}
private void registerSpawns()
@@ -3,8 +3,8 @@
import java.util.Random;
import org.avp.tile.plants.TileEntityGroundFern;
import org.avp.tile.plants.TileEntityGroundFern.PlantColor;
import org.avp.tile.plants.TileEntityGroundFern.PlantSize;
import org.avp.tile.plants.TileEntityPlant.PlantColor;
import org.avp.tile.plants.TileEntityPlant.PlantSize;
import com.arisux.mdx.lib.world.Pos;
import com.arisux.mdx.lib.world.entity.Entities;
@@ -54,8 +54,7 @@ public void onBlockAdded(World world, BlockPos pos, IBlockState state)
fern.setPlantSize(PlantSize.random(world));
Random rand = new Random();
Pos offset = new Pos(rand.nextDouble() + -rand.nextDouble(), 0F, rand.nextDouble() + -rand.nextDouble());
fern.setOffset(offset);
fern.applyRandomOffset(rand);
if (rand.nextInt(150) == 0)
{
@@ -0,0 +1,118 @@
package org.avp.block;
import java.util.Random;
import org.avp.tile.plants.TileEntityTreeFern;
import org.avp.tile.plants.TileEntityPlant.PlantColor;
import org.avp.tile.plants.TileEntityPlant.PlantSize;
import com.arisux.mdx.lib.world.Pos;
import com.arisux.mdx.lib.world.entity.Entities;
import net.minecraft.block.BlockBush;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockTreeFern extends BlockBush implements ITileEntityProvider
{
public BlockTreeFern()
{
super(Material.PLANTS);
this.setLightOpacity(2);
}
@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor)
{
super.onNeighborChange(world, pos, neighbor);
if (!world.getBlockState(neighbor).isSideSolid(world, pos, EnumFacing.UP) && pos.down() == neighbor)
{
((World) world).destroyBlock(pos, true);
}
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
{
super.onBlockAdded(world, pos, state);
TileEntity tile = (TileEntity) world.getTileEntity(pos);
if (tile instanceof TileEntityTreeFern)
{
TileEntityTreeFern fern = (TileEntityTreeFern) tile;
fern.setPlantSize(PlantSize.random(world));
Random rand = new Random();
fern.applyRandomOffset(rand);
if (rand.nextInt(150) == 0)
{
fern.setPlantColor(TileEntityTreeFern.WHITE);
}
else
{
PlantColor color = TileEntityTreeFern.STANDARD_COLOR_GROUP[rand.nextInt(TileEntityTreeFern.STANDARD_COLOR_GROUP.length)];
fern.setPlantColor(color);
}
}
if (!world.getBlockState(pos.down()).isSideSolid(world, pos, EnumFacing.UP))
{
world.destroyBlock(pos, true);
}
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
super.onBlockPlacedBy(world, pos, state, placer, stack);
TileEntity tile = world.getTileEntity(pos);
if (tile != null && tile instanceof TileEntityTreeFern && placer != null)
{
TileEntityTreeFern plant = (TileEntityTreeFern) tile;
plant.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileEntityTreeFern();
}
@Override
public boolean hasTileEntity(IBlockState state)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.INVISIBLE;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
}
@@ -112,6 +112,7 @@
import org.avp.client.render.items.RenderItemSupplyChute;
import org.avp.client.render.items.RenderItemSupplyCrate;
import org.avp.client.render.items.RenderItemTransformer;
import org.avp.client.render.items.RenderItemTreeFern;
import org.avp.client.render.items.RenderItemTurret;
import org.avp.client.render.items.RenderItemWorkstation;
import org.avp.client.render.items.RenderItemWristbracer;
@@ -166,6 +167,7 @@
import org.avp.client.render.tile.RenderTurret;
import org.avp.client.render.tile.RenderWorkstation;
import org.avp.client.render.tile.plants.RenderGroundFern;
import org.avp.client.render.tile.plants.RenderTreeFern;
import org.avp.client.render.transforms.CryostasisTubeRenderers;
import org.avp.client.render.transforms.FaceLocationTransforms;
import org.avp.client.render.transforms.MedpodTransforms;
@@ -262,6 +264,7 @@
import org.avp.tile.TileEntityTurret;
import org.avp.tile.TileEntityWorkstation;
import org.avp.tile.plants.TileEntityGroundFern;
import org.avp.tile.plants.TileEntityTreeFern;
import com.arisux.mdx.lib.client.render.model.MapModelTexture;
import com.arisux.mdx.lib.game.IInitEvent;
@@ -454,6 +457,7 @@ private void registerBlockItemRenderers()
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.crateSeegson), new RenderItemSupplyCrate());
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.networkRack), new RenderItemNetworkRack());
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.groundFern), new RenderItemGroundFern());
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.treeFern), new RenderItemTreeFern());
}
private void registerItemRenderers()
@@ -601,5 +605,6 @@ private void registerTileEntitySpecialRenderers()
bindTileEntitySpecialRenderer(TileEntityHiveResin.class, new RenderHiveResin());
bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderSkull());
bindTileEntitySpecialRenderer(TileEntityGroundFern.class, new RenderGroundFern());
bindTileEntitySpecialRenderer(TileEntityTreeFern.class, new RenderTreeFern());
}
}
Oops, something went wrong.

0 comments on commit 9d1e9ad

Please sign in to comment.