Permalink
Browse files

Added paradise blocks (dirt, mossy dirt, podzol, grass, 3 leave types…

…, and 3 log types)
  • Loading branch information...
Ri5ux committed Oct 23, 2018
1 parent 171de83 commit f1bd43c520764d8552aa0d9a0863ab5dacf05512
Showing with 677 additions and 4 deletions.
  1. +7 −0 src/main/java/org/avp/AliensVsPredator.java
  2. +25 −4 src/main/java/org/avp/BlockHandler.java
  3. +72 −0 src/main/java/org/avp/block/BlockParadiseLog.java
  4. +210 −0 src/main/java/org/avp/block/BlockParadiseTreeLeaves.java
  5. +101 −0 src/main/java/org/avp/client/render/BiomeColorHandler.java
  6. +34 −0 src/main/resources/assets/avp/blockstates/paradise_dirt.json
  7. +39 −0 src/main/resources/assets/avp/blockstates/paradise_dirt_mossy.json
  8. +39 −0 src/main/resources/assets/avp/blockstates/paradise_dirt_podzol.json
  9. +39 −0 src/main/resources/assets/avp/blockstates/paradise_grass.json
  10. +15 −0 src/main/resources/assets/avp/blockstates/paradise_leaves_large.json
  11. +15 −0 src/main/resources/assets/avp/blockstates/paradise_leaves_med.json
  12. +15 −0 src/main/resources/assets/avp/blockstates/paradise_leaves_small.json
  13. +15 −0 src/main/resources/assets/avp/blockstates/paradise_log_large.json
  14. +15 −0 src/main/resources/assets/avp/blockstates/paradise_log_med.json
  15. +15 −0 src/main/resources/assets/avp/blockstates/paradise_log_small.json
  16. +7 −0 src/main/resources/assets/avp/models/block/paradise_log_large.json
  17. +7 −0 src/main/resources/assets/avp/models/block/paradise_log_med.json
  18. +7 −0 src/main/resources/assets/avp/models/block/paradise_log_small.json
  19. BIN src/main/resources/assets/avp/textures/blocks/paradise_dirt.png
  20. BIN src/main/resources/assets/avp/textures/blocks/paradise_dirt_mossy.png
  21. BIN src/main/resources/assets/avp/textures/blocks/paradise_dirt_podzol_side.png
  22. BIN src/main/resources/assets/avp/textures/blocks/paradise_dirt_podzol_top.png
  23. BIN src/main/resources/assets/avp/textures/blocks/paradise_grass.png
  24. BIN src/main/resources/assets/avp/textures/blocks/paradise_grass_side.png
  25. BIN src/main/resources/assets/avp/textures/blocks/paradise_large_leaves.png
  26. BIN src/main/resources/assets/avp/textures/blocks/paradise_large_log_side.png
  27. BIN src/main/resources/assets/avp/textures/blocks/paradise_large_log_top.png
  28. BIN src/main/resources/assets/avp/textures/blocks/paradise_medium_leaves.png
  29. BIN src/main/resources/assets/avp/textures/blocks/paradise_medium_log_side.png
  30. BIN src/main/resources/assets/avp/textures/blocks/paradise_medium_log_top.png
  31. BIN src/main/resources/assets/avp/textures/blocks/paradise_small_leaves.png
  32. BIN src/main/resources/assets/avp/textures/blocks/paradise_small_log_side.png
  33. BIN src/main/resources/assets/avp/textures/blocks/paradise_small_log_top.png
  34. BIN src/main/resources/assets/avp/textures/blocks/portal.paradise.png
