made chisel placement better
This commit is contained in:
@@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx3G
|
|||||||
mod_group=nmd.primal.forgecraft
|
mod_group=nmd.primal.forgecraft
|
||||||
mod_name=ForgeCraft
|
mod_name=ForgeCraft
|
||||||
|
|
||||||
mod_version=1.6.29
|
mod_version=1.6.30
|
||||||
forge_version=14.23.4.2765
|
forge_version=14.23.4.2765
|
||||||
mcp_mappings=snapshot_20171003
|
mcp_mappings=snapshot_20171003
|
||||||
mc_version=1.12.2
|
mc_version=1.12.2
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ModInfo {
|
|||||||
//public static final String MOD_PREFIX = MOD_ID + ":";
|
//public static final String MOD_PREFIX = MOD_ID + ":";
|
||||||
public static final String MOD_CHANNEL = MOD_ID;
|
public static final String MOD_CHANNEL = MOD_ID;
|
||||||
|
|
||||||
public static final String MOD_VERSION = "1.6.29";
|
public static final String MOD_VERSION = "1.6.30";
|
||||||
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
|
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
|
||||||
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
|
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
|
||||||
|
|
||||||
|
|||||||
@@ -122,10 +122,10 @@ public class Chisel extends CustomFacing implements ToolMaterialMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||||
{
|
{
|
||||||
if(!worldIn.isRemote) {
|
if(!world.isRemote) {
|
||||||
worldIn.setBlockState(pos, state.withProperty(FACING, reverseFacing(EnumFacing.getDirectionFromEntityLiving(pos, placer))).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
world.setBlockState(pos, state.withProperty(FACING, EnumFacing.getFacingFromVector((float)placer.getLookVec().x, (float)placer.getLookVec().y, (float)placer.getLookVec().z)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import nmd.primal.forgecraft.tiles.TileNBTCrucible;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static net.minecraft.util.EnumHand.MAIN_HAND;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mminaie on 11/11/17.
|
* Created by mminaie on 11/11/17.
|
||||||
@@ -58,8 +60,14 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
|||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
if(hand.equals(hand.MAIN_HAND)) {
|
|
||||||
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
|
|
||||||
|
if(hand.equals(MAIN_HAND)) {
|
||||||
|
|
||||||
|
System.out.println(player.inventory.getCurrentItem());
|
||||||
|
System.out.println(hand);
|
||||||
|
|
||||||
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||||
pItem.setCount(1);
|
pItem.setCount(1);
|
||||||
|
|
||||||
@@ -76,8 +84,12 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
|
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
|
||||||
|
if( player.inventory.getSlotFor(player.inventory.getCurrentItem()) != -1 ) {
|
||||||
|
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||||
|
pItem.setCount(1);
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
if (!pItem.isEmpty()) {
|
if (!pItem.isEmpty()) {
|
||||||
if (!tile.getStatus() || tile.getHot() == 15 || tile.getHot() == 6) {
|
if (!tile.getStatus() || tile.getHot() == 15 || tile.getHot() == 6) {
|
||||||
@@ -101,8 +113,11 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**CLEARS THE INVENTORY**/
|
/**CLEARS THE INVENTORY**/
|
||||||
|
if(hand.equals(MAIN_HAND)) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
|
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||||
if (pItem.isEmpty()) {
|
if (pItem.isEmpty()) {
|
||||||
if (tile.getHot() != 15) {
|
if (tile.getHot() != 15) {
|
||||||
if (!tile.getStatus()) {
|
if (!tile.getStatus()) {
|
||||||
@@ -122,8 +137,11 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**REMOVE COOKED ITEM**/
|
/**REMOVE COOKED ITEM**/
|
||||||
if (player.isSneaking() == true) {
|
if (player.isSneaking() == true) {
|
||||||
|
if (hand.equals(MAIN_HAND)) {
|
||||||
|
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||||
if (pItem.isEmpty()) {
|
if (pItem.isEmpty()) {
|
||||||
if (tile.getStatus() && tile.getHot() == 6) {
|
if (tile.getStatus() && tile.getHot() == 6) {
|
||||||
ItemStack dropStack = tile.getDrops().copy();
|
ItemStack dropStack = tile.getDrops().copy();
|
||||||
@@ -142,7 +160,6 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import nmd.primal.forgecraft.ModInfo;
|
|||||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||||
import nmd.primal.forgecraft.tiles.TileForge;
|
import nmd.primal.forgecraft.tiles.TileForge;
|
||||||
import nmd.primal.forgecraft.util.ForgeHandler;
|
import nmd.primal.forgecraft.util.ForgeHandler;
|
||||||
|
import nmd.primal.forgecraft.util.SlotHelper;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -42,7 +43,7 @@ import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
|||||||
/**
|
/**
|
||||||
* Created by kitsu on 11/26/2016.
|
* Created by kitsu on 11/26/2016.
|
||||||
*/
|
*/
|
||||||
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler{
|
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler, SlotHelper {
|
||||||
|
|
||||||
private int maxHeat;
|
private int maxHeat;
|
||||||
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("PrimalAPI.States.ACTIVE");
|
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("PrimalAPI.States.ACTIVE");
|
||||||
@@ -97,7 +98,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
|||||||
ItemStack fuelItem = tile.getSlotStack(0);
|
ItemStack fuelItem = tile.getSlotStack(0);
|
||||||
|
|
||||||
/***********************
|
/***********************
|
||||||
FUEL SLOT CODE
|
FUEL SLOT REMOVAL CODE
|
||||||
***********************/
|
***********************/
|
||||||
if (!tile.getSlotStack(0).isEmpty()) {
|
if (!tile.getSlotStack(0).isEmpty()) {
|
||||||
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||||
@@ -107,6 +108,10 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
TEMP PRINT OUT CODE
|
||||||
|
***********************/
|
||||||
if (pItem.isEmpty()) {
|
if (pItem.isEmpty()) {
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
if (world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) {
|
if (world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) {
|
||||||
@@ -119,6 +124,9 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/***********************
|
||||||
|
Forge Activation Code
|
||||||
|
***********************/
|
||||||
if ((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
|
if ((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
|
||||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||||
tile.setHeat(100);
|
tile.setHeat(100);
|
||||||
@@ -126,33 +134,48 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
|||||||
tile.updateBlock();
|
tile.updateBlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
|
||||||
if (!fuelItem.isEmpty()) {
|
/***********************
|
||||||
if (pItem.getItem() == fuelItem.getItem()) {
|
FUEL SLOT MANAGEMENT Code
|
||||||
if (fuelItem.getCount() < 64) {
|
***********************/
|
||||||
if (fuelItem.getCount() + pItem.getCount() <= 64) {
|
|
||||||
fuelItem.grow(pItem.getCount());
|
/***********************
|
||||||
|
FUEL SLOT IS EMPTYT
|
||||||
|
***********************/
|
||||||
|
if (tile.getSlotStack(0).isEmpty()) {
|
||||||
|
if(tile.isItemValidForSlot(0, player.inventory.getCurrentItem())) {
|
||||||
|
tile.setSlotStack(0, player.inventory.getCurrentItem());
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.updateBlock();
|
tile.updateBlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (fuelItem.getCount() + pItem.getCount() > 64) {
|
}
|
||||||
pItem.setCount(64 - pItem.getCount());
|
|
||||||
fuelItem.setCount(64);
|
/***********************
|
||||||
|
FUEL SLOT HAS STUFF
|
||||||
|
***********************/
|
||||||
|
if(ItemStack.areItemsEqual(player.inventory.getCurrentItem(), tile.getSlotStack(0)) && !tile.getSlotStack(0).isEmpty()) {
|
||||||
|
if (tile.getSlotStack(0).getCount() < 64) {
|
||||||
|
if (tile.getSlotStack(0).getCount() + player.inventory.getCurrentItem().getCount() <= 64) {
|
||||||
|
tile.getSlotStack(0).grow(pItem.getCount());
|
||||||
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||||
|
tile.markDirty();
|
||||||
|
tile.updateBlock();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (tile.getSlotStack(0).getCount() + player.inventory.getCurrentItem().getCount() > 64) {
|
||||||
|
int count = 64 - tile.getSlotStack(0).getCount();
|
||||||
|
tile.getSlotStack(0).grow(count);
|
||||||
|
pItem.shrink(count);
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
tile.updateBlock();
|
tile.updateBlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (fuelItem.isEmpty()) {
|
|
||||||
tile.setSlotStack(0, pItem);
|
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (facing == EnumFacing.UP) {
|
if (facing == EnumFacing.UP) {
|
||||||
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
|
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"modid": "forgecraft",
|
"modid": "forgecraft",
|
||||||
"name": "Kitsu's Forgecraft",
|
"name": "Kitsu's Forgecraft",
|
||||||
"description": "Forged with sweat and blood",
|
"description": "Forged with sweat and blood",
|
||||||
"version": "1.6.29",
|
"version": "1.6.30",
|
||||||
"mcversion": "1.12.2",
|
"mcversion": "1.12.2",
|
||||||
"url": "",
|
"url": "",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user