Skip to content

Commit

Permalink
big huge cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eerussianguy committed Mar 4, 2021
1 parent 4a3ab7c commit 42ab12a
Show file tree
Hide file tree
Showing 26 changed files with 148 additions and 406 deletions.
Binary file added docs/arcs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/climate_station.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/valid_greenhouse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import com.eerussianguy.firmalife.blocks.BlockFruitDoor;
import com.eerussianguy.firmalife.blocks.BlockFruitFenceGate;
import com.eerussianguy.firmalife.blocks.BlockPlanter;
import com.eerussianguy.firmalife.blocks.BlockStemCrop;
import com.eerussianguy.firmalife.init.RegistriesFL;
import com.eerussianguy.firmalife.init.StatePropertiesFL;
Expand Down Expand Up @@ -106,8 +105,6 @@ public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack)
//use vanilla stem rendering for StemCrops
for (BlockStemCrop block : BlocksFL.getAllCropBlocks())
ModelLoader.setCustomStateMapper(block, new VanillaStemStateMapper());
for (BlockPlanter planter : BlocksFL.getAllPlanters())
ModelLoader.setCustomStateMapper(planter, new StateMap.Builder().ignore(StatePropertiesFL.CAN_GROW).build());
for (BlockFruitDoor door : BlocksFL.getAllFruitDoors())
ModelLoader.setCustomStateMapper(door, new StateMap.Builder().ignore(BlockDoor.POWERED).build());
for (BlockFruitFenceGate gate : BlocksFL.getAllFruitFenceGates())
Expand All @@ -119,7 +116,7 @@ public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack)

for (Block block : BlocksFL.getAllFluidBlocks())
ModelLoader.setCustomStateMapper(block, new StateMap.Builder().ignore(BlockFluidBase.LEVEL).build());
ModelLoader.setCustomStateMapper(BlocksFL.BLOCK_GREENHOUSE_DOOR, new StateMap.Builder().ignore(BlockDoor.POWERED).build());
ModelLoader.setCustomStateMapper(BlocksFL.GREENHOUSE_DOOR, new StateMap.Builder().ignore(BlockDoor.POWERED).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_LOG, new StateMap.Builder().ignore(StatePropertiesFL.CAN_GROW).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_LEAVES, new StateMap.Builder().ignore(BlockLeaves.DECAYABLE).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_SAPLING, new StateMap.Builder().ignore(BlockSaplingTFC.STAGE).build());
Expand Down Expand Up @@ -194,5 +191,7 @@ public static void onTextureStitchEvent(TextureStitchEvent.Pre event)
}
}
}
event.getMap().registerSprite(new ResourceLocation(MOD_ID, "blocks/potting_soil_wet"));
event.getMap().registerSprite(new ResourceLocation(MOD_ID, "blocks/potting_soil_dry"));
}
}
23 changes: 21 additions & 2 deletions src/main/java/com/eerussianguy/firmalife/blocks/BlockLeafMat.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.eerussianguy.firmalife.blocks;

import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
Expand All @@ -25,14 +27,17 @@

import com.eerussianguy.firmalife.recipe.DryingRecipe;
import com.eerussianguy.firmalife.te.TELeafMat;
import mcp.MethodsReturnNonnullByDefault;
import net.dries007.tfc.api.capability.size.IItemSize;
import net.dries007.tfc.api.capability.size.Size;
import net.dries007.tfc.api.capability.size.Weight;
import net.dries007.tfc.util.Helpers;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class BlockLeafMat extends Block implements IItemSize
{
public static final AxisAlignedBB LEAFMAT = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D);
public static final AxisAlignedBB MAT_SHAPE = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D);

public BlockLeafMat()
{
Expand All @@ -41,6 +46,7 @@ public BlockLeafMat()
setResistance(1.0F);
setLightOpacity(0);
setSoundType(SoundType.PLANT);
setTickRandomly(true);
}

@Override
Expand Down Expand Up @@ -79,6 +85,19 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
return true;
}

@Override
public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random)
{
if (worldIn.isRainingAt(pos.up()))
{
TELeafMat te = Helpers.getTE(worldIn, pos, TELeafMat.class);
if (te != null)
{
te.rain();
}
}
}

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
Expand Down Expand Up @@ -116,7 +135,7 @@ public Weight getWeight(@Nonnull ItemStack stack)
@Nonnull
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return LEAFMAT;
return MAT_SHAPE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.eerussianguy.firmalife.blocks;

import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
Expand All @@ -18,6 +20,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import mcp.MethodsReturnNonnullByDefault;
import net.dries007.tfc.api.capability.size.IItemSize;
import net.dries007.tfc.api.capability.size.Size;
import net.dries007.tfc.api.capability.size.Weight;
Expand All @@ -26,6 +29,8 @@
import static net.dries007.tfc.Constants.RNG;
import static net.minecraft.block.BlockHorizontal.FACING;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class BlockOvenWall extends Block implements IItemSize
{
public static final AxisAlignedBB OVEN_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 9.0 / 16, 16.0D / 16, 16.0D / 16, 16.0D / 16);
Expand All @@ -45,7 +50,6 @@ public BlockOvenWall()

@Override
@SuppressWarnings("deprecation")
@Nonnull
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
if (facing.getAxis() == EnumFacing.Axis.Y)
Expand All @@ -57,7 +61,6 @@ public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing

@Override
@SuppressWarnings("deprecation")
@Nonnull
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(FACING, EnumFacing.byHorizontalIndex(meta)).withProperty(CURED, meta > 3);
Expand All @@ -76,30 +79,26 @@ public boolean isOpaqueCube(IBlockState state)
return false;
}

@Nonnull
@Override
public Size getSize(@Nonnull ItemStack stack)
public Size getSize (ItemStack stack)
{
return Size.NORMAL;
}

@Nonnull
@Override
public Weight getWeight(@Nonnull ItemStack stack)
public Weight getWeight (ItemStack stack)
{
return Weight.HEAVY;
}

@Override
@Nonnull
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, FACING, CURED);
}

@Override
@SuppressWarnings("deprecation")
@Nonnull
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
switch (state.getValue(FACING))
Expand Down Expand Up @@ -131,7 +130,6 @@ public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos

@Override
@SuppressWarnings("deprecation")
@Nonnull
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
Expand Down
Loading

0 comments on commit 42ab12a

Please sign in to comment.