@@ -6,6 +6,7 @@
import org.avp.client.Renders;
import org.avp.client.Resources;
import org.avp.client.Sounds;
import org.avp.client.render.BiomeColorHandler;
import org.avp.world.CapabilityHandler;
import org.avp.world.hives.HiveHandler;
@@ -69,6 +70,7 @@ public void init(FMLInitializationEvent event)
dimensions().init(event);
materials().init(event);
world().init(event);
biomeColors().init(event);
interfaces().init(event);
events().init(event);
commands().init(event);
@@ -133,6 +135,11 @@ public static BlockHandler blocks()
{
return blocks == null ? blocks = new BlockHandler() : blocks;
}
public static BiomeColorHandler biomeColors()
{
return BiomeColorHandler.instance;
}
public static MaterialHandler materials()
{
@@ -23,6 +23,8 @@
import org.avp.block.BlockNetworkRack;
import org.avp.block.BlockOreCobalt;
import org.avp.block.BlockOreMonazite;
import org.avp.block.BlockParadiseLog;
import org.avp.block.BlockParadiseTreeLeaves;
import org.avp.block.BlockPortal;
import org.avp.block.BlockPowercell;
import org.avp.block.BlockPowerline;
@@ -155,16 +157,35 @@
public static final Block paddingSquareWhite = new BlockMaterial(Material.CLOTH).setHardness(10F).setResistance(15.0F).setLightOpacity(0).setRegistryName("padding_square_white");
public static final Block paddingTilesOrange = new BlockMaterial(Material.CLOTH).setHardness(10F).setResistance(15.0F).setLightOpacity(0).setRegistryName("padding_tiles_orange");
public static final Block paddingTilesWhite = new BlockMaterial(Material.CLOTH).setHardness(10F).setResistance(15.0F).setLightOpacity(0).setRegistryName("padding_tiles_white");
public static final Block lv426rock = new BlockMaterial(Material.ROCK).setHardness(1.3F).setResistance(2.0F).setRegistryName("lv426rock");
/** Dimension Common **/
public static final Block unistone = new BlockMaterial(Material.ROCK).setHardness(1.3F).setResistance(2.0F).setRegistryName("unistone");
public static final Block unisand = new BlockMaterial(Material.SAND).setHardness(3.5F).setResistance(2.0F).setRegistryName("unisand");
public static final Block unigravel = new BlockMaterial(Material.SAND).setHardness(3.0F).setLightOpacity(255).setRegistryName("unigravel");
public static final Block unidirt = new BlockUnidentifiedDirt().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("unidirt").setCreativeTab(Tab.BLOCKS);
public static final Block stalagmite = new BlockStalagmite(Material.PLANTS).setHardness(0.0F).setLightOpacity(0).setCreativeTab(Tab.MAIN).setRegistryName("stalagmite");
public static final Block gigerLog = new BlockUnidentifiedLog().setHardness(5F).setLightOpacity(0).setCreativeTab(Tab.MAIN).setRegistryName("unitree.wood");
public static final Block gigerTendons = new BlockUnidentifiedTreeTendon().setHardness(0.0F).setLightOpacity(0).setCreativeTab(Tab.MAIN).setRegistryName("unitree.tendons");
public static final Block gigerLeaves = new BlockUnidentifiedTreeLeaves().setHardness(0.0F).setLightOpacity(0).setCreativeTab(Tab.MAIN).setRegistryName("unitree.leaves");
/** Paradise **/
public static final Block paradiseDirt = new BlockUnidentifiedDirt().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_dirt").setCreativeTab(Tab.BLOCKS);
public static final Block paradiseDirtMossy = new BlockUnidentifiedDirt().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_dirt_mossy").setCreativeTab(Tab.BLOCKS);
public static final Block paradisePodzol = new BlockUnidentifiedDirt().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_dirt_podzol").setCreativeTab(Tab.BLOCKS);
public static final Block paradiseGrass = new BlockUnidentifiedDirt().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_grass").setCreativeTab(Tab.BLOCKS);
public static final Block paradiseLeavesLarge = new BlockParadiseTreeLeaves().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_leaves_large").setCreativeTab(Tab.BLOCKS);
public static final Block paradiseLogLarge = new BlockParadiseLog().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_log_large").setCreativeTab(Tab.BLOCKS);
public static final Block paradiseLeavesMed = new BlockParadiseTreeLeaves().setHardness(0.5F).setResistance(2.0F).setLightOpacity(255).setRegistryName("paradise_leaves_med").setCreativeTab(Tab.BLOCKS);
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);
/** Varda **/
public static final Block gigerLog = new BlockUnidentifiedLog().setHardness(5F).setLightOpacity(0).setCreativeTab(Tab.BLOCKS).setRegistryName("unitree.wood");
public static final Block gigerTendons = new BlockUnidentifiedTreeTendon().setHardness(0.0F).setLightOpacity(0).setCreativeTab(Tab.BLOCKS).setRegistryName("unitree.tendons");
public static final Block gigerLeaves = new BlockUnidentifiedTreeLeaves().setHardness(0.0F).setLightOpacity(0).setCreativeTab(Tab.BLOCKS).setRegistryName("unitree.leaves");
public static final Block gigerSapling = new BlockUnidentifiedTreeSapling().setHardness(0.0F).setLightOpacity(0).setCreativeTab(Tab.MAIN).setRegistryName("unitree.sapling");
/** Acheron **/
public static final Block lv426rock = new BlockMaterial(Material.ROCK).setHardness(1.3F).setResistance(2.0F).setRegistryName("lv426rock");
public static final Block satelliteDish = new BlockSatelliteDish().setHardness(3.2F).setResistance(2.6F).setCreativeTab(Tab.MAIN).setRegistryName("satellitedish");
public static final Block eggReceptacle = new BlockTempleSpawner(Material.ROCK, false).setCreativeTab(Tab.MAIN).setRegistryName("spawner");
public static final Block portalVarda = new BlockPortal(AliensVsPredator.dimensions().VARDA).setHardness(-1.0F).setLightLevel(2.0F).setCreativeTab(Tab.MAIN).setRegistryName("portal.varda");
@@ -0,0 +1,72 @@
package org.avp.block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
public class BlockParadiseLog extends BlockLog
{
public BlockParadiseLog()
{
super();
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] { LOG_AXIS });
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState state = this.getDefaultState();
switch (meta & 12)
{
case 0:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 4:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 8:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return state;
}
@SuppressWarnings("all")
@Override
public int getMetaFromState(IBlockState state)
{
int i = 0;
switch ((BlockLog.EnumAxis) state.getValue(LOG_AXIS))
{
case X:
i |= 4;
break;
case Z:
i |= 8;
break;
case NONE:
i |= 12;
}
return i;
}
@Override
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
{
return true;
}
}
@@ -0,0 +1,210 @@
package org.avp.block;
import java.util.List;
import java.util.Random;
import org.avp.AliensVsPredator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockPlanks.EnumType;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockParadiseTreeLeaves extends BlockLeaves
{
protected int[] surroundings;
public BlockParadiseTreeLeaves()
{
super();
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] { DECAYABLE, CHECK_DECAY });
}
@Override
public int getMetaFromState(IBlockState state)
{
return state.getValue(DECAYABLE) ? 2 : 1;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(DECAYABLE, meta == 2);
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(AliensVsPredator.blocks().gigerSapling);
}
@Override
public void beginLeavesDecay(IBlockState state, World world, BlockPos pos)
{
if (!(Boolean) state.getValue(CHECK_DECAY))
{
world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
}
}
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
{
return null;
}
@Override
public EnumType getWoodType(int meta)
{
return EnumType.OAK;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public BlockRenderLayer getRenderLayer()
{
return BlockRenderLayer.CUTOUT_MIPPED;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (!worldIn.isRemote)
{
if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue() && ((Boolean)state.getValue(DECAYABLE)).booleanValue())
{
int checkDist = 8;
int radius = 9;
int posX = pos.getX();
int posY = pos.getY();
int posZ = pos.getZ();
int j1 = 32;
int k1 = 1024;
int l1 = 16;
if (this.surroundings == null)
{
this.surroundings = new int[32768];
}
if (worldIn.isAreaLoaded(new BlockPos(posX - radius, posY - radius, posZ - radius), new BlockPos(posX + radius, posY + radius, posZ + radius)))
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int x = -checkDist; x <= checkDist; ++x)
{
for (int y = -checkDist; y <= checkDist; ++y)
{
for (int z = -checkDist; z <= checkDist; ++z)
{
IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.setPos(posX + x, posY + y, posZ + z));
Block block = iblockstate.getBlock();
if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.setPos(posX + x, posY + y, posZ + z)))
{
if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.setPos(posX + x, posY + y, posZ + z)))
{
this.surroundings[(x + l1) * k1 + (y + l1) * j1 + z + l1] = -2;
}
else
{
this.surroundings[(x + l1) * k1 + (y + l1) * j1 + z + l1] = -1;
}
}
else
{
this.surroundings[(x + l1) * k1 + (y + l1) * j1 + z + l1] = 0;
}
}
}
}
for (int p = 1; p <= checkDist; ++p)
{
for (int x = -checkDist; x <= checkDist; ++x)
{
for (int y = -checkDist; y <= checkDist; ++y)
{
for (int z = -checkDist; z <= checkDist; ++z)
{
if (this.surroundings[(x + l1) * k1 + (y + l1) * j1 + z + l1] == p - 1)
{
if (this.surroundings[(x + l1 - 1) * k1 + (y + l1) * j1 + z + l1] == -2)
{
this.surroundings[(x + l1 - 1) * k1 + (y + l1) * j1 + z + l1] = p;
}
if (this.surroundings[(x + l1 + 1) * k1 + (y + l1) * j1 + z + l1] == -2)
{
this.surroundings[(x + l1 + 1) * k1 + (y + l1) * j1 + z + l1] = p;
}
if (this.surroundings[(x + l1) * k1 + (y + l1 - 1) * j1 + z + l1] == -2)
{
this.surroundings[(x + l1) * k1 + (y + l1 - 1) * j1 + z + l1] = p;
}
if (this.surroundings[(x + l1) * k1 + (y + l1 + 1) * j1 + z + l1] == -2)
{
this.surroundings[(x + l1) * k1 + (y + l1 + 1) * j1 + z + l1] = p;
}
if (this.surroundings[(x + l1) * k1 + (y + l1) * j1 + (z + l1 - 1)] == -2)
{
this.surroundings[(x + l1) * k1 + (y + l1) * j1 + (z + l1 - 1)] = p;
}
if (this.surroundings[(x + l1) * k1 + (y + l1) * j1 + z + l1 + 1] == -2)
{
this.surroundings[(x + l1) * k1 + (y + l1) * j1 + z + l1 + 1] = p;
}
}
}
}
}
}
}
if (this.surroundings[16912] >= 0)
{
worldIn.setBlockState(pos, state.withProperty(CHECK_DECAY, Boolean.valueOf(false)), 4);
}
else
{
this.destroy(worldIn, pos);
}
}
}
}
protected void destroy(World worldIn, BlockPos pos)
{
this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockToAir(pos);
}
@Override
public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, EnumDyeColor color)
{
return true;
}
}
Oops, something went wrong.

0 comments on commit f1bd43c

Please sign in to comment.