update feature branch

This commit is contained in:
Mohammad-Ali Minaie
2018-12-16 17:15:16 -05:00
parent 9a8fe16df4
commit f7c27289b7
8 changed files with 132 additions and 16 deletions

View File

@@ -10,8 +10,15 @@
- [ ] Grinding wheel rotate - [ ] Grinding wheel rotate
## Current Feature ## Current Feature
- [ ] Recipe Handler for saw - [x] Test Redstone Engine drops
- [ ] Sound for block break - [x] Figure out tile update for crucible after cooking.
- [ ] Item Render for engine
- [ ] Item Render for Saw Block
- [ ] Machine Chassis Recipe
- [ ] Redstone Engine Recipe
- [ ] Gear recipes
- [ ] Gearbox recipe
- [ ] Saw Recipe
## Feature Optimizations ## Feature Optimizations
- [ ] Untick Bloomery and Forge - [ ] Untick Bloomery and Forge
@@ -56,6 +63,8 @@ rename s/iron/steel/ iron*
``` ```
### Completed ### Completed
- [x] Recipe Handler for saw
- [x] Sound for block break
- [x] Redstone Engine Model - [x] Redstone Engine Model
- [x] Engine Refactor - [x] Engine Refactor
- [x] Slots for Engines - [x] Slots for Engines

View File

@@ -8,6 +8,7 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -16,7 +17,9 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBaseSlot;
/** /**
* Created by kitsu on 12/3/2016. * Created by kitsu on 12/3/2016.

View File

@@ -97,6 +97,40 @@ public class MachineSaw extends CustomContainerFacingActive {
return new TileMachineSaw(); return new TileMachineSaw();
} }
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
this.onBlockHarvested(world, pos, state, player);
return this.destroyBlock(world, pos, state, EnumFacing.UP, player);
}
public boolean destroyBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player)
{
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileRedstoneEngine) {
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
ItemStack dropStack = new ItemStack(ModBlocks.redstoneengine, 1);
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
//world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.setBlockToAir(pos);
world.markTileEntityForRemoval(tile);
return true;
}
}
return false;
}
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (!world.isRemote) {
TileRedstoneEngine tile = (TileRedstoneEngine) world.getTileEntity(pos);
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotList());
}
}
private void sawThings(World world, BlockPos pos, IBlockState state, TileMachineSaw tile, BlockPos fromPos){ private void sawThings(World world, BlockPos pos, IBlockState state, TileMachineSaw tile, BlockPos fromPos){
if(state.getValue(PrimalAPI.States.ACTIVE) && tile.getTransfer() ){ if(state.getValue(PrimalAPI.States.ACTIVE) && tile.getTransfer() ){
if(fromPos.equals(pos.up())) { if(fromPos.equals(pos.up())) {

View File

@@ -19,6 +19,7 @@ import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.helper.RecipeHelper; import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.blocks.CustomContainerFacingActive; import nmd.primal.forgecraft.blocks.CustomContainerFacingActive;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.tiles.TileRedstoneEngine; import nmd.primal.forgecraft.tiles.TileRedstoneEngine;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -106,6 +107,39 @@ public class RedstoneEngine extends CustomContainerFacingActive {
} }
} }
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
this.onBlockHarvested(world, pos, state, player);
return this.destroyBlock(world, pos, state, EnumFacing.UP, player);
}
public boolean destroyBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player)
{
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileRedstoneEngine) {
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
ItemStack dropStack = new ItemStack(ModBlocks.redstoneengine, 1);
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
//world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.setBlockToAir(pos);
world.markTileEntityForRemoval(tile);
return true;
}
}
return false;
}
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (!world.isRemote) {
TileRedstoneEngine tile = (TileRedstoneEngine) world.getTileEntity(pos);
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotList());
}
}
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{ {

View File

@@ -36,41 +36,61 @@ public final class RecipesMachineSaw {
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logOak"), new OreIngredient("logOak"),
RecipeHelper.buildList((new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 0)), RecipeHelper.buildList(
(new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 0)),
(new ItemStack(PrimalAPI.Items.BARK_OAK, 4)), (new ItemStack(PrimalAPI.Items.BARK_OAK, 4)),
sticks)) sticks))
.setRecipeName("oakPlanks")); .setRecipeName("planksOak"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logSpruce"), new OreIngredient("logSpruce"),
RecipeHelper.buildList((new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 1)), RecipeHelper.buildList(
(new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 1)),
(new ItemStack(PrimalAPI.Items.BARK_SPRUCE, 4)), (new ItemStack(PrimalAPI.Items.BARK_SPRUCE, 4)),
sticks)) sticks))
.setRecipeName("sprucePlanks")); .setRecipeName("planksSpruce"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logBirch"), new OreIngredient("logBirch"),
RecipeHelper.buildList( (new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 2)), RecipeHelper.buildList(
(new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 2)),
(new ItemStack(PrimalAPI.Items.BARK_BIRCH, 4)), (new ItemStack(PrimalAPI.Items.BARK_BIRCH, 4)),
sticks)) sticks))
.setRecipeName("birchPlanks")); .setRecipeName("planksBirch"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logJungle"), new OreIngredient("logJungle"),
RecipeHelper.buildList(new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 3))) RecipeHelper.buildList(
.setRecipeName("junglePlanks")); (new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 3)),
(new ItemStack(PrimalAPI.Items.BARK_JUNGLE, 4)),
sticks))
.setRecipeName("planksJungle"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logAcacia"), new OreIngredient("logAcacia"),
RecipeHelper.buildList(new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 0))) RecipeHelper.buildList(
.setRecipeName("acaciaPlanks")); (new ItemStack(Item.getItemFromBlock(Blocks.PLANKS), 4, 0)),
(new ItemStack(PrimalAPI.Items.BARK_ACACIA, 4)),
sticks))
.setRecipeName("planksAcacia"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logIronwood"), new OreIngredient("logIronwood"),
RecipeHelper.buildList(new ItemStack(Item.getItemFromBlock(PrimalAPI.Blocks.PLANKS), 4, 0))) RecipeHelper.buildList(
.setRecipeName("ironwoodPlanks")); (new ItemStack(Item.getItemFromBlock(PrimalAPI.Blocks.PLANKS), 4, 0)),
(new ItemStack(PrimalAPI.Items.BARK_IRONWOOD, 4)),
(new ItemStack(PrimalAPI.Items.IRONWOOD_STICK, 2))
))
.setRecipeName("planksIronwood"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logYew"), new OreIngredient("logYew"),
RecipeHelper.buildList(new ItemStack(Item.getItemFromBlock(PrimalAPI.Blocks.PLANKS), 4, 1))) RecipeHelper.buildList(
(new ItemStack(Item.getItemFromBlock(PrimalAPI.Blocks.PLANKS), 4, 1)),
(new ItemStack(PrimalAPI.Items.BARK_YEW, 4)),
(new ItemStack(PrimalAPI.Items.YEW_STICK, 2))
))
.setRecipeName("yewPlanks")); .setRecipeName("yewPlanks"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(
new OreIngredient("logCorypha"), new OreIngredient("logCorypha"),
RecipeHelper.buildList(new ItemStack(Item.getItemFromBlock(PrimalAPI.Blocks.PLANKS), 4, 3))) RecipeHelper.buildList(
(new ItemStack(Item.getItemFromBlock(PrimalAPI.Blocks.PLANKS), 4, 3)),
(new ItemStack(PrimalAPI.Items.BARK_CORYPHA, 4)),
(new ItemStack(PrimalAPI.Items.CORYPHA_STICK, 2))))
.setRecipeName("coryphaPlanks")); .setRecipeName("coryphaPlanks"));
recipes.register(new MachineSawCrafting( recipes.register(new MachineSawCrafting(

View File

@@ -79,8 +79,12 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
if(recipe!=null){ if(recipe!=null){
if( (this.getHot() == 15) && (this.getStatus()) ){ if( (this.getHot() == 15) && (this.getStatus()) ){
this.setDrops(recipe.getDropsCooked()); this.setDrops(recipe.getDropsCooked());
this.updateBlock();
this.markDirty();
} else if ((this.getHot() == 15) && (!this.getStatus())){ } else if ((this.getHot() == 15) && (!this.getStatus())){
this.setDrops(recipe.getDropsRaw()); this.setDrops(recipe.getDropsRaw());
this.updateBlock();
this.markDirty();
} }
} }
} }
@@ -91,6 +95,8 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
if(this.getHeat() > 0){ if(this.getHeat() > 0){
this.setHeat( this.getHeat() - 1); this.setHeat( this.getHeat() - 1);
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 15), 2); world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 15), 2);
this.updateBlock();
this.markDirty();
} }
if(this.getHeat() == 0){ if(this.getHeat() == 0){
this.setHot(6); this.setHot(6);

View File

@@ -0,0 +1,10 @@
{
"forge_marker":1,
"defaults": {
"textures": {
"particle": "blocks/planks_oak",
"texture": "blocks/planks_oak"
}
},
"parent": "forgecraft:block/redstone_engine_model"
}