fixed bugs initial slot manager handler for casting added
This commit is contained in:
@@ -49,6 +49,7 @@ public class AnvilStone extends AnvilBase {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
|
||||
this.breakBlock(world, pos, state);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,14 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||
import nmd.primal.forgecraft.util.CastingFormHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/19/17.
|
||||
*/
|
||||
public class CastingForm extends CustomContainerFacing {
|
||||
public class CastingForm extends CustomContainerFacing implements CastingFormHandler{
|
||||
|
||||
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 5/16D, 16/16D);
|
||||
|
||||
@@ -40,7 +41,8 @@ public class CastingForm extends CustomContainerFacing {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
|
||||
|
||||
if (!world.isRemote) {
|
||||
|
||||
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
|
||||
doInventoryManager(player.getActiveItemStack(), world, tile, pos, hitx, hity, hitz, state, player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ModCrafting {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rawsteelcrucible),
|
||||
"XC","Y ",
|
||||
('X'), new ItemStack(ModBlocks.ironcleanball, 1),
|
||||
('C'), new ItemStack(Items.COAL, 1, 1),
|
||||
('C'), new ItemStack(PrimalItems.CHARCOAL_HIGH),
|
||||
('Y'), ModBlocks.emptycrucible));
|
||||
|
||||
|
||||
|
||||
@@ -35,30 +35,27 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
World world = this.getWorld();
|
||||
if(!world.isRemote){
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
if(this.getHeat() < 100){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true) {
|
||||
if (this.getHeat() < 100) {
|
||||
this.setHeat(100);
|
||||
}
|
||||
}
|
||||
this.iteration ++;
|
||||
if(this.iteration == 300 ) {
|
||||
this.iteration++;
|
||||
if (this.iteration == 300) {
|
||||
this.iteration = 0;
|
||||
|
||||
//IBlockState state = world.getBlockState(this.pos);
|
||||
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ());
|
||||
if (world.getBlockState(this.getPos()).getValue(PrimalStates.ACTIVE)) {
|
||||
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY() + 1, this.getPos().getZ());
|
||||
if (this.getSlotStack(0) == ItemStack.EMPTY) {
|
||||
world.setBlockState(this.getPos(), state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
this.markDirty();
|
||||
world.notifyBlockUpdate(pos, state, state, 2);
|
||||
}
|
||||
slotZeroManager(world);
|
||||
}
|
||||
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
||||
}
|
||||
slotZeroManager(world);
|
||||
slotOneManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void slotOneManager(){
|
||||
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(this.getSlotStack(1));
|
||||
@@ -104,7 +101,7 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
|
||||
private void slotZeroManager(World world){
|
||||
if(this.getSlotStack(0) != ItemStack.EMPTY) {
|
||||
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 10);
|
||||
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 20);
|
||||
if(decrInt == 0) {
|
||||
decrInt = 1;
|
||||
}
|
||||
|
||||
@@ -33,19 +33,18 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
if(!world.isRemote){
|
||||
if(!world.isRemote) {
|
||||
World world = this.getWorld();
|
||||
this.iteration ++;
|
||||
this.iteration++;
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ());
|
||||
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY() + 1, this.getPos().getZ());
|
||||
IBlockState aboveState = world.getBlockState(abovePos);
|
||||
Block block = world.getBlockState(abovePos).getBlock();
|
||||
|
||||
if(this.iteration == 300 ) {
|
||||
if (world.getBlockState(this.getPos()).getValue(PrimalStates.ACTIVE)) {
|
||||
if (this.iteration == 300) {
|
||||
this.iteration = 0;
|
||||
|
||||
|
||||
if (world.getBlockState(this.getPos()).getValue(PrimalStates.ACTIVE)) {
|
||||
if (this.getSlotStack(0) == ItemStack.EMPTY) {
|
||||
world.setBlockState(this.getPos(), state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
this.markDirty();
|
||||
@@ -54,14 +53,15 @@ public class TileForge extends TileBaseSlot implements ITickable {
|
||||
slotZeroManager(world);
|
||||
}
|
||||
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
||||
}
|
||||
|
||||
craftingManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void slotZeroManager(World world){
|
||||
if(this.getSlotStack(0) != ItemStack.EMPTY) {
|
||||
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 10);
|
||||
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 20);
|
||||
if(decrInt == 0) {
|
||||
decrInt = 1;
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ public interface AnvilHandler {
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO REFACTOR THIS CODE
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.pickaxehead)) {
|
||||
if (tile.getSlotStack(counter).getSubCompound("tags").getBoolean("hot") == false) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||
|
||||
import static nmd.primal.forgecraft.blocks.CustomContainerFacing.FACING;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/20/17.
|
||||
*/
|
||||
public interface CastingFormHandler {
|
||||
|
||||
double[] normalMin = {0.1875, 0.3125, 0.4375, 0.5625, 0.6875};
|
||||
|
||||
default double getNormalMin(Integer x) {
|
||||
return normalMin[x];
|
||||
}
|
||||
|
||||
double[] normalMax = {0.3125, 0.4375, 0.5625, 0.6875, 0.8125};
|
||||
|
||||
default double getNormalMax(Integer x) {
|
||||
return normalMax[x];
|
||||
}
|
||||
|
||||
double[] reverseMin = {0.6875, 0.5625, 0.4375, 0.3125, 0.1875};
|
||||
|
||||
default double getReverseMin(Integer x) {
|
||||
return reverseMin[x];
|
||||
}
|
||||
|
||||
double[] reverseMax = {0.8125, 0.6875, 0.5625, 0.4375, 0.3125};
|
||||
|
||||
default double getReverseMax(Integer x) {
|
||||
return reverseMax[x];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
Adding and Removing Inventory With Tongs
|
||||
*****************************************************************************/
|
||||
|
||||
default boolean doInventoryManager(ItemStack pItem, World world, TileCastingForm tile, BlockPos pos, float hitx, float hity, float hitz, IBlockState state, EntityPlayer player) {
|
||||
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
int counter = 0;
|
||||
for (int z = 0; z < 5; z++) {
|
||||
for (int x = 0; x < 5; x++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
System.out.println("North Facing: " + tile.getSlotStack(counter));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.SOUTH) {
|
||||
int counter = 0;
|
||||
for (int z = 0; z < 5; z++) {
|
||||
for (int x = 0; x < 5; x++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.WEST) {
|
||||
int counter = 0;
|
||||
for (int x = 0; x < 5; x++) {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.EAST) {
|
||||
int counter = 0;
|
||||
for (int x = 0; x < 5; x++) {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
|
||||
"textures": {
|
||||
"particle": "blocks/log_oak",
|
||||
"texture": "blocks/log_oak"
|
||||
"texture": "blocks/log_oak",
|
||||
"texture1": "forgecraft:blocks/castingform_top"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
@@ -10,7 +11,7 @@
|
||||
"from": [ 0, 2, 0 ],
|
||||
"to": [ 3, 5, 16 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 0, 0, 3, 16 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 0, 0, 3, 16 ], "texture": "#texture1" },
|
||||
"north": { "uv": [ 13, 11, 16, 14 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 0, 11, 3, 14 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 0, 11, 16, 14 ], "texture": "#texture" },
|
||||
@@ -22,7 +23,7 @@
|
||||
"from": [ 13, 2, 0 ],
|
||||
"to": [ 16, 5, 16 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 13, 0, 16, 16 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 13, 0, 16, 16 ], "texture": "#texture1" },
|
||||
"north": { "uv": [ 0, 11, 3, 14 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 13, 11, 16, 14 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 0, 11, 16, 14 ], "texture": "#texture" },
|
||||
@@ -34,7 +35,7 @@
|
||||
"from": [ 3, 2, 0 ],
|
||||
"to": [ 13, 5, 3 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 3, 0, 13, 3 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 3, 0, 13, 3 ], "texture": "#texture1" },
|
||||
"north": { "uv": [ 3, 11, 13, 14 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 3, 11, 13, 14 ], "texture": "#texture" }
|
||||
}
|
||||
@@ -44,7 +45,7 @@
|
||||
"from": [ 3, 2, 13 ],
|
||||
"to": [ 13, 5, 16 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 3, 13, 13, 16 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 3, 13, 13, 16 ], "texture": "#texture1" },
|
||||
"north": { "uv": [ 3, 11, 13, 14 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 3, 11, 13, 14 ], "texture": "#texture" }
|
||||
}
|
||||
@@ -55,7 +56,7 @@
|
||||
"to": [ 16, 2, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" },
|
||||
"north": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 0, 14, 16, 16 ], "texture": "#texture" },
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 699 B |
Reference in New Issue
Block a user