made chisel placement better
This commit is contained in:
@@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx3G
|
||||
mod_group=nmd.primal.forgecraft
|
||||
mod_name=ForgeCraft
|
||||
|
||||
mod_version=1.6.29
|
||||
mod_version=1.6.30
|
||||
forge_version=14.23.4.2765
|
||||
mcp_mappings=snapshot_20171003
|
||||
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_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 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
|
||||
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) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, reverseFacing(EnumFacing.getDirectionFromEntityLiving(pos, placer))).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
if(!world.isRemote) {
|
||||
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 static net.minecraft.util.EnumHand.MAIN_HAND;
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
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();
|
||||
pItem.setCount(1);
|
||||
|
||||
@@ -76,11 +84,15 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
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 (!pItem.isEmpty()) {
|
||||
if(!tile.getStatus() || tile.getHot() == 15 || tile.getHot() == 6) {
|
||||
if (!tile.getStatus() || tile.getHot() == 15 || tile.getHot() == 6) {
|
||||
if (pItem.getItem() instanceof SlottedTongs) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -101,10 +113,13 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**CLEARS THE INVENTORY**/
|
||||
}
|
||||
/**CLEARS THE INVENTORY**/
|
||||
if(hand.equals(MAIN_HAND)) {
|
||||
if (player.isSneaking()) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||
if (pItem.isEmpty()) {
|
||||
if (tile.getHot()!=15) {
|
||||
if (tile.getHot() != 15) {
|
||||
if (!tile.getStatus()) {
|
||||
for (int i = 0; i < tile.ingList.size(); i++) {
|
||||
if (!tile.ingList.get(i).isEmpty()) {
|
||||
@@ -122,10 +137,13 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**REMOVE COOKED ITEM**/
|
||||
if (player.isSneaking() == true) {
|
||||
}
|
||||
/**REMOVE COOKED ITEM**/
|
||||
if (player.isSneaking() == true) {
|
||||
if (hand.equals(MAIN_HAND)) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||
if (pItem.isEmpty()) {
|
||||
if (tile.getStatus() && tile.getHot()==6) {
|
||||
if (tile.getStatus() && tile.getHot() == 6) {
|
||||
ItemStack dropStack = tile.getDrops().copy();
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
|
||||
tile.setHot(0);
|
||||
@@ -142,7 +160,6 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -29,6 +29,7 @@ import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
import nmd.primal.forgecraft.util.ForgeHandler;
|
||||
import nmd.primal.forgecraft.util.SlotHelper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
@@ -42,7 +43,7 @@ import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
||||
/**
|
||||
* 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;
|
||||
//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);
|
||||
|
||||
/***********************
|
||||
FUEL SLOT CODE
|
||||
FUEL SLOT REMOVAL CODE
|
||||
***********************/
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||
@@ -107,6 +108,10 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************
|
||||
TEMP PRINT OUT CODE
|
||||
***********************/
|
||||
if (pItem.isEmpty()) {
|
||||
if (!player.isSneaking()) {
|
||||
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))) {
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||
tile.setHeat(100);
|
||||
@@ -126,34 +134,49 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider,
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if ((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
||||
if (!fuelItem.isEmpty()) {
|
||||
if (pItem.getItem() == fuelItem.getItem()) {
|
||||
if (fuelItem.getCount() < 64) {
|
||||
if (fuelItem.getCount() + pItem.getCount() <= 64) {
|
||||
fuelItem.grow(pItem.getCount());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if (fuelItem.getCount() + pItem.getCount() > 64) {
|
||||
pItem.setCount(64 - pItem.getCount());
|
||||
fuelItem.setCount(64);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fuelItem.isEmpty()) {
|
||||
tile.setSlotStack(0, pItem);
|
||||
|
||||
/***********************
|
||||
FUEL SLOT MANAGEMENT Code
|
||||
***********************/
|
||||
|
||||
/***********************
|
||||
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);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************
|
||||
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.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (facing == EnumFacing.UP) {
|
||||
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
|
||||
return true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"modid": "forgecraft",
|
||||
"name": "Kitsu's Forgecraft",
|
||||
"description": "Forged with sweat and blood",
|
||||
"version": "1.6.29",
|
||||
"version": "1.6.30",
|
||||
"mcversion": "1.12.2",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
|
||||
Reference in New Issue
Block a user