New Tile! ~scribes~
This commit is contained in:
parent
e9b9deac75
commit
97c33e1697
28 changed files with 912 additions and 120 deletions
|
|
@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
@Mod(modid = Lib.modid, name = Lib.name, version = Lib.version, guiFactory = Lib.guifactory)
|
||||
public class CrissCross
|
||||
{
|
||||
public static CreativeTabs CCTab;
|
||||
public static CreativeTabs CCTab = new CreativeTab();
|
||||
|
||||
@Instance(Lib.modid)
|
||||
public static CrissCross instance;
|
||||
|
|
@ -35,7 +35,6 @@ public class CrissCross
|
|||
{
|
||||
ConfigHandler.init(event.getSuggestedConfigurationFile());
|
||||
MinecraftForge.EVENT_BUS.register(new ConfigHandler());
|
||||
CCTab = new CreativeTab();
|
||||
proxy.preInit();
|
||||
|
||||
LibBlocks.init();
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileMobGrinder;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockMobGrinder extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "mobGinder";
|
||||
|
||||
public BlockMobGrinder()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileMobGrinder.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileMobGrinder(meta);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.oitsjustjose.criss_cross.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.oitsjustjose.criss_cross.CrissCross;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileScribe;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockScribe extends BlockMachineBase
|
||||
{
|
||||
private static String unlocName = "Scribe";
|
||||
|
||||
public BlockScribe()
|
||||
{
|
||||
super(unlocName);
|
||||
GameRegistry.registerTileEntity(TileScribe.class, unlocName);
|
||||
GameRegistry.registerBlock(this, unlocName.toLowerCase());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(worldIn, pos, state, rand);
|
||||
|
||||
for (int i = -2; i <= 2; ++i)
|
||||
{
|
||||
for (int j = -2; j <= 2; ++j)
|
||||
{
|
||||
if (i > -2 && i < 2 && j == -1)
|
||||
j = 2;
|
||||
|
||||
if (rand.nextInt(16) == 0)
|
||||
{
|
||||
for (int k = 0; k <= 1; ++k)
|
||||
{
|
||||
BlockPos blockpos = pos.add(i, k, j);
|
||||
|
||||
if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2)))
|
||||
break;
|
||||
worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, (double) pos.getX() + 0.5D, (double) pos.getY() + 2.0D, (double) pos.getZ() + 0.5D, (double) ((float) i + rand
|
||||
.nextFloat()) - 0.5D, (double) ((float) k - rand.nextFloat() - 1.0F), (double) ((float) j + rand.nextFloat()) - 0.5D, new int[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileScribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileScribe)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileScribe) tileentity);
|
||||
world.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileScribe tile = (TileScribe) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
player.openGui(CrissCross.instance, GUIHandler.Scribe, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
package com.oitsjustjose.criss_cross.container;
|
||||
|
||||
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileScribe;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerScribe extends Container
|
||||
{
|
||||
TileScribe scribe;
|
||||
EntityPlayer player;
|
||||
|
||||
private int lastUseTime;
|
||||
private int lastChopTime;
|
||||
private int lastFuelTime;
|
||||
|
||||
public ContainerScribe(EntityPlayer player, TileScribe scribe)
|
||||
{
|
||||
this.player = player;
|
||||
this.scribe = scribe;
|
||||
|
||||
lastUseTime = 0;
|
||||
lastChopTime = 0;
|
||||
lastFuelTime = 0;
|
||||
|
||||
this.addSlotToContainer(new Slot(scribe, 0, 68, 35)); // input
|
||||
this.addSlotToContainer(new Slot(scribe, 1, 34, 35)); // book
|
||||
this.addSlotToContainer(new MachineOutputSlot(player, scribe, 2, 122, 35));
|
||||
this.addInventorySlots();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int timeType1, int timeType2)
|
||||
{
|
||||
switch (timeType1)
|
||||
{
|
||||
case 0:
|
||||
this.scribe.writingTime = timeType2;
|
||||
break;
|
||||
case 1:
|
||||
this.scribe.fuelTime = timeType2;
|
||||
break;
|
||||
case 2:
|
||||
this.scribe.fuelUsetime = timeType2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting crafting)
|
||||
{
|
||||
super.onCraftGuiOpened(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.scribe.writingTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.fuelUsetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
if (this.lastUseTime != this.scribe.writingTime)
|
||||
crafting.sendProgressBarUpdate(this, 0, this.scribe.writingTime);
|
||||
if (this.lastChopTime != this.scribe.fuelTime)
|
||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
||||
if (this.lastFuelTime != this.scribe.fuelUsetime)
|
||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.fuelUsetime);
|
||||
}
|
||||
this.lastUseTime = this.scribe.writingTime;
|
||||
this.lastChopTime = this.scribe.fuelTime;
|
||||
this.lastFuelTime = this.scribe.fuelUsetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotID == 2)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if (slotID != 1 && slotID != 0)
|
||||
{
|
||||
if (TileScribe.isValidForScribe(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (TileScribe.isBook(itemstack1))
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (slotID >= 3 && slotID < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.scribe.isUseableByPlayer(this.player);
|
||||
}
|
||||
|
||||
public final void addInventorySlots()
|
||||
{
|
||||
this.addInventorySlots(8, 84, 142);
|
||||
}
|
||||
|
||||
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
|
||||
{
|
||||
InventoryPlayer inventory = this.player.inventory;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 9; ++j)
|
||||
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
|
||||
}
|
||||
}
|
||||
|
|
@ -38,9 +38,7 @@ public class GUICobblegen extends GuiContainer
|
|||
|
||||
if (this.cobblegen.isUsingFuel())
|
||||
{
|
||||
int i1 = this.cobblegen.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.cobblegen.getProgressScaled(24);
|
||||
int i1 = this.cobblegen.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,18 @@ import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
|
|||
import com.oitsjustjose.criss_cross.container.ContainerCropomator;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerPouch;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerScribe;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerStonegen;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.items.ItemPouch;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCobblegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileScribe;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
|
@ -28,6 +29,7 @@ public class GUIHandler implements IGuiHandler
|
|||
public static final int Cobblegen = 4;
|
||||
public static final int Stonegen = 5;
|
||||
public static final int Pouch = 6;
|
||||
public static final int Scribe = 7;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
|
|
@ -64,6 +66,13 @@ public class GUIHandler implements IGuiHandler
|
|||
|
||||
return new ContainerStonegen(player, TE);
|
||||
}
|
||||
if (tile instanceof TileScribe)
|
||||
{
|
||||
TileScribe TE = (TileScribe) tile;
|
||||
|
||||
return new ContainerScribe(player, TE);
|
||||
}
|
||||
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPouch)
|
||||
{
|
||||
return new ContainerPouch(player, player.inventory.currentItem);
|
||||
|
|
@ -108,6 +117,12 @@ public class GUIHandler implements IGuiHandler
|
|||
|
||||
return new GUIStonegen(player, TE);
|
||||
}
|
||||
if (tile instanceof TileScribe)
|
||||
{
|
||||
TileScribe TE = (TileScribe) tile;
|
||||
|
||||
return new GUIScribe(player, TE);
|
||||
}
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemPouch)
|
||||
{
|
||||
return new GUIPouch(player, player.inventory.currentItem);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.oitsjustjose.criss_cross.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.oitsjustjose.criss_cross.container.ContainerScribe;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileScribe;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GUIScribe extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/scribe.png");
|
||||
|
||||
private TileScribe scribe;
|
||||
|
||||
public GUIScribe(EntityPlayer player, TileScribe scribe)
|
||||
{
|
||||
super(new ContainerScribe(player, scribe));
|
||||
this.scribe = scribe;
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.scribe"), 68, 7, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.scribe.isUsingFuel())
|
||||
{
|
||||
int i1 = this.scribe.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 89, l + 36, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,9 +38,7 @@ public class GUIStonegen extends GuiContainer
|
|||
|
||||
if (this.stonegen.isUsingFuel())
|
||||
{
|
||||
int i1 = this.stonegen.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.stonegen.getProgressScaled(24);
|
||||
int i1 = this.stonegen.getProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class ConfigHandler
|
|||
public static String electroextractorRecipeItem;
|
||||
public static String[] electroextractorEnergySources;
|
||||
public static String[] electroextractorOreDictInputs;
|
||||
public static String[] defaultElectroextractorOreDictInputs = new String[] { "Iron:12428902", "Gold:15400704", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", "Nickel:16580553" };
|
||||
public static String[] defaultElectroextractorOreDictInputs = new String[] { "Iron:12428902", "Gold:16772608", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", "Nickel:16580553" };
|
||||
public static String[] defaultElectroextractorEnergySources = new String[] { "minecraft:redstone_block" };
|
||||
|
||||
public static int woodchipperProcessTime;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.oitsjustjose.criss_cross.CrissCross;
|
|||
import com.oitsjustjose.criss_cross.blocks.BlockCobblegen;
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockCropomator;
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockScribe;
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockStonegen;
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||
|
|
@ -18,7 +19,7 @@ public class LibBlocks
|
|||
public static Block woodchipper;
|
||||
public static Block cobblegen;
|
||||
public static Block stonegen;
|
||||
public static Block mobGrinder;
|
||||
public static Block scribe;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
|
@ -27,7 +28,7 @@ public class LibBlocks
|
|||
woodchipper = new BlockWoodchipper();
|
||||
cobblegen = new BlockCobblegen();
|
||||
stonegen = new BlockStonegen();
|
||||
// mobGrinder = new BlockMobGrinder();
|
||||
scribe = new BlockScribe();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler());
|
||||
}
|
||||
}
|
||||
|
|
@ -27,14 +27,16 @@ public class LibItems
|
|||
|
||||
public static void init()
|
||||
{
|
||||
mkI = EnumHelper.addToolMaterial("mkI", 7, 6244, 8.0F, 0.0F, 0);
|
||||
|
||||
mkI = EnumHelper.addToolMaterial("mkI", 7, 6244, 8.0F, 1.0F, 10);
|
||||
mkI.setRepairItem(new ItemStack(Blocks.emerald_block));
|
||||
mkII = EnumHelper.addToolMaterial("mkII", 10, -1, 12.0F, 0.0F, 0);
|
||||
mkII = EnumHelper.addToolMaterial("mkII", 10, 1, 12.0F, 1.0F, 10);
|
||||
|
||||
dusts = new ItemDust();
|
||||
buckets = new ItemModBuckets();
|
||||
infiniApple = new ItemInfiniApple();
|
||||
pouch = new ItemPouch();
|
||||
|
||||
mantleSmasherMkI = new ItemMantleSmasher(mkI);
|
||||
mantleSmasherMkII = new ItemMantleSmasher(mkII);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
|||
import com.oitsjustjose.criss_cross.util.CCLog;
|
||||
import com.oitsjustjose.criss_cross.util.ItemHelper;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
|
@ -37,12 +39,13 @@ public class CCMachineRecipes
|
|||
initElectroextractorOreDictionary();
|
||||
initWoodchipperFuels();
|
||||
initWoodchipperOreDictionary();
|
||||
initScribeRecipes();
|
||||
|
||||
TileStonegen.addFuel(new ItemStack(Items.water_bucket));
|
||||
TileStonegen.addFuel(new ItemStack(LibItems.buckets));
|
||||
TileCobblegen.addFuel(new ItemStack(Items.water_bucket));
|
||||
TileCobblegen.addFuel(new ItemStack(LibItems.buckets));
|
||||
|
||||
|
||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, electroQTY));
|
||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), new ItemStack(Items.emerald, electroQTY));
|
||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, electroQTY));
|
||||
|
|
@ -62,6 +65,35 @@ public class CCMachineRecipes
|
|||
OreDictionary.registerOre("dust" + dustNames.get(i), new ItemStack(LibItems.dusts, 1, i));
|
||||
}
|
||||
|
||||
public static void initScribeRecipes()
|
||||
{
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.potionitem, 1, 8269), getEnchantedBook(Enchantment.aquaAffinity));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.spider_eye, 8), getEnchantedBook(Enchantment.baneOfArthropods));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.obsidian, 8), getEnchantedBook(Enchantment.blastProtection));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.waterlily, 8), getEnchantedBook(Enchantment.depthStrider));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.redstone_block, 8), getEnchantedBook(Enchantment.efficiency));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.feather, 32), getEnchantedBook(Enchantment.featherFalling));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.blaze_rod, 8), getEnchantedBook(Enchantment.fireAspect));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.blaze_powder, 16), getEnchantedBook(Enchantment.flame));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.lapis_block, 12), getEnchantedBook(Enchantment.fortune));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.diamond, 8), getEnchantedBook(Enchantment.infinity));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.piston, 4), getEnchantedBook(Enchantment.knockback));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.golden_apple, 2, 0), getEnchantedBook(Enchantment.looting));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.fishing_rod), getEnchantedBook(Enchantment.luckOfTheSea));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.fish, 16, 0), getEnchantedBook(Enchantment.lure));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.quartz, 48), getEnchantedBook(Enchantment.power));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.log, 16, Short.MAX_VALUE), getEnchantedBook(Enchantment.projectileProtection));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.log2, 16, Short.MAX_VALUE), getEnchantedBook(Enchantment.projectileProtection));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.iron_block, 4), getEnchantedBook(Enchantment.protection));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.dropper, 4), getEnchantedBook(Enchantment.punch));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.fish, 16, 3), getEnchantedBook(Enchantment.respiration));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.quartz_block, 16), getEnchantedBook(Enchantment.sharpness));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.slime_block, 8), getEnchantedBook(Enchantment.silkTouch));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.rotten_flesh, 48), getEnchantedBook(Enchantment.smite));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.vine, 64), getEnchantedBook(Enchantment.thorns));
|
||||
ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.iron_ingot, 24), getEnchantedBook(Enchantment.unbreaking));
|
||||
}
|
||||
|
||||
public static void initCropomatorRecipes()
|
||||
{
|
||||
for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
|
||||
|
|
@ -312,6 +344,14 @@ public class CCMachineRecipes
|
|||
}
|
||||
}
|
||||
|
||||
static ItemStack getEnchantedBook(Enchantment enchantment)
|
||||
{
|
||||
ItemStack retBook = new ItemStack(Items.enchanted_book);
|
||||
Items.enchanted_book.addEnchantment(retBook, new EnchantmentData(enchantment, 1));
|
||||
|
||||
return retBook;
|
||||
}
|
||||
|
||||
static boolean doesOreNameExist(String oreName)
|
||||
{
|
||||
List<ItemStack> ores = OreDictionary.getOres(oreName);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.oitsjustjose.criss_cross.recipes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ScribeRecipes
|
||||
{
|
||||
private static final ScribeRecipes recipeBase = new ScribeRecipes();
|
||||
private Map recipes = Maps.newHashMap();
|
||||
|
||||
public static ScribeRecipes getInstance()
|
||||
{
|
||||
return recipeBase;
|
||||
}
|
||||
|
||||
public void addRecipe(ItemStack input, ItemStack stack)
|
||||
{
|
||||
this.recipes.put(input, stack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack stack)
|
||||
{
|
||||
Iterator iterator = this.recipes.entrySet().iterator();
|
||||
Entry entry;
|
||||
|
||||
do
|
||||
{
|
||||
if (!iterator.hasNext())
|
||||
return null;
|
||||
|
||||
entry = (Entry) iterator.next();
|
||||
}
|
||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||
|
||||
return (ItemStack) entry.getValue();
|
||||
}
|
||||
|
||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()) && stack1.stackSize == stack2.stackSize;
|
||||
}
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,18 +19,16 @@ public class VanillaRecipes
|
|||
cropomatorRecipe();
|
||||
electroextractorRecipe();
|
||||
woodChipperRecipe();
|
||||
initBlockGeneratorRecipes();
|
||||
initOthers();
|
||||
}
|
||||
|
||||
static void initBlockGeneratorRecipes()
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.cobblegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "cobblestone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.stonegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "stone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
}
|
||||
|
||||
static void initOthers()
|
||||
{
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.cobblegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "cobblestone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.stonegen), "CPC", "#$#", "CPC", '$', "blockIron", 'C', "stone", 'P', Blocks.piston, '#', Items.stone_pickaxe));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibBlocks.scribe), "BWB", "FES", "BWB", 'B', Items.book, 'W', "plankWood", 'F', Items.feather, 'S', "dyeBlack", 'E', Blocks.enchanting_table));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.buckets, 1, 0), "DFD", "WBW", "DFD", 'W', Items.water_bucket, 'B', Items.bucket, 'D', "gemDiamond", 'F', "blockDiamond"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.buckets, 1, 1), "OGO", "GBG", "OGO", 'B', Items.bucket, 'G', "blockGlass", 'O', Blocks.obsidian));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(LibItems.infiniApple, 1, 0), "###", "#N#", "###", '#', new ItemStack(Items.golden_apple, 1, 1), 'N', Items.nether_star));
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
public ItemStack removeStackFromSlot(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
|
|
@ -415,7 +415,7 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cobblegen";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
public ItemStack removeStackFromSlot(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
|
|
@ -411,7 +411,7 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cropomator";
|
||||
}
|
||||
|
|
@ -445,5 +445,4 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
|||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
public ItemStack removeStackFromSlot(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
|
|
@ -400,7 +400,7 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cobblegen";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileMobGrinder extends TileEntity implements ITickable
|
||||
{
|
||||
int facing;
|
||||
|
||||
public TileMobGrinder(int dir)
|
||||
{
|
||||
super();
|
||||
this.facing = dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
World world = this.worldObj;
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB getAABBForFacing(BlockPos pos, int facing)
|
||||
{
|
||||
switch (facing)
|
||||
{
|
||||
case 2:
|
||||
return new AxisAlignedBB(pos, pos.north(3));
|
||||
case 3:
|
||||
return new AxisAlignedBB(pos, pos.south(3));
|
||||
case 4:
|
||||
return new AxisAlignedBB(pos, pos.west(3));
|
||||
case 5:
|
||||
return new AxisAlignedBB(pos, pos.east(3));
|
||||
default:
|
||||
return new AxisAlignedBB(pos, pos);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
package com.oitsjustjose.criss_cross.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.oitsjustjose.criss_cross.blocks.BlockScribe;
|
||||
import com.oitsjustjose.criss_cross.container.ContainerScribe;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
import com.oitsjustjose.criss_cross.recipes.ScribeRecipes;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityLockable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileScribe extends TileEntityLockable implements ITickable, ISidedInventory
|
||||
{
|
||||
// TODO: change this back to 700.
|
||||
private static int proTicks = 700;
|
||||
private static final int[] slotsTop = new int[] { 0 };
|
||||
private static final int[] slotsBottom = new int[] { 2, 1 };
|
||||
private static final int[] slotsSides = new int[] { 1 };
|
||||
private static String customName;
|
||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||
|
||||
public int fuelTime;
|
||||
public int writingTime;
|
||||
public int fuelUsetime;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
boolean flag = this.fuelTime > 0;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
--this.fuelTime;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||
{
|
||||
if (this.fuelTime == 0 && this.canProcess())
|
||||
{
|
||||
this.fuelUsetime = this.fuelTime = getBookUseTime(this.ItemStacks[1]);
|
||||
|
||||
if (this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
|
||||
if (this.ItemStacks[1] != null)
|
||||
{
|
||||
--this.ItemStacks[1].stackSize;
|
||||
|
||||
if (this.ItemStacks[1].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isUsingFuel() && this.canProcess())
|
||||
{
|
||||
++this.writingTime;
|
||||
|
||||
if (this.writingTime == proTicks)
|
||||
{
|
||||
this.worldObj.playSoundEffect(this.pos.getX(), this.pos.getY(), this.pos.getZ(), "portal.portal", 0.5F, 1.0F);
|
||||
this.writingTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.writingTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != this.fuelTime > 0)
|
||||
{
|
||||
flag1 = true;
|
||||
BlockScribe.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return this.ItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return this.ItemStacks[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int qtyToDecr)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.ItemStacks[slot].stackSize <= qtyToDecr)
|
||||
{
|
||||
itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
|
||||
|
||||
if (this.ItemStacks[slot].stackSize == 0)
|
||||
{
|
||||
this.ItemStacks[slot] = null;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
ItemStack itemstack = this.ItemStacks[slot];
|
||||
this.ItemStacks[slot] = null;
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||
{
|
||||
this.ItemStacks[slot] = itemstack;
|
||||
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiID()
|
||||
{
|
||||
return Lib.modid + ":container.scribe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||
this.ItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.ItemStacks.length)
|
||||
{
|
||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.fuelTime = tag.getShort("FuelTime");
|
||||
this.writingTime = tag.getShort("WorkTime");
|
||||
if (this.ItemStacks[1] != null)
|
||||
this.fuelUsetime = getBookUseTime(this.ItemStacks[1]);
|
||||
else
|
||||
this.fuelUsetime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||
tag.setShort("WorkTime", (short) this.writingTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
{
|
||||
if (this.ItemStacks[i] != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.ItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProgressScaled(int par1)
|
||||
{
|
||||
return this.writingTime * par1 / proTicks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurnTimeRemainingScaled(int par1)
|
||||
{
|
||||
if (this.fuelUsetime == 0)
|
||||
{
|
||||
this.fuelUsetime = proTicks;
|
||||
}
|
||||
|
||||
return this.fuelTime * par1 / this.fuelUsetime;
|
||||
}
|
||||
|
||||
public boolean isUsingFuel()
|
||||
{
|
||||
return this.fuelTime > 0;
|
||||
}
|
||||
|
||||
private boolean canProcess()
|
||||
{
|
||||
ItemStack input = this.ItemStacks[0];
|
||||
if (input != null)
|
||||
{
|
||||
ItemStack output = ScribeRecipes.getInstance().getResult(input);
|
||||
if (output == null)
|
||||
return false;
|
||||
ItemStack outputSlot = this.ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
return true;
|
||||
if (!outputSlot.isItemEqual(output))
|
||||
return false;
|
||||
int result = outputSlot.stackSize + output.stackSize;
|
||||
return result <= output.getMaxStackSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidForScribe(ItemStack itemstack)
|
||||
{
|
||||
if (ScribeRecipes.getInstance().getResult(itemstack) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void processItem()
|
||||
{
|
||||
if (this.canProcess())
|
||||
{
|
||||
ItemStack input = ItemStacks[0];
|
||||
ItemStack output = ScribeRecipes.getInstance().getResult(input);
|
||||
ItemStack outputSlot = ItemStacks[2];
|
||||
if (outputSlot == null)
|
||||
{
|
||||
ItemStacks[2] = output.copy();
|
||||
}
|
||||
else if (outputSlot.isItemEqual(output))
|
||||
{
|
||||
outputSlot.stackSize += output.stackSize;
|
||||
}
|
||||
ItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getBookUseTime(ItemStack itemstack)
|
||||
{
|
||||
return isBook(itemstack) ? proTicks : 0;
|
||||
}
|
||||
|
||||
public static boolean isBook(ItemStack itemstack)
|
||||
{
|
||||
ItemStack temp = new ItemStack(Items.writable_book);
|
||||
if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return this.fuelTime;
|
||||
case 1:
|
||||
return this.fuelUsetime;
|
||||
case 2:
|
||||
return this.writingTime;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
this.fuelTime = value;
|
||||
break;
|
||||
case 1:
|
||||
this.fuelUsetime = value;
|
||||
break;
|
||||
case 2:
|
||||
this.writingTime = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||
this.ItemStacks[i] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.scribe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
|
||||
{
|
||||
return new ContainerScribe(playerInventory.player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 2 ? false : (slot == 1 ? isBook(itemstack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, EnumFacing direction)
|
||||
{
|
||||
return direction != EnumFacing.DOWN || slot != 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
public ItemStack removeStackFromSlot(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
|
|
@ -417,7 +417,7 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.cobblegen";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
public ItemStack removeStackFromSlot(int slot)
|
||||
{
|
||||
if (this.ItemStacks[slot] != null)
|
||||
{
|
||||
|
|
@ -415,7 +415,7 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName()
|
||||
public String getName()
|
||||
{
|
||||
return this.hasCustomName() ? this.customName : "container.woodchipper";
|
||||
}
|
||||
|
|
|
|||
30
src/main/resources/assets/crisscross/blockstates/scribe.json
Normal file
30
src/main/resources/assets/crisscross/blockstates/scribe.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"top": "crisscross:blocks/scribe/scribe_top",
|
||||
"front": "crisscross:blocks/scribe/scribe_front",
|
||||
"side": "crisscross:blocks/scribe/scribe_sides",
|
||||
"bottom": "crisscross:blocks/scribe/scribe_bottom"
|
||||
},
|
||||
"model": "crisscross:machine",
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,13 +4,12 @@ tile.CrissCross.ElectroExtractor.name=ElectroExtractor
|
|||
tile.CrissCross.WoodChipper.name=Wood Chipper
|
||||
tile.CrissCross.CobblestoneGenerator.name=Cobblestone Generator
|
||||
tile.CrissCross.StoneGenerator.name=Smooth Stone Generator
|
||||
tile.CrissCross.Scribe.name=Scribe
|
||||
|
||||
#Items
|
||||
#Dust Name Components
|
||||
item.CrissCross.trash.name=This is a bad item, please trash it.
|
||||
item.CrissCross.dustPrefix=Electrolytic
|
||||
item.CrissCross.dustPostfix=Dust
|
||||
#Buckets
|
||||
item.CrissCross.everful_bucket.name=Everful Bucket
|
||||
item.CrissCross.void_bucket.name=Insatiable Bucket
|
||||
item.CrissCross.infini_apple.name=§cI§6n§ef§ai§2n§bi§3A§9p§1p§5l§de§r
|
||||
|
|
@ -27,6 +26,7 @@ container.electroextractor=ElectroExtractor
|
|||
container.woodchipper=Wood Chipper
|
||||
container.stonegen=Smooth Stone Generator
|
||||
container.cobblegen=Cobblestone Generator
|
||||
container.scribe=Scribe
|
||||
|
||||
#NEI Integration
|
||||
recipe.cropomatorfuel=Cropomator Fuels
|
||||
|
|
@ -35,8 +35,6 @@ recipe.electroextractor=ElectroExtractor
|
|||
recipe.electroextractorfuel=ElectorExtractor Fuels
|
||||
recipe.woodchipper=Wood Chipper
|
||||
recipe.woodchipperfuel=Wood Chipper Fuels
|
||||
recipe.stonegen=Smooth Stone Generator
|
||||
recipe.cobblegen=Cobblestone Generator
|
||||
|
||||
#Tab
|
||||
itemGroup.tabCrissCross=Criss Cross
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 617 B |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 417 B |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/main/resources/assets/crisscross/textures/gui/scribe.png
Normal file
BIN
src/main/resources/assets/crisscross/textures/gui/scribe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Loading…
Reference in a new issue