Permalink
Browse files

Added Ferns and the underlying system for additional tile plants (wip)

  • Loading branch information...
Ri5ux committed Oct 27, 2018
1 parent 9b739a4 commit d31a7fcf7c3c9afef41ee1590bcc201c2638bdae
@@ -13,6 +13,7 @@
import org.avp.block.BlockCustomSlab;
import org.avp.block.BlockCustomStairs;
import org.avp.block.BlockGenerator;
import org.avp.block.BlockGroundFern;
import org.avp.block.BlockGunLocker;
import org.avp.block.BlockHiveResin;
import org.avp.block.BlockLightPanel;
@@ -176,6 +177,7 @@
public static final Block paradiseLogMed = new BlockParadiseLog().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_log_med").setCreativeTab(Tab.BLOCKS);
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");
/** Varda **/
public static final Block gigerLog = new BlockUnidentifiedLog().setHardness(5F).setLightOpacity(0).setCreativeTab(Tab.BLOCKS).setRegistryName("unitree.wood");
@@ -96,11 +96,10 @@
import org.avp.tile.TileEntityTransformer;
import org.avp.tile.TileEntityTurret;
import org.avp.tile.TileEntityWorkstation;
import org.avp.tile.plants.TileEntityGroundFern;
import org.avp.world.dimension.acheron.BiomeAcheron;
import org.avp.world.dimension.varda.BiomeVarda;
import com.arisux.mdx.MDX;
import com.arisux.mdx.config.ConfigSettingBiomeList;
import com.arisux.mdx.lib.game.IInitEvent;
import net.minecraft.entity.EnumCreatureType;
@@ -313,6 +312,7 @@ public void registerTileEntities()
GameRegistry.registerTileEntity(TileEntitySkull.class, new ResourceLocation(AliensVsPredator.Properties.ID, "tile.avp.skull"));
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"));
}
private void registerSpawns()
@@ -0,0 +1,119 @@
package org.avp.block;
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 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 BlockGroundFern extends BlockBush implements ITileEntityProvider
{
public BlockGroundFern()
{
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 TileEntityGroundFern)
{
TileEntityGroundFern fern = (TileEntityGroundFern) tile;
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);
if (rand.nextInt(150) == 0)
{
fern.setPlantColor(TileEntityGroundFern.WHITE);
}
else
{
PlantColor color = TileEntityGroundFern.STANDARD_COLOR_GROUP[rand.nextInt(TileEntityGroundFern.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 TileEntityGroundFern && placer != null)
{
TileEntityGroundFern plant = (TileEntityGroundFern) tile;
plant.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileEntityGroundFern();
}
@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;
}
}
@@ -81,6 +81,7 @@
import org.avp.client.render.items.RenderItemBlastDoor;
import org.avp.client.render.items.RenderItemCCFLTube;
import org.avp.client.render.items.RenderItemCryostasisTube;
import org.avp.client.render.items.RenderItemGroundFern;
import org.avp.client.render.items.RenderItemGunLocker;
import org.avp.client.render.items.RenderItemLightPanel;
import org.avp.client.render.items.RenderItemLocker;
@@ -164,6 +165,7 @@
import org.avp.client.render.tile.RenderTransformer;
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.transforms.CryostasisTubeRenderers;
import org.avp.client.render.transforms.FaceLocationTransforms;
import org.avp.client.render.transforms.MedpodTransforms;
@@ -259,6 +261,7 @@
import org.avp.tile.TileEntityTransformer;
import org.avp.tile.TileEntityTurret;
import org.avp.tile.TileEntityWorkstation;
import org.avp.tile.plants.TileEntityGroundFern;
import com.arisux.mdx.lib.client.render.model.MapModelTexture;
import com.arisux.mdx.lib.game.IInitEvent;
@@ -450,6 +453,7 @@ private void registerBlockItemRenderers()
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.crateMarines), new RenderItemSupplyCrate());
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.crateSeegson), new RenderItemSupplyCrate());
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.networkRack), new RenderItemNetworkRack());
Renderers.registerBlockItemRenderer(BlockHandler.getItemFromBlock(BlockHandler.groundFern), new RenderItemGroundFern());
}
private void registerItemRenderers()
@@ -596,5 +600,6 @@ private void registerTileEntitySpecialRenderers()
bindTileEntitySpecialRenderer(TileEntitySupplyCrate.class, new RenderSupplyCrate());
bindTileEntitySpecialRenderer(TileEntityHiveResin.class, new RenderHiveResin());
bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderSkull());
bindTileEntitySpecialRenderer(TileEntityGroundFern.class, new RenderGroundFern());
}
}
@@ -81,6 +81,7 @@
import org.avp.client.model.tile.ModelTransformer;
import org.avp.client.model.tile.ModelTurret;
import org.avp.client.model.tile.ModelWorkstation;
import org.avp.client.model.tile.plants.ModelGroundFern;
import org.avp.client.model.tile.rackmodules.ModelNetworkModuleRack;
import org.avp.client.model.tile.rackmodules.ModelRackModule1;
import org.avp.client.model.tile.rackmodules.ModelRackModule2;
@@ -230,6 +231,9 @@ public Models models()
public final MapModelTexture<ModelUrsuidae> URSUIDAE = new MapModelTexture(new ModelUrsuidae(), new Texture(AliensVsPredator.Properties.ID, "textures/mob/vardaboar.png"));
public final MapModelTexture<ModelVardaMonkey> VARDA_MONKEY = new MapModelTexture(new ModelVardaMonkey(), new Texture(AliensVsPredator.Properties.ID, "textures/mob/vardamonkey.png"));
public final MapModelTexture<ModelGroundFern> GROUND_FERN_OVERLAY = new MapModelTexture(new ModelGroundFern(), new Texture(AliensVsPredator.Properties.ID, "textures/tile/plants/paradisiangroundfern_overlay.png"));
public final MapModelTexture<ModelGroundFern> GROUND_FERN_COLORMAP = new MapModelTexture(new ModelGroundFern(), new Texture(AliensVsPredator.Properties.ID, "textures/tile/plants/paradisiangroundfern.png"));
/** New xenomorph model format **/
public final MapModelTexture<ModelUltramorph> ULTRAMORPH = new MapModelTexture(new ModelUltramorph(), new Texture(AliensVsPredator.Properties.ID, "textures/mob/ultramorph.png"));
Oops, something went wrong.

0 comments on commit d31a7fc

Please sign in to comment.