moved 1.11 to kfc
This commit is contained in:
36
kfc/src/main/java/nmd/primal/forgecraft/ClientEvents.java
Normal file
36
kfc/src/main/java/nmd/primal/forgecraft/ClientEvents.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package nmd.primal.forgecraft;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/15/17.
|
||||
*/
|
||||
public class ClientEvents {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
|
||||
public void toolTipOverride(ItemTooltipEvent event) {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
ItemStack held_stack = ((EntityPlayer) entity).getActiveItemStack();
|
||||
if(held_stack.getItem() instanceof CustomPickaxe){
|
||||
event.getToolTip().clear();
|
||||
if(entity.getEntityWorld().isRemote) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
125
kfc/src/main/java/nmd/primal/forgecraft/CommonEvents.java
Normal file
125
kfc/src/main/java/nmd/primal/forgecraft/CommonEvents.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package nmd.primal.forgecraft;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.items.tools.*;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/15/17.
|
||||
*/
|
||||
public class CommonEvents implements ToolNBT {
|
||||
|
||||
|
||||
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
|
||||
public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
|
||||
|
||||
if(!event.player.getEntityWorld().isRemote) {
|
||||
|
||||
if (event.crafting.getItem() instanceof CustomPickaxe || event.crafting.getItem() instanceof BronzePickaxe) {
|
||||
NBTTagCompound tempTag = new NBTTagCompound();
|
||||
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
|
||||
|
||||
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
|
||||
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
|
||||
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.crafting.getItem() instanceof CustomAxe || event.crafting.getItem() instanceof BronzeAxe) {
|
||||
NBTTagCompound tempTag = new NBTTagCompound();
|
||||
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
|
||||
|
||||
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
|
||||
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
|
||||
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.crafting.getItem() instanceof CustomShovel || event.crafting.getItem() instanceof BronzeShovel) {
|
||||
NBTTagCompound tempTag = new NBTTagCompound();
|
||||
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
|
||||
|
||||
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
|
||||
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
|
||||
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.crafting.getItem() instanceof CustomHoe || event.crafting.getItem() instanceof BronzeHoe) {
|
||||
NBTTagCompound tempTag = new NBTTagCompound();
|
||||
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
|
||||
|
||||
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
|
||||
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
|
||||
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.crafting.getItem() instanceof ToolPart || event.crafting.getItem() instanceof BronzeToolPart) {
|
||||
NBTTagCompound tempTag = new NBTTagCompound();
|
||||
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
|
||||
|
||||
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
|
||||
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
|
||||
if (a.getItem() instanceof CustomAxe || a.getItem() instanceof BronzeAxe) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
|
||||
event.crafting.setItemDamage(tempDamage);
|
||||
}
|
||||
if (a.getItem() instanceof CustomPickaxe || a.getItem() instanceof BronzePickaxe) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
|
||||
event.crafting.setItemDamage(tempDamage);
|
||||
}
|
||||
if (a.getItem() instanceof CustomShovel || a.getItem() instanceof BronzeShovel) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
|
||||
event.crafting.setItemDamage(tempDamage);
|
||||
}
|
||||
if (a.getItem() instanceof CustomHoe || a.getItem() instanceof BronzeHoe) {
|
||||
tempTag = a.getSubCompound("tags").copy();
|
||||
event.crafting.getTagCompound().setTag("tags", tempTag);
|
||||
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
|
||||
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
|
||||
event.crafting.setItemDamage(tempDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
70
kfc/src/main/java/nmd/primal/forgecraft/CommonUtils.java
Normal file
70
kfc/src/main/java/nmd/primal/forgecraft/CommonUtils.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package nmd.primal.forgecraft;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/23/2016.
|
||||
*/
|
||||
public class CommonUtils {
|
||||
|
||||
public static void print(Object object){
|
||||
System.out.println(object);
|
||||
}
|
||||
|
||||
public static int getVanillaItemBurnTime(ItemStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR)
|
||||
{
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
if (block == Blocks.WOODEN_SLAB) return 150;
|
||||
if (block.getDefaultState().getMaterial() == Material.WOOD) return 300;
|
||||
if (block == Blocks.COAL_BLOCK) return 16000;
|
||||
}
|
||||
|
||||
//if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
//if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
//if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
|
||||
if(item == Items.STICK) return 100;
|
||||
if(item == Items.COAL) return 1600;
|
||||
if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
|
||||
if (item == Items.BLAZE_ROD) return 2400;
|
||||
if (item == Items.BLAZE_POWDER) return 800;
|
||||
return GameRegistry.getFuelValue(stack);
|
||||
}
|
||||
|
||||
public static void spawnItemEntity(World world, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(world, player.posX, player.posY, player.posZ, stack); // player.posY - 1.0D
|
||||
world.spawnEntity(entityitem);
|
||||
|
||||
if (!(player instanceof FakePlayer))
|
||||
entityitem.onCollideWithPlayer(player);
|
||||
}
|
||||
|
||||
public static void spawnItemEntityFromWorld(World world, BlockPos pos, ItemStack stack){
|
||||
EntityItem entityitem = new EntityItem(world, pos.getX(), pos.getY() + 1, pos.getZ(), stack); // player.posY - 1.0D
|
||||
world.spawnEntity(entityitem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
81
kfc/src/main/java/nmd/primal/forgecraft/ForgeCraft.java
Normal file
81
kfc/src/main/java/nmd/primal/forgecraft/ForgeCraft.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package nmd.primal.forgecraft;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import nmd.primal.forgecraft.compat.ModDictionary;
|
||||
import nmd.primal.forgecraft.gui.GuiHandler;
|
||||
import nmd.primal.forgecraft.init.*;
|
||||
import nmd.primal.forgecraft.proxy.CommonProxy;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
//import nmd.primal.forgecraft.common.init.*;
|
||||
|
||||
@Mod( modid = ModInfo.MOD_ID,
|
||||
name = ModInfo.MOD_ID,
|
||||
version = ModInfo.MOD_VERSION,
|
||||
acceptedMinecraftVersions = ModInfo.MC_VERSIONS,
|
||||
dependencies = ModInfo.DEPENDENCIES
|
||||
//guiFactory = ModInfo.GUI_FACTORY,
|
||||
//updateJSON = ModInfo.UPDATE_JSON
|
||||
)
|
||||
public class ForgeCraft
|
||||
{
|
||||
@Instance
|
||||
public static ForgeCraft instance;
|
||||
public static SimpleNetworkWrapper NETWORK;
|
||||
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.SERVER_PROXY)
|
||||
public static CommonProxy proxy;
|
||||
public static Logger LOGGER = LogManager.getLogger(ModInfo.MOD_ID);
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
||||
|
||||
NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.MOD_CHANNEL);
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
|
||||
|
||||
ModBlocks.init();
|
||||
ModBlocks.register();
|
||||
ModItems.init();
|
||||
ModItems.register();
|
||||
|
||||
ModTiles.registerTileEntities();
|
||||
ModSounds.registerSounds();
|
||||
ModEvents.registerCommonEvents();
|
||||
//ModEvents.registerClientEvents();
|
||||
// ModItems.registerRenders();
|
||||
proxy.preInit();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
//this.proxy.init(event);
|
||||
proxy.init();
|
||||
ModDictionary.registerDictionaryNames();
|
||||
ModCrafting.register();
|
||||
|
||||
//proxy.registerModelBakeryVariants();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
//this.proxy.postInit(event);
|
||||
}
|
||||
|
||||
}
|
||||
39
kfc/src/main/java/nmd/primal/forgecraft/ModInfo.java
Normal file
39
kfc/src/main/java/nmd/primal/forgecraft/ModInfo.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package nmd.primal.forgecraft;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
//import nmd.primal.forgecraft.Item.ModItems;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/24/2016.
|
||||
*/
|
||||
public class ModInfo {
|
||||
/** Mod Details**/
|
||||
public static final String MOD_ID = "forgecraft";
|
||||
public static final String MOD_NAME = "Kitsu's ForgeCraft";
|
||||
public static final String MOD_CONFIG = "primal/" + MOD_ID;
|
||||
//public static final String MOD_PREFIX = MOD_ID + ":";
|
||||
public static final String MOD_CHANNEL = MOD_ID;
|
||||
public static final String MOD_VERSION = "1.2.51";
|
||||
public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
|
||||
public static final String DEPENDENCIES = "required-after:forge@[13.20.0.2315,);" + "required-after:primal@[0.4,);";
|
||||
|
||||
/** Mod Structures **/
|
||||
public static final String SERVER_PROXY = "nmd.primal.forgecraft.proxy.ServerProxy";
|
||||
public static final String CLIENT_PROXY = "nmd.primal.forgecraft.proxy.ClientProxy";
|
||||
//public static final String GUI_FACTORY = "nmd.primal.forgecraft.gui.GuiFactory";
|
||||
//public static final String UPDATE_JSON = "";
|
||||
|
||||
/** Creative Tabs **/
|
||||
public static CreativeTabs TAB_FORGECRAFT = new CreativeTabs(MOD_ID)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(ModItems.forgehammer);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package nmd.primal.forgecraft.blocks.Anvil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
import nmd.primal.forgecraft.util.AnvilHandler;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/11/17.
|
||||
*/
|
||||
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
|
||||
|
||||
private boolean anvil;
|
||||
|
||||
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
|
||||
super(material, registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
setHardness(hardness);
|
||||
this.setIsAnvil(anvil);
|
||||
}
|
||||
|
||||
public boolean isAnvil() {
|
||||
return anvil;
|
||||
}
|
||||
|
||||
public void setIsAnvil(boolean anvil) {
|
||||
anvil = anvil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
AnvilHandler.doDrops(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileAnvil();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
//if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( state.getValue(FACING) == EnumFacing.EAST) {
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.WEST) {
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.SOUTH){
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.NORTH){
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
IBlockState iblockstate = this.getDefaultState();
|
||||
|
||||
if (meta == 0){
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
|
||||
}
|
||||
if (meta == 1) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
|
||||
}
|
||||
if (meta == 2) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
|
||||
}
|
||||
if (meta == 3) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
|
||||
}
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package nmd.primal.forgecraft.blocks.Anvil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
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.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.common.items.tools.WorkMallet;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
import nmd.primal.forgecraft.util.AnvilHandler;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/10/17.
|
||||
*/
|
||||
public class AnvilIron extends AnvilBase implements AnvilHandler {
|
||||
|
||||
public AnvilIron(Material material, String registryName, Float hardness, Boolean anvil) {
|
||||
super(material, registryName, hardness, anvil);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
|
||||
|
||||
/******************************************************************************
|
||||
Crafting AnvilStone Recipes
|
||||
*****************************************************************************/
|
||||
if (!world.isRemote) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
|
||||
String[] tempArray = new String[25];
|
||||
for (int i = 0; i < 25; i++) {
|
||||
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
|
||||
}
|
||||
/*for (int i = 0; i < 25; i++) {
|
||||
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
|
||||
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_BASIC_STEEL
|
||||
|| ((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_CLEAN_IRON
|
||||
|| ((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON
|
||||
) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
|
||||
this.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
|
||||
return true;
|
||||
}
|
||||
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package nmd.primal.forgecraft.blocks.Anvil;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/10/17.
|
||||
*/
|
||||
public class AnvilSteel {
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package nmd.primal.forgecraft.blocks.Anvil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.core.api.PrimalMaterials;
|
||||
import nmd.primal.core.common.items.tools.WorkMallet;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/4/17.
|
||||
*/
|
||||
public class AnvilStone extends AnvilBase {
|
||||
|
||||
public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
|
||||
super(material, registryName, hardness, anvil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
|
||||
|
||||
/******************************************************************************
|
||||
Crafting AnvilStone Recipes
|
||||
*****************************************************************************/
|
||||
if (!world.isRemote) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
|
||||
String[] tempArray = new String[25];
|
||||
for (int i = 0; i < 25; i++) {
|
||||
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
|
||||
}
|
||||
for (int i = 0; i < 25; i++) {
|
||||
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
|
||||
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
|
||||
return true;
|
||||
}
|
||||
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/6/17.
|
||||
*/
|
||||
public class BlockBase extends Block{
|
||||
|
||||
public BlockBase(Material material, String registryName, Float hardness) {
|
||||
super(material);
|
||||
setUnlocalizedName(registryName);
|
||||
setRegistryName(registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setHardness(hardness);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/6/17.
|
||||
*/
|
||||
public class BlockCustomBase extends BlockBase {
|
||||
|
||||
public AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
|
||||
public BlockCustomBase(Material material, String registryName, Float hardness) {
|
||||
super(material, registryName, hardness);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return boundBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
}
|
||||
417
kfc/src/main/java/nmd/primal/forgecraft/blocks/BloomeryBase.java
Normal file
417
kfc/src/main/java/nmd/primal/forgecraft/blocks/BloomeryBase.java
Normal file
@@ -0,0 +1,417 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.core.common.crafting.FireSource;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/11/17.
|
||||
*/
|
||||
public class BloomeryBase extends CustomContainerFacing implements ITileEntityProvider {
|
||||
|
||||
//public static final PropertyBool COVERED = PropertyBool.create("covered");
|
||||
private int maxHeat;
|
||||
|
||||
public BloomeryBase(Material material, String registryName, Integer maxHeat) {
|
||||
super(material, registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
|
||||
setHardness(3.0f);
|
||||
setResistance(5.0f);
|
||||
this.maxHeat=maxHeat;
|
||||
}
|
||||
|
||||
public int getMaxHeat() {
|
||||
return maxHeat;
|
||||
}
|
||||
|
||||
public void setMaxHeat(int maxHeat) {
|
||||
this.maxHeat = maxHeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileBloomery();
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
{
|
||||
this.updateTick(world, pos, state, random);
|
||||
if(!world.isRemote){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true) {
|
||||
FireHelper.makeSmoke(world, pos, 50);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
ItemStack tileItem = tile.getSlotStack(0);
|
||||
ItemStack tileItem1 = tile.getSlotStack(1);
|
||||
if(pItem.isEmpty()) {
|
||||
|
||||
if(!player.isSneaking()){
|
||||
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
|
||||
Integer bloomeryHeat = tile.getHeat();
|
||||
Integer idealTemp = null;
|
||||
Integer cookCounter = tile.getCookCounter();
|
||||
Integer idealCookTime = null;
|
||||
Integer remainingTime = null;
|
||||
|
||||
String stringBloomeryHeat = bloomeryHeat.toString();
|
||||
String stringIdealTemp = "";
|
||||
String stringRemainingTime = "";
|
||||
|
||||
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(tile.getSlotStack(1));
|
||||
if(recipe != null) {
|
||||
idealTemp = recipe.getHeatThreshold();
|
||||
idealCookTime = recipe.getIdealTime();
|
||||
stringIdealTemp = idealTemp.toString();
|
||||
remainingTime = idealCookTime - cookCounter;
|
||||
stringRemainingTime = remainingTime.toString();
|
||||
|
||||
}
|
||||
String display =
|
||||
"Current Temp: " + stringBloomeryHeat
|
||||
+ "Ideal Temp: " + stringIdealTemp
|
||||
+ "Ticks Remaining: " + stringRemainingTime
|
||||
+ "Fuel Remaining: " + tile.getSlotStack(0).getCount();
|
||||
ITextComponent itextcomponent = new TextComponentString(display);
|
||||
player.sendStatusMessage(itextcomponent, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tile.getSlotStack(0) != ItemStack.EMPTY) {
|
||||
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
|
||||
tile.setHeat(100);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
||||
if (!tileItem.isEmpty()){
|
||||
if(pItem.getItem() == tileItem.getItem()){
|
||||
if(tileItem.getCount() < 64){
|
||||
if(tileItem.getCount() + pItem.getCount() <= 64){
|
||||
tileItem.grow(pItem.getCount());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if(tileItem.getCount() + pItem.getCount() > 64){
|
||||
pItem.setCount(64-pItem.getCount());
|
||||
tileItem.setCount(64);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tileItem.isEmpty()) {
|
||||
tile.setSlotStack(0, pItem);
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if((!pItem.isEmpty()) && tile.isItemValidForSlot(1, pItem)) {
|
||||
if (!tileItem1.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if(tileItem1.isEmpty()){
|
||||
ItemStack tempItem = new ItemStack(pItem.getItem(), 1);
|
||||
tile.setSlotStack(1, tempItem);
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (player.isSneaking()) {
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||
ItemStack returnStack = tile.getSlotStack(0).copy();
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
|
||||
tile.clearSlot(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
int lightState =0;
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
lightState = 10;
|
||||
}
|
||||
return lightState;
|
||||
}
|
||||
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
if(!world.isRemote){
|
||||
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
|
||||
{
|
||||
if(ent instanceof EntityPlayer){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
ent.setFire(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
|
||||
{
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
|
||||
if (tile !=null)
|
||||
{
|
||||
for (ItemStack stack : tile.getSlotList())
|
||||
{
|
||||
if (stack != null) {
|
||||
float offset = 0.7F;
|
||||
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
|
||||
item.setDefaultPickupDelay();
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 4;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 5;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 6;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 7;
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumFacing enumfacing;
|
||||
Boolean active;
|
||||
switch (meta & 7)
|
||||
{
|
||||
case 0:
|
||||
enumfacing = EnumFacing.EAST;
|
||||
active = false;
|
||||
break;
|
||||
case 1:
|
||||
enumfacing = EnumFacing.WEST;
|
||||
active = false;
|
||||
break;
|
||||
case 2:
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
active = false;
|
||||
break;
|
||||
case 3:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = false;
|
||||
break;
|
||||
case 4:
|
||||
enumfacing = EnumFacing.EAST;
|
||||
active = true;
|
||||
break;
|
||||
case 5:
|
||||
enumfacing = EnumFacing.WEST;
|
||||
active = true;
|
||||
break;
|
||||
case 6:
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
active = true;
|
||||
break;
|
||||
case 7:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = true;
|
||||
break;
|
||||
default:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = false;
|
||||
}
|
||||
|
||||
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true)
|
||||
{
|
||||
double d0 = (double)pos.getX() + 0.5D;
|
||||
double d1 = (double)pos.getY() + 0.2D;
|
||||
double d2 = (double)pos.getZ() + 0.5D;
|
||||
double d3 = 0.52D;
|
||||
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
|
||||
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
|
||||
|
||||
if (rand.nextDouble() < 0.1D)
|
||||
{
|
||||
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
|
||||
}
|
||||
if(rand.nextInt(4) == 1){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 2){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 3){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 4){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
242
kfc/src/main/java/nmd/primal/forgecraft/blocks/Breaker.java
Normal file
242
kfc/src/main/java/nmd/primal/forgecraft/blocks/Breaker.java
Normal file
@@ -0,0 +1,242 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.core.common.items.tools.WorkMallet;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.tiles.TileBreaker;
|
||||
import nmd.primal.forgecraft.util.BreakerHandler;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 4/9/17.
|
||||
*/
|
||||
public class Breaker extends CustomContainerFacing implements BreakerHandler {
|
||||
|
||||
public Breaker(Material material, String registryName, Float hardness) {
|
||||
super(material, registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false));
|
||||
setHardness(hardness);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
|
||||
|
||||
if(!world.isRemote){
|
||||
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
|
||||
/*if(tile.getCharge() < 5 ){
|
||||
if(pItem == ItemStack.EMPTY){
|
||||
if(player.isSneaking()){
|
||||
ItemStack tempStack = tile.getSlotStack(0).copy();
|
||||
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
|
||||
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, false));
|
||||
doBreaking(world, state, pos, tile);
|
||||
tile.setCharge(0);
|
||||
return true;
|
||||
}
|
||||
if(!player.isSneaking() && pItem.isEmpty()) {
|
||||
if (!state.getValue(PrimalStates.ACTIVE)) {
|
||||
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, true), 2);
|
||||
return true;
|
||||
}
|
||||
if(state.getValue(PrimalStates.ACTIVE)) {
|
||||
if (tile.getCharge() < 181) {
|
||||
tile.setCharge(tile.getCharge() + 2.0f);
|
||||
tile.updateBlock();
|
||||
//System.out.println(tile.charge);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pItem.getItem() instanceof WorkMallet){
|
||||
tile.setSlotStack(0, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
|
||||
{
|
||||
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
|
||||
if (tile !=null)
|
||||
{
|
||||
for (ItemStack stack : tile.getSlotList())
|
||||
{
|
||||
if (stack != null) {
|
||||
float offset = 0.7F;
|
||||
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
|
||||
item.setDefaultPickupDelay();
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileBreaker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
//if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if(state.getValue(PrimalStates.ACTIVE ) == false) {
|
||||
if (state.getValue(FACING) == EnumFacing.EAST) {
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.WEST) {
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.SOUTH) {
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
if(state.getValue(PrimalStates.ACTIVE)) {
|
||||
if (state.getValue(FACING) == EnumFacing.EAST) {
|
||||
i = 4;
|
||||
return i;
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.WEST) {
|
||||
i = 5;
|
||||
return i;
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.SOUTH) {
|
||||
i = 6;
|
||||
return i;
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
i = 7;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
IBlockState iblockstate = this.getDefaultState();
|
||||
|
||||
if (meta == 0){
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, false);
|
||||
}
|
||||
if (meta == 1) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, false);
|
||||
}
|
||||
if (meta == 2) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, false);
|
||||
}
|
||||
if (meta == 3) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false);
|
||||
}
|
||||
if (meta == 4){
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, true);
|
||||
}
|
||||
if (meta == 5) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, true);
|
||||
}
|
||||
if (meta == 6) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, true);
|
||||
}
|
||||
if (meta == 7) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, true);
|
||||
}
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE, FACING});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
}
|
||||
667
kfc/src/main/java/nmd/primal/forgecraft/blocks/CastingBlock.java
Normal file
667
kfc/src/main/java/nmd/primal/forgecraft/blocks/CastingBlock.java
Normal file
@@ -0,0 +1,667 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.CommonUtils;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.casting.CastingPart;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingBlock;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/24/17.
|
||||
*/
|
||||
public class CastingBlock extends CustomContainerFacing {
|
||||
|
||||
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 5.5/16D, 16/16D);
|
||||
|
||||
public CastingBlock(Material material, String registryName) {
|
||||
super(material, registryName);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
}
|
||||
private void makeEmbers(World world, BlockPos pos, Random rand){
|
||||
double d0 = (double)pos.getX() + 0.5D;
|
||||
double d1 = (double)pos.getY() + 0.2D;
|
||||
double d2 = (double)pos.getZ() + 0.5D;
|
||||
double d3 = 0.52D;
|
||||
double d4 = ThreadLocalRandom.current().nextDouble(0.066, 0.33);
|
||||
double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
|
||||
|
||||
if(rand.nextInt(3) == 0){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(3) == 1){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(3) == 2){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(3) == 3){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
|
||||
|
||||
if (!world.isRemote) {
|
||||
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if(!tile.getSlotStack(0).isEmpty()){
|
||||
ItemStack copyStack = tile.getSlotStack(0).copy();
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, copyStack);
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(pItem.getItem() instanceof CastingPart){
|
||||
if(!player.isSneaking()) {
|
||||
if (tile.getSlotStack(0).isEmpty()) {
|
||||
ItemStack copyStack = pItem.copy();
|
||||
copyStack.setCount(1);
|
||||
pItem.shrink(1);
|
||||
tile.setSlotStack(0, copyStack);
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pItem.getItem() == ModItems.stonetongs ){
|
||||
if(pItem.getTagCompound().getInteger("type") == 40){
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
//makeEmbers(world, pos, world.rand);
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/***************************
|
||||
* Bronze *
|
||||
*
|
||||
46 | Hot Cooked Bronze Crucible Emerald
|
||||
48 | Hot Cooked Bronze Crucible Diamond
|
||||
50 | Hot Cooked Bronze Crucible Redstone
|
||||
52 | Hot Cooked Bronze Crucible Lapis
|
||||
***************************/
|
||||
if(pItem.getTagCompound().getInteger("type") == 46){
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", true);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", true);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", true);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", true);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(pItem.getTagCompound().getInteger("type") == 48) {
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if (CommonUtils.randomCheck(2)) {
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if (CommonUtils.randomCheck(2)) {
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if (CommonUtils.randomCheck(2)) {
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if (CommonUtils.randomCheck(2)) {
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if (CommonUtils.randomCheck(2)) {
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(pItem.getTagCompound().getInteger("type") == 50) {
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(pItem.getTagCompound().getInteger("type") == 52) {
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
dropStack.getTagCompound().setTag("tags", tags);
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
dropStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
dropStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
dropStack.getSubCompound("tags").setInteger("lapis", 1);
|
||||
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
|
||||
|
||||
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
if(CommonUtils.randomCheck(2)){
|
||||
tile.setSlotStack(0, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
|
||||
{
|
||||
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
|
||||
if (tile !=null)
|
||||
{
|
||||
for (ItemStack stack : tile.getSlotList())
|
||||
{
|
||||
if (stack != null) {
|
||||
float offset = 0.7F;
|
||||
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
|
||||
item.setDefaultPickupDelay();
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileCastingBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return bound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
//if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( state.getValue(FACING) == EnumFacing.EAST) {
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.WEST) {
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.SOUTH){
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.NORTH){
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
IBlockState iblockstate = this.getDefaultState();
|
||||
|
||||
if (meta == 0){
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
|
||||
}
|
||||
if (meta == 1) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
|
||||
}
|
||||
if (meta == 2) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
|
||||
}
|
||||
if (meta == 3) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
|
||||
}
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
170
kfc/src/main/java/nmd/primal/forgecraft/blocks/CastingForm.java
Normal file
170
kfc/src/main/java/nmd/primal/forgecraft/blocks/CastingForm.java
Normal file
@@ -0,0 +1,170 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.CommonUtils;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||
import nmd.primal.forgecraft.util.CastingFormHandler;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/19/17.
|
||||
*/
|
||||
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);
|
||||
|
||||
public CastingForm(Material material, String registryName) {
|
||||
super(material, registryName);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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);
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
if(CommonUtils.randomCheck(10)) {
|
||||
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
|
||||
String[] tempArray = new String[25];
|
||||
for (int i = 0; i < 25; i++) {
|
||||
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
|
||||
}
|
||||
doCraftingformCrafting(tempArray, world, tile, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileCastingForm();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return bound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
//if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( state.getValue(FACING) == EnumFacing.EAST) {
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.WEST) {
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.SOUTH){
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(FACING) == EnumFacing.NORTH){
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
IBlockState iblockstate = this.getDefaultState();
|
||||
|
||||
if (meta == 0){
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
|
||||
}
|
||||
if (meta == 1) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
|
||||
}
|
||||
if (meta == 2) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
|
||||
}
|
||||
if (meta == 3) {
|
||||
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
|
||||
}
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package nmd.primal.forgecraft.blocks.Crucibles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static nmd.primal.forgecraft.CommonUtils.spawnItemEntityFromWorld;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/24/17.
|
||||
*/
|
||||
public class Crucible extends Block {
|
||||
|
||||
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
|
||||
|
||||
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
|
||||
|
||||
public Crucible(Material material, String registryName) {
|
||||
super(material);
|
||||
setUnlocalizedName(registryName);
|
||||
setRegistryName(registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setHardness(3.0f);
|
||||
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if (!world.isRemote) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
if(pItem.isEmpty()){
|
||||
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
if(Block.getBlockFromItem(pItem.getItem()) == this){
|
||||
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
||||
ret.add(0, new ItemStack(ModBlocks.emptycrucible, 1));
|
||||
if(this.getUnlocalizedName()=="tile.coolironcrucible"){
|
||||
ret.add(1, new ItemStack(Items.IRON_INGOT, 1));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
if(!world.isRemote){
|
||||
if(this.getUnlocalizedName().equals("tile.emptycruciblecracked")){} else spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1));
|
||||
|
||||
if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) {
|
||||
if(checkDrops(this.getUnlocalizedName()) != null) {
|
||||
if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) {
|
||||
spawnItemEntityFromWorld(world, pos, new ItemStack(getItemFromName(this.getUnlocalizedName()), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String checkDrops(String name){
|
||||
String string = null;
|
||||
|
||||
if(name.equals("tile.coolironcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.rawironcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.coolcleanironcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.rawcleanironcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.coolsteelcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.rawsteelcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.coolwootzcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.rawwootzcrucible")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
if(name.equals("tile.emptycruciblecracked")){
|
||||
string = this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
private Item getItemFromName(String name){
|
||||
if(name.equals("tile.coolironcrucible")){
|
||||
return Item.getItemFromBlock(ModBlocks.ironball);
|
||||
} else if (name.equals("tile.rawironcrucible")){
|
||||
return Item.getItemFromBlock(Blocks.IRON_ORE);
|
||||
} else if (name.equals("tile.coolcleanironcrucible")){
|
||||
return Item.getItemFromBlock(ModBlocks.ironcleanball);
|
||||
} else if (name.equals("tile.rawcleanironcrucible")){
|
||||
return PrimalItems.IRON_DUST;
|
||||
} else if (name.equals("tile.coolsteelcrucible")){
|
||||
return Item.getItemFromBlock(ModBlocks.steelball);
|
||||
} else if (name.equals("tile.rawsteelcrucible")){
|
||||
return Item.getItemFromBlock(ModBlocks.ironcleanball);
|
||||
} else if (name.equals("tile.coolwootzcrucible")){
|
||||
return Item.getItemFromBlock(ModBlocks.wootzball);
|
||||
} else if (name.equals("tile.rawcleanironcrucible")){
|
||||
return PrimalItems.GOLDEN_STICK;
|
||||
}else if (name.equals("tile.emptycruciblecracked")){
|
||||
return Items.CLAY_BALL;
|
||||
}
|
||||
else return Items.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return boundBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package nmd.primal.forgecraft.blocks.Crucibles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDynamicLiquid;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/4/17.
|
||||
*/
|
||||
public class CrucibleHot extends Block implements ITileEntityProvider {
|
||||
|
||||
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
|
||||
|
||||
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
|
||||
|
||||
public CrucibleHot(Material material, String registryName) {
|
||||
super(material);
|
||||
setUnlocalizedName(registryName);
|
||||
setRegistryName(registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setHardness(3.0f);
|
||||
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileBaseCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return boundBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/4/17.
|
||||
*/
|
||||
public abstract class CustomContainer extends BlockContainer{
|
||||
|
||||
protected CustomContainer(Material material)
|
||||
{
|
||||
super(material);
|
||||
}
|
||||
|
||||
protected CustomContainer(Material material, MapColor color)
|
||||
{
|
||||
super(material, color);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 12/3/2016.
|
||||
*/
|
||||
public abstract class CustomContainerFacing extends BlockContainer {
|
||||
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
|
||||
|
||||
protected CustomContainerFacing(Material material, String registryName)
|
||||
{
|
||||
super(material);
|
||||
this.setRegistryName(registryName);
|
||||
this.setUnlocalizedName(registryName);
|
||||
this.setHardness(3.0f);
|
||||
this.setResistance(4.0f);
|
||||
}
|
||||
|
||||
protected CustomContainerFacing(Material material, MapColor color)
|
||||
{
|
||||
super(material, color);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/1/17.
|
||||
*/
|
||||
public abstract class CustomFacing extends Block {
|
||||
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
|
||||
|
||||
protected CustomFacing(Material material)
|
||||
{
|
||||
super(material);
|
||||
}
|
||||
|
||||
protected CustomFacing(Material material, MapColor color)
|
||||
{
|
||||
super(material, color);
|
||||
}
|
||||
}
|
||||
494
kfc/src/main/java/nmd/primal/forgecraft/blocks/Forge.java
Normal file
494
kfc/src/main/java/nmd/primal/forgecraft/blocks/Forge.java
Normal file
@@ -0,0 +1,494 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.core.common.crafting.FireSource;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
||||
|
||||
//import nmd.primal.core.api.PrimalBlocks;
|
||||
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class Forge extends CustomContainerFacing implements ITileEntityProvider{
|
||||
|
||||
private int maxHeat;
|
||||
//public static final PropertyBool PrimalStates.ACTIVE = PropertyBool.create("PrimalStates.ACTIVE");
|
||||
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
|
||||
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
|
||||
public Forge(Material material, String name, Integer maxHeat) {
|
||||
super(material, name);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
|
||||
setHardness(3.0f);
|
||||
setResistance(5.0f);
|
||||
this.maxHeat=maxHeat;
|
||||
}
|
||||
|
||||
public int getMaxHeat() {
|
||||
return maxHeat;
|
||||
}
|
||||
|
||||
public void setMaxHeat(int maxHeat) {
|
||||
this.maxHeat = maxHeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileForge();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return collideBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return boundBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
ItemStack fuelItem = tile.getSlotStack(0);
|
||||
//System.out.println(pItem.getItem().getRegistryName().toString());
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************
|
||||
FUEL SLOT CODE
|
||||
***********************/
|
||||
|
||||
if (player.isSneaking()) {
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||
ItemStack returnStack = tile.getSlotStack(0).copy();
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
|
||||
tile.clearSlot(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(pItem.isEmpty()) {
|
||||
if(!player.isSneaking()){
|
||||
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
|
||||
Integer tempInt = tile.getHeat();
|
||||
String tempString = tempInt.toString();
|
||||
ITextComponent itextcomponent = new TextComponentString(tempString);
|
||||
player.sendStatusMessage(itextcomponent, true);
|
||||
//System.out.println(pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
|
||||
tile.setHeat(100);
|
||||
tile.markDirty();
|
||||
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);
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/***********************
|
||||
FORGING SLOTS CODE
|
||||
***********************/
|
||||
//REMOVE COOL INGOT
|
||||
if(facing == EnumFacing.UP ) {
|
||||
/*if (pItem.isEmpty()) {
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
//System.out.println(i);
|
||||
if (!tile.getSlotStack(i).isEmpty()) {
|
||||
if (Block.getBlockFromItem(tile.getSlotStack(i).getItem()) instanceof IngotBall) {
|
||||
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(i).hasTagCompound() == true){
|
||||
if (tile.getSlotStack(i).getTagCompound().getBoolean("hot") == false) {
|
||||
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
if (Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) {
|
||||
//System.out.println("Activating");
|
||||
for (int i = 2; i <= tile.getSlotListSize(); i++) {
|
||||
if (tile.getSlotStack(i).isEmpty()) {
|
||||
tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Needs Ore Dictionary Compat
|
||||
if (pItem.getItem().equals(new ItemStack(Items.IRON_INGOT).getItem())) {
|
||||
for (int i = 2; i < 7; i++) {
|
||||
if (tile.getSlotStack(i).isEmpty()) {
|
||||
tile.setSlotStack(i, new ItemStack(Items.IRON_INGOT, 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pItem.getItem() instanceof ToolPart){
|
||||
if(tile.getSlotStack(4).isEmpty()){
|
||||
//System.out.println("Adding player Item to slot");
|
||||
tile.setSlotStack(4, pItem);
|
||||
//System.out.println(tile.getSlotStack(4));
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//System.out.println(tile.getSlotStack(0));
|
||||
//System.out.println(tile.getSlotStack(1));
|
||||
//System.out.println(tile.getSlotStack(2));
|
||||
//System.out.println(tile.getSlotStack(3));
|
||||
//System.out.println(tile.getSlotStack(4));
|
||||
//System.out.println(tile.getSlotStack(5));
|
||||
//System.out.println(tile.getSlotStack(6));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
|
||||
{
|
||||
//if (!world.isRemote){
|
||||
if(ent instanceof EntityPlayer){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
ent.setFire(1);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
return 15;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
if (side == EnumFacing.UP)
|
||||
{
|
||||
if(!world.isRemote){
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if(tile.getSlotStack(0) != ItemStack.EMPTY){
|
||||
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
|
||||
{
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if (tile !=null)
|
||||
{
|
||||
for (ItemStack stack : tile.getSlotList())
|
||||
{
|
||||
if (stack != null) {
|
||||
float offset = 0.7F;
|
||||
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
|
||||
item.setDefaultPickupDelay();
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
|
||||
return state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 4;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 5;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 6;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
|
||||
i = 7;
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumFacing enumfacing;
|
||||
Boolean active;
|
||||
switch (meta & 7)
|
||||
{
|
||||
case 0:
|
||||
enumfacing = EnumFacing.EAST;
|
||||
active = false;
|
||||
break;
|
||||
case 1:
|
||||
enumfacing = EnumFacing.WEST;
|
||||
active = false;
|
||||
break;
|
||||
case 2:
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
active = false;
|
||||
break;
|
||||
case 3:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = false;
|
||||
break;
|
||||
case 4:
|
||||
enumfacing = EnumFacing.EAST;
|
||||
active = true;
|
||||
break;
|
||||
case 5:
|
||||
enumfacing = EnumFacing.WEST;
|
||||
active = true;
|
||||
break;
|
||||
case 6:
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
active = true;
|
||||
break;
|
||||
case 7:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = true;
|
||||
break;
|
||||
default:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = false;
|
||||
}
|
||||
|
||||
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
{
|
||||
this.updateTick(world, pos, state, random);
|
||||
if(!world.isRemote){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true) {
|
||||
makeSmoke(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true)
|
||||
{
|
||||
double d0 = (double)pos.getX() + 0.5D;
|
||||
double d1 = (double)pos.getY() + 0.96D;
|
||||
double d2 = (double)pos.getZ() + 0.5D;
|
||||
double d3 = 0.52D;
|
||||
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
|
||||
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
|
||||
|
||||
if (rand.nextDouble() < 0.1D)
|
||||
{
|
||||
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
|
||||
}
|
||||
if(rand.nextInt(4) == 1){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 2){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 3){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 4){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
119
kfc/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java
Normal file
119
kfc/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.BlockDynamicLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/6/17.
|
||||
*/
|
||||
public class IngotBall extends BlockCustomBase {
|
||||
|
||||
protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D);
|
||||
protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D);
|
||||
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
|
||||
private String type;
|
||||
|
||||
public IngotBall(Material material, String registryName, Float hardness, String type){
|
||||
super(material, registryName, hardness);
|
||||
this.type = type;
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
if(this.type.equals("chunk")){
|
||||
return boundBoxSmall;
|
||||
}else
|
||||
return boundBoxLarge;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
//System.out.println(stack.getItemDamage());
|
||||
worldIn.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
//System.out.println(state.getValue(ACTIVE));
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
|
||||
if(!world.isRemote){
|
||||
if(state.getValue(PrimalStates.ACTIVE)){
|
||||
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
|
||||
}
|
||||
if(!state.getValue(PrimalStates.ACTIVE)){
|
||||
//PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(this, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( state.getValue(PrimalStates.ACTIVE) == false) {
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( state.getValue(PrimalStates.ACTIVE) == true) {
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
IBlockState iblockstate = this.getDefaultState();
|
||||
|
||||
if (meta == 0){
|
||||
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
|
||||
}
|
||||
if (meta == 1) {
|
||||
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true));
|
||||
}
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
|
||||
{
|
||||
this.updateTick(world, pos, state, random);
|
||||
if(!world.isRemote){
|
||||
if ( ThreadLocalRandom.current().nextInt(0,4) == 0) {
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true) {
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,488 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModSounds;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
import nmd.primal.forgecraft.tiles.TilePistonBellows;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static nmd.primal.core.api.PrimalStates.ACTIVE;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/1/17.
|
||||
*/
|
||||
public class PistonBellows extends CustomContainerFacing {
|
||||
|
||||
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
|
||||
//protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
|
||||
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 12 / 16D, 1.0D);
|
||||
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 12 / 16D, 1.0D);
|
||||
protected static final AxisAlignedBB boundBoxEast = new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 12 / 16D, 1.0D);
|
||||
protected static final AxisAlignedBB boundBoxWest = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 12 / 16D, 0.8125D);
|
||||
|
||||
public PistonBellows(Material material, String registryName) {
|
||||
super(material, registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)));
|
||||
setHardness(3.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TilePistonBellows();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
|
||||
TilePistonBellows tile = (TilePistonBellows) worldIn.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if(!world.isRemote){
|
||||
//System.out.println(state.getValue(PistonBellows.FACING));
|
||||
if(state.getValue(ACTIVE) == false) {
|
||||
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
|
||||
//world.playSound(pos, ForgecraftSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f);
|
||||
//world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f, true);
|
||||
world.playSound(null, pos, ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 0.25F, 0.8F);
|
||||
//playSound(@Nullable EntityPlayer player, double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch)
|
||||
|
||||
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
|
||||
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.EAST)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
|
||||
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.WEST)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
|
||||
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.SOUTH)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
|
||||
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.NORTH)) {
|
||||
if (tile != null) {
|
||||
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
|
||||
tile.setHeat(tile.getHeat() + 50);
|
||||
tile.updateBlock();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
state = state.getActualState(source, pos);
|
||||
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
|
||||
|
||||
switch (enumfacing)
|
||||
{
|
||||
case EAST:
|
||||
default:
|
||||
return boundBoxEast;
|
||||
case SOUTH:
|
||||
return boundBoxSouth;
|
||||
case WEST:
|
||||
return boundBoxWest;
|
||||
case NORTH:
|
||||
return boundBoxNorth;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
/*if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
|
||||
{
|
||||
TilePistonBellows tile = (TilePistonBellows) world.getTileEntity(pos);
|
||||
if (tile !=null)
|
||||
{
|
||||
for (ItemStack stack : tile.getSlotList())
|
||||
{
|
||||
if (stack != null) {
|
||||
float offset = 0.7F;
|
||||
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
|
||||
item.setDefaultPickupDelay();
|
||||
world.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == false){
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == false){
|
||||
i = 1;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == false){
|
||||
i = 2;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == false){
|
||||
i = 3;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == true){
|
||||
i = 4;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == true){
|
||||
i = 5;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == true){
|
||||
i = 6;
|
||||
return i;
|
||||
}
|
||||
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == true){
|
||||
i = 7;
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumFacing enumfacing;
|
||||
Boolean active;
|
||||
|
||||
|
||||
|
||||
switch (meta & 7)
|
||||
{
|
||||
case 0:
|
||||
enumfacing = EnumFacing.EAST;
|
||||
active = false;
|
||||
break;
|
||||
case 1:
|
||||
enumfacing = EnumFacing.WEST;
|
||||
active = false;
|
||||
break;
|
||||
case 2:
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
active = false;
|
||||
break;
|
||||
case 3:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = false;
|
||||
break;
|
||||
case 4:
|
||||
enumfacing = EnumFacing.EAST;
|
||||
active = true;
|
||||
break;
|
||||
case 5:
|
||||
enumfacing = EnumFacing.WEST;
|
||||
active = true;
|
||||
break;
|
||||
case 6:
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
active = true;
|
||||
break;
|
||||
case 7:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = true;
|
||||
break;
|
||||
default:
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
active = false;
|
||||
}
|
||||
|
||||
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ACTIVE, Boolean.valueOf(active));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING, ACTIVE});
|
||||
}
|
||||
|
||||
//return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.CARDINALS, Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty });
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyOpaque(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
if(state.getValue(ACTIVE) == Boolean.TRUE) {
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.EAST)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.WEST)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.SOUTH)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) {
|
||||
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
|
||||
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.NORTH)) {
|
||||
makeEmbers(world, tempPos, world.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void makeEmbers(World world, BlockPos pos, Random rand){
|
||||
double d0 = (double)pos.getX() + 0.5D;
|
||||
double d1 = (double)pos.getY() + 0.2D;
|
||||
double d2 = (double)pos.getZ() + 0.5D;
|
||||
double d3 = 0.52D;
|
||||
double d4 = ThreadLocalRandom.current().nextDouble(0.066, 0.33);
|
||||
double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
|
||||
|
||||
if(rand.nextInt(3) == 0){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(3) == 1){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(3) == 2){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(3) == 3){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(rand.nextInt(4) == 1){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 2){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 3){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 4){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,23 @@
|
||||
package nmd.primal.forgecraft.compat;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 12/3/2016.
|
||||
*/
|
||||
//public class FuelHandler implements IFuelHandler {
|
||||
|
||||
/*@Override
|
||||
public int getBurnTime(ItemStack fuelStack)
|
||||
{
|
||||
//if (ModConfig.FEATURE_ENABLE_FUELS) {
|
||||
//CommonUtils.debugLogger(2, "fuel", "size: " + ModRegistries.FUEL_REGISTRY.size() + ", value: " + ModRegistries.FUEL_REGISTRY.get(fuelStack));
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : ForgeCraftRegistries.FUEL_REGISTRY.entrySet())
|
||||
{
|
||||
if (entry.getKey().isItemEqual(fuelStack))
|
||||
return entry.getValue();
|
||||
}
|
||||
//}
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
//}
|
||||
15
kfc/src/main/java/nmd/primal/forgecraft/compat/JEI.java
Normal file
15
kfc/src/main/java/nmd/primal/forgecraft/compat/JEI.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package nmd.primal.forgecraft.compat;
|
||||
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/1/17.
|
||||
*/
|
||||
public class JEI extends BlankModPlugin
|
||||
{
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package nmd.primal.forgecraft.compat;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/7/17.
|
||||
*/
|
||||
public class ModDictionary {/*******************************************************************************
|
||||
* Register Only Vanilla OreDictionary Entries Here
|
||||
* Mod Items/Blocks have their names added through the respective
|
||||
* registration methods as a list of comma delineated strings.
|
||||
*
|
||||
* EXAMPLE:
|
||||
* LEATHER_CORDAGE = registerItem(new PrimalItem("leather_cordage"), "cordageGeneral, cordageLeather");
|
||||
*
|
||||
*/
|
||||
public static void registerDictionaryNames()
|
||||
{
|
||||
//if (ModConfig.COMPATIBILITY_DICTIONARY_MAGMACREAM_AS_SLIME)
|
||||
//OreDictionary.registerOre("clayball", Items.CLAY_BALL);
|
||||
OreDictionary.registerOre("ingotIron", ModBlocks.ironball);
|
||||
OreDictionary.registerOre("nuggetIron", ModBlocks.ironchunk);
|
||||
OreDictionary.registerOre("ingotIron", ModBlocks.ironcleanball);
|
||||
OreDictionary.registerOre("nuggetIron", ModBlocks.ironcleanchunk);
|
||||
OreDictionary.registerOre("ingotSteel", ModBlocks.steelball);
|
||||
OreDictionary.registerOre("nuggetSteel", ModBlocks.steelchunk);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package nmd.primal.forgecraft.crafting;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/5/17.
|
||||
*/
|
||||
public class AnvilCrafting {
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Handler AnvilCrafting
|
||||
// ***************************************************************************** //
|
||||
|
||||
private static ArrayList<AnvilCrafting> anvilRecipes = new ArrayList<>();
|
||||
|
||||
private String[] input = new String[25];
|
||||
|
||||
private String upgradeType;
|
||||
|
||||
private ItemStack output;
|
||||
|
||||
public AnvilCrafting(String[] input, ItemStack output, String upgrade){
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.upgradeType = upgrade;
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Methods
|
||||
// ***************************************************************************** //
|
||||
|
||||
public static void addRecipe(String[] input, ItemStack output, String upgrade)
|
||||
{
|
||||
anvilRecipes.add(new AnvilCrafting(input, output, upgrade));
|
||||
}
|
||||
|
||||
public static boolean isRecipe(String[] array)
|
||||
{
|
||||
for(AnvilCrafting recipe : anvilRecipes) {
|
||||
if (Arrays.equals(array, recipe.input))
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static AnvilCrafting getRecipe(String[] array)
|
||||
{
|
||||
for(AnvilCrafting recipe : anvilRecipes) {
|
||||
if (Arrays.equals(array, recipe.input))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getInput() {return this.input;}
|
||||
|
||||
public ItemStack getOutput() {return this.output;}
|
||||
|
||||
public String getUpgrade() {return this.upgradeType; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package nmd.primal.forgecraft.crafting;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/24/17.
|
||||
*/
|
||||
public class BloomeryCrafting {
|
||||
// ***************************************************************************** //
|
||||
// Recipe Handler Bloomery
|
||||
// ***************************************************************************** //
|
||||
private static ArrayList<BloomeryCrafting> bloomeryRecipes = new ArrayList<>();
|
||||
|
||||
private ItemStack input;
|
||||
private ItemStack output;
|
||||
private ItemStack output_failed;
|
||||
private ItemStack cool_output;
|
||||
|
||||
private int heat_threshold;
|
||||
private int ideal_time;
|
||||
private int cooldown;
|
||||
|
||||
private float heat_variance;
|
||||
private float time_variance;
|
||||
|
||||
public BloomeryCrafting(ItemStack input, ItemStack output, ItemStack output_failed, ItemStack cool_output, int heat_threshold, int ideal_time, int cooldown,float heat_variance, float time_variance)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.output_failed = output_failed;
|
||||
this.cool_output = cool_output;
|
||||
this.heat_threshold = heat_threshold;
|
||||
this.ideal_time = ideal_time;
|
||||
this.cooldown = cooldown;
|
||||
this.heat_variance = heat_variance;
|
||||
this.time_variance = time_variance;
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Methods
|
||||
// ***************************************************************************** //
|
||||
public static void addRecipe(ItemStack input, ItemStack output, ItemStack failed, ItemStack cool, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
||||
{
|
||||
bloomeryRecipes.add(new BloomeryCrafting(input, output, failed, cool, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
|
||||
}
|
||||
|
||||
public static boolean isRecipeItem(ItemStack stack)
|
||||
{
|
||||
for(BloomeryCrafting recipe : bloomeryRecipes) {
|
||||
if (stack.isItemEqual(recipe.input))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isOutputItem(ItemStack stack)
|
||||
{
|
||||
for(BloomeryCrafting recipe : bloomeryRecipes) {
|
||||
if (stack.isItemEqual(recipe.output))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isCoolItem(ItemStack stack)
|
||||
{
|
||||
for(BloomeryCrafting recipe : bloomeryRecipes) {
|
||||
if (stack.isItemEqual(recipe.cool_output))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static BloomeryCrafting getRecipe(ItemStack stack)
|
||||
{
|
||||
for(BloomeryCrafting recipe : bloomeryRecipes) {
|
||||
if (stack.isItemEqual(recipe.input))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BloomeryCrafting getRecipeFromOutput(ItemStack stack)
|
||||
{
|
||||
for(BloomeryCrafting recipe : bloomeryRecipes) {
|
||||
if (stack.isItemEqual(recipe.output))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput()
|
||||
{
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public ItemStack getOutputFailed()
|
||||
{
|
||||
return this.output_failed;
|
||||
}
|
||||
|
||||
public ItemStack getCoolOutput()
|
||||
{
|
||||
return this.cool_output;
|
||||
}
|
||||
|
||||
public int getHeatThreshold()
|
||||
{
|
||||
return this.heat_threshold;
|
||||
}
|
||||
|
||||
public int getIdealTime()
|
||||
{
|
||||
return this.ideal_time;
|
||||
}
|
||||
|
||||
public int getCooldown(){ return this.cooldown;}
|
||||
|
||||
public float getHeatVariance(){return this.heat_variance; }
|
||||
|
||||
public float getTimeVariance(){return this.time_variance; }
|
||||
|
||||
///
|
||||
// end
|
||||
///
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package nmd.primal.forgecraft.crafting;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/22/17.
|
||||
*/
|
||||
public class CastingformCrafting {
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Handler AnvilCrafting
|
||||
// ***************************************************************************** //
|
||||
|
||||
private static ArrayList<CastingformCrafting> castingRecipes = new ArrayList<>();
|
||||
|
||||
private String[] input = new String[25];
|
||||
|
||||
private ItemStack output;
|
||||
|
||||
public CastingformCrafting(String[] input, ItemStack output){
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Methods
|
||||
// ***************************************************************************** //
|
||||
|
||||
public static void addRecipe(String[] input, ItemStack output)
|
||||
{
|
||||
castingRecipes.add(new CastingformCrafting(input, output));
|
||||
}
|
||||
|
||||
public static boolean isRecipe(String[] array)
|
||||
{
|
||||
for(CastingformCrafting recipe : castingRecipes) {
|
||||
if (Arrays.equals(array, recipe.input))
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static CastingformCrafting getRecipe(String[] array)
|
||||
{
|
||||
for(CastingformCrafting recipe : castingRecipes) {
|
||||
if (Arrays.equals(array, recipe.input))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getInput() {return this.input;}
|
||||
|
||||
public ItemStack getOutput() {return this.output;}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package nmd.primal.forgecraft.crafting;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/11/17.
|
||||
*/
|
||||
public class ForgeCrafting {
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Handler ForgeCrafting
|
||||
// ***************************************************************************** //
|
||||
private static ArrayList<ForgeCrafting> forgeRecipes = new ArrayList<>();
|
||||
|
||||
private Item input;
|
||||
private ItemStack output;
|
||||
|
||||
private int heat_threshold;
|
||||
private int ideal_time;
|
||||
private int cooldown;
|
||||
|
||||
|
||||
public ForgeCrafting(Item input, ItemStack output, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.heat_threshold = heat_threshold;
|
||||
this.ideal_time = ideal_time;
|
||||
this.cooldown = cooldown;
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Recipe Methods
|
||||
// ***************************************************************************** //
|
||||
public static void addRecipe(Item input, ItemStack output, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
|
||||
{
|
||||
forgeRecipes.add(new ForgeCrafting(input, output, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
|
||||
}
|
||||
|
||||
public static boolean isRecipeItem(Item item)
|
||||
{
|
||||
for(ForgeCrafting recipe : forgeRecipes) {
|
||||
if (item.equals(recipe.input))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ForgeCrafting getRecipe(Item item)
|
||||
{
|
||||
for(ForgeCrafting recipe : forgeRecipes) {
|
||||
if (item.equals(recipe.input))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*public static ForgeCrafting getRecipeFromOutput(Item item)
|
||||
{
|
||||
for(ForgeCrafting recipe : forgeRecipes) {
|
||||
if (item.equals(recipe.output))
|
||||
return recipe;
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
public Item getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {return this.output; }
|
||||
|
||||
public int getHeatThreshold()
|
||||
{
|
||||
return this.heat_threshold;
|
||||
}
|
||||
|
||||
public int getIdealTime()
|
||||
{
|
||||
return this.ideal_time;
|
||||
}
|
||||
|
||||
public int getCooldown(){ return this.cooldown;}
|
||||
|
||||
///
|
||||
// end
|
||||
///
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package nmd.primal.forgecraft.enumhandler;
|
||||
|
||||
import nmd.primal.forgecraft.util.IMetaLookup;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/1/17.
|
||||
*/
|
||||
public class EnumHandler {
|
||||
|
||||
public enum IngotTypes implements IMetaLookup<IngotTypes> {
|
||||
IRONCOOL, /*0*/
|
||||
IRONHOT; /*1*/
|
||||
|
||||
public final int meta;
|
||||
public final String name;
|
||||
public boolean set = false;
|
||||
|
||||
private IngotTypes() {
|
||||
meta = ordinal();
|
||||
name = toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVariantName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrdinal() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IngotTypes getByOrdinal(int i) {
|
||||
return this.values()[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "ore_type";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package nmd.primal.forgecraft.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/4/17.
|
||||
*/
|
||||
public class GuiForgingManual extends GuiScreen {
|
||||
|
||||
GuiButton a;
|
||||
GuiButton b;
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
this.drawDefaultBackground();
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
|
||||
this.buttonList.add(this.a = new GuiButton(0, this.width / 2 - 100, this.height / 2 - 24, "This is button a"));
|
||||
this.buttonList.add(this.b = new GuiButton(1, this.width / 2 - 100, this.height / 2 + 4, "This is button b"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
if (button == this.a) {
|
||||
//Main.packetHandler.sendToServer(...);
|
||||
this.mc.displayGuiScreen(null);
|
||||
if (this.mc.currentScreen == null)
|
||||
this.mc.setIngameFocus();
|
||||
}
|
||||
if (button == this.b){
|
||||
//Main.packetHandler.sendToServer(...);
|
||||
this.mc.displayGuiScreen(null);
|
||||
if (this.mc.currentScreen == null)
|
||||
this.mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
27
kfc/src/main/java/nmd/primal/forgecraft/gui/GuiHandler.java
Normal file
27
kfc/src/main/java/nmd/primal/forgecraft/gui/GuiHandler.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package nmd.primal.forgecraft.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/4/17.
|
||||
*/
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static final int FORGINGMANUALGUI = 0;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if(ID == FORGINGMANUALGUI){
|
||||
return new GuiForgingManual();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
617
kfc/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java
Normal file
617
kfc/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java
Normal file
@@ -0,0 +1,617 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.items.tools.WorkMallet;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
|
||||
import nmd.primal.forgecraft.blocks.*;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
|
||||
import nmd.primal.forgecraft.items.ForgeHammer;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class ModBlocks {
|
||||
|
||||
public static Block forge_brick;
|
||||
public static Block forge_adobe;
|
||||
public static Block bloomery_brick;
|
||||
public static Block bloomery_adobe;
|
||||
public static Block blockbreaker;
|
||||
public static Block castingform;
|
||||
public static Block castingblock;
|
||||
|
||||
public static Block pistonbellowsoak;
|
||||
public static Block pistonbellowsjungle;
|
||||
public static Block pistonbellowsbirch;
|
||||
public static Block pistonbellowsspruce;
|
||||
public static Block pistonbellowsdarkoak;
|
||||
public static Block pistonbellowsacacia;
|
||||
|
||||
public static Block emptycrucible;
|
||||
public static Block emptycruciblehot;
|
||||
public static Block emptycruciblecracked;
|
||||
public static Block emptycruciblecrackedhot;
|
||||
|
||||
public static Block rawbronzecrucible;
|
||||
public static Block hotbronzecrucible;
|
||||
public static Block hotcookedbronzecrucible;
|
||||
|
||||
public static Block rawbronzecrucible_redstone;
|
||||
public static Block hotbronzecrucible_redstone;
|
||||
public static Block hotcookedbronzecrucible_redstone;
|
||||
|
||||
public static Block rawbronzecrucible_lapis;
|
||||
public static Block hotbronzecrucible_lapis;
|
||||
public static Block hotcookedbronzecrucible_lapis;
|
||||
|
||||
public static Block rawbronzecrucible_diamond;
|
||||
public static Block hotbronzecrucible_diamond;
|
||||
public static Block hotcookedbronzecrucible_diamond;
|
||||
|
||||
public static Block rawbronzecrucible_emerald;
|
||||
public static Block hotbronzecrucible_emerald;
|
||||
public static Block hotcookedbronzecrucible_emerald;
|
||||
|
||||
public static Block rawironcrucible;
|
||||
public static Block hotironcrucible;
|
||||
public static Block hotcookedironcrucible;
|
||||
public static Block coolironcrucible;
|
||||
public static Block failedironcrucible;
|
||||
public static Block failedironcruciblehot;
|
||||
|
||||
public static Block rawcleanironcrucible;
|
||||
public static Block hotcleanironcrucible;
|
||||
public static Block hotcookedcleanironcrucible;
|
||||
public static Block coolcleanironcrucible;
|
||||
public static Block failedcleanironcrucible;
|
||||
public static Block failedcleanironcruciblehot;
|
||||
|
||||
public static Block rawsteelcrucible;
|
||||
public static Block hotsteelcrucible;
|
||||
public static Block hotcookedsteelcrucible;
|
||||
public static Block coolsteelcrucible;
|
||||
public static Block failedsteelcrucible;
|
||||
public static Block failedsteelcruciblehot;
|
||||
|
||||
public static Block rawwootzcrucible;
|
||||
public static Block hotwootzcrucible;
|
||||
public static Block hotcookedwootzcrucible;
|
||||
public static Block coolwootzcrucible;
|
||||
public static Block failedwootzcrucible;
|
||||
public static Block failedwootzcruciblehot;
|
||||
|
||||
public static Block ironball;
|
||||
public static Block ironchunk;
|
||||
public static Block ironcleanball;
|
||||
public static Block ironcleanchunk;
|
||||
public static Block steelball;
|
||||
public static Block steelchunk;
|
||||
public static Block wootzball;
|
||||
public static Block wootzchunk;
|
||||
|
||||
public static Block stoneanvil;
|
||||
public static Block ironanvil;
|
||||
|
||||
|
||||
public static void init() {
|
||||
|
||||
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
|
||||
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
|
||||
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
|
||||
bloomery_adobe = new BloomeryBase(Material.ROCK, "bloomery_adobe", 5000);
|
||||
blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f);
|
||||
castingform = new CastingForm(Material.WOOD, "castingform");
|
||||
castingblock = new CastingBlock(Material.ROCK, "castingblock");
|
||||
|
||||
pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak");
|
||||
pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
|
||||
pistonbellowsbirch = new PistonBellows(Material.WOOD, "pistonbellowsbirch");
|
||||
pistonbellowsspruce = new PistonBellows(Material.WOOD, "pistonbellowsspruce");
|
||||
pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak");
|
||||
pistonbellowsacacia = new PistonBellows(Material.WOOD, "pistonbellowsacacia");
|
||||
|
||||
emptycrucible = new Crucible(Material.ROCK, "emptycrucible");
|
||||
emptycruciblehot = new CrucibleHot(Material.ROCK, "emptycruciblehot");
|
||||
emptycruciblecracked = new Crucible(Material.ROCK, "emptycruciblecracked");
|
||||
emptycruciblecrackedhot = new CrucibleHot(Material.ROCK, "emptycruciblecrackedhot");
|
||||
|
||||
rawbronzecrucible = new Crucible(Material.ROCK, "rawbronzecrucible");
|
||||
hotbronzecrucible = new CrucibleHot(Material.ROCK, "hotbronzecrucible");
|
||||
hotcookedbronzecrucible = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible");
|
||||
|
||||
rawbronzecrucible_redstone = new Crucible(Material.ROCK, "rawbronzecrucible_redstone");
|
||||
hotbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotbronzecrucible_redstone");
|
||||
hotcookedbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_redstone");
|
||||
|
||||
rawbronzecrucible_diamond = new Crucible(Material.ROCK, "rawbronzecrucible_diamond");
|
||||
hotbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotbronzecrucible_diamond");
|
||||
hotcookedbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_diamond");
|
||||
|
||||
rawbronzecrucible_lapis = new Crucible(Material.ROCK, "rawbronzecrucible_lapis");
|
||||
hotbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotbronzecrucible_lapis");
|
||||
hotcookedbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_lapis");
|
||||
|
||||
rawbronzecrucible_emerald = new Crucible(Material.ROCK, "rawbronzecrucible_emerald");
|
||||
hotbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotbronzecrucible_emerald");
|
||||
hotcookedbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_emerald");
|
||||
|
||||
rawironcrucible = new Crucible(Material.ROCK, "rawironcrucible");
|
||||
hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible");
|
||||
hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible");
|
||||
coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible");
|
||||
failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible");
|
||||
failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");
|
||||
|
||||
rawcleanironcrucible = new Crucible(Material.ROCK, "rawcleanironcrucible");
|
||||
hotcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcleanironcrucible");
|
||||
hotcookedcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcookedcleanironcrucible");
|
||||
coolcleanironcrucible = new Crucible(Material.ROCK, "coolcleanironcrucible");
|
||||
failedcleanironcrucible = new Crucible(Material.ROCK, "failedcleanironcrucible");
|
||||
failedcleanironcruciblehot = new Crucible(Material.ROCK, "failedcleanironcruciblehot");
|
||||
|
||||
rawsteelcrucible = new Crucible(Material.ROCK, "rawsteelcrucible");
|
||||
hotsteelcrucible = new CrucibleHot(Material.ROCK, "hotsteelcrucible");
|
||||
hotcookedsteelcrucible = new CrucibleHot(Material.ROCK, "hotcookedsteelcrucible");
|
||||
coolsteelcrucible = new Crucible(Material.ROCK, "coolsteelcrucible");
|
||||
failedsteelcrucible = new Crucible(Material.ROCK, "failedsteelcrucible");
|
||||
failedsteelcruciblehot = new Crucible(Material.ROCK, "failedsteelcruciblehot");
|
||||
|
||||
rawwootzcrucible = new Crucible(Material.ROCK, "rawwootzcrucible");
|
||||
hotwootzcrucible = new CrucibleHot(Material.ROCK, "hotwootzcrucible");
|
||||
hotcookedwootzcrucible = new CrucibleHot(Material.ROCK, "hotcookedwootzcrucible");
|
||||
coolwootzcrucible = new Crucible(Material.ROCK, "coolwootzcrucible");
|
||||
failedwootzcrucible = new Crucible(Material.ROCK, "failedwootzcrucible");
|
||||
failedwootzcruciblehot = new Crucible(Material.ROCK, "failedwootzcruciblehot");
|
||||
|
||||
ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "ingot") {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
|
||||
{
|
||||
if(!world.isRemote){
|
||||
Item pItem = player.getHeldItem(hand).getItem();
|
||||
BlockPos belowPos = pos.down();
|
||||
//System.out.println("Activating");
|
||||
if (pItem instanceof WorkMallet && world.getBlockState(belowPos).getBlock().equals(Blocks.STONE)) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
world.setBlockState(belowPos, ModBlocks.stoneanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
|
||||
world.playEvent(1031, pos, 0);
|
||||
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
|
||||
return true;
|
||||
}
|
||||
/*if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
|
||||
world.playEvent(1031, pos, 0);
|
||||
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
|
||||
return true;
|
||||
}*/
|
||||
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
|
||||
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
|
||||
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
|
||||
|
||||
if (tile.getSlotStack(6).isEmpty() &&
|
||||
tile.getSlotStack(7).isEmpty() &&
|
||||
tile.getSlotStack(8).isEmpty() &&
|
||||
tile.getSlotStack(11).isEmpty() &&
|
||||
tile.getSlotStack(12).isEmpty() &&
|
||||
tile.getSlotStack(13).isEmpty() &&
|
||||
tile.getSlotStack(16).isEmpty() &&
|
||||
tile.getSlotStack(17).isEmpty() &&
|
||||
tile.getSlotStack(18).isEmpty()
|
||||
) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
tile.setSlotStack(6, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(7, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(8, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(11, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(12, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(13, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(16, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(17, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
tile.setSlotStack(18, new ItemStack(ModItems.ironchunkhot, 1));
|
||||
world.playEvent(1031, pos, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f, "ingot") {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
|
||||
{
|
||||
//System.out.println("Level 0");
|
||||
if(!world.isRemote){
|
||||
Item pItem = player.getHeldItem(hand).getItem();
|
||||
BlockPos belowPos = pos.down();
|
||||
//System.out.println("Activating1");
|
||||
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
|
||||
world.playEvent(1031, pos, 0);
|
||||
//System.out.println("Activating");
|
||||
return true;
|
||||
}
|
||||
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
|
||||
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
|
||||
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
|
||||
|
||||
if (tile.getSlotStack(6).isEmpty() &&
|
||||
tile.getSlotStack(7).isEmpty() &&
|
||||
tile.getSlotStack(8).isEmpty() &&
|
||||
tile.getSlotStack(11).isEmpty() &&
|
||||
tile.getSlotStack(12).isEmpty() &&
|
||||
tile.getSlotStack(13).isEmpty() &&
|
||||
tile.getSlotStack(16).isEmpty() &&
|
||||
tile.getSlotStack(17).isEmpty() &&
|
||||
tile.getSlotStack(18).isEmpty()
|
||||
) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
tile.setSlotStack(6, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(7, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(8, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(11, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(12, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(13, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(16, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(17, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
tile.setSlotStack(18, new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
world.playEvent(1031, pos, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}; // clean_iron_ingot ironcleanball.json ironcleanballhot.json - done
|
||||
steelball = new IngotBall(Material.IRON, "steelball", 6.0f, "ingot"){
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
|
||||
{
|
||||
if(!world.isRemote){
|
||||
Item pItem = player.getHeldItem(hand).getItem();
|
||||
BlockPos belowPos = pos.down();
|
||||
//System.out.println("Activating");
|
||||
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
|
||||
world.playEvent(1031, pos, 0);
|
||||
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
|
||||
return true;
|
||||
}
|
||||
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
|
||||
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
|
||||
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
|
||||
|
||||
if (tile.getSlotStack(6).isEmpty() &&
|
||||
tile.getSlotStack(7).isEmpty() &&
|
||||
tile.getSlotStack(8).isEmpty() &&
|
||||
tile.getSlotStack(11).isEmpty() &&
|
||||
tile.getSlotStack(12).isEmpty() &&
|
||||
tile.getSlotStack(13).isEmpty() &&
|
||||
tile.getSlotStack(16).isEmpty() &&
|
||||
tile.getSlotStack(17).isEmpty() &&
|
||||
tile.getSlotStack(18).isEmpty()
|
||||
) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
tile.setSlotStack(6, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(7, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(8, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(11, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(12, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(13, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(16, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(17, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
tile.setSlotStack(18, new ItemStack(ModItems.steelchunkhot, 1));
|
||||
world.playEvent(1031, pos, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}; // steel_ingot steelball.json steelballhot.json
|
||||
wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f, "ingot") {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
|
||||
{
|
||||
if(!world.isRemote){
|
||||
Item pItem = player.getHeldItem(hand).getItem();
|
||||
BlockPos belowPos = pos.down();
|
||||
//System.out.println("Activating");
|
||||
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
|
||||
world.playEvent(1031, pos, 0);
|
||||
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
|
||||
return true;
|
||||
}
|
||||
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
|
||||
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
|
||||
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
|
||||
|
||||
if (tile.getSlotStack(6).isEmpty() &&
|
||||
tile.getSlotStack(7).isEmpty() &&
|
||||
tile.getSlotStack(8).isEmpty() &&
|
||||
tile.getSlotStack(11).isEmpty() &&
|
||||
tile.getSlotStack(12).isEmpty() &&
|
||||
tile.getSlotStack(13).isEmpty() &&
|
||||
tile.getSlotStack(16).isEmpty() &&
|
||||
tile.getSlotStack(17).isEmpty() &&
|
||||
tile.getSlotStack(18).isEmpty()
|
||||
) {
|
||||
player.swingArm(hand);
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
tile.setSlotStack(6, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(7, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(8, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(11, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(12, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(13, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(16, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(17, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
tile.setSlotStack(18, new ItemStack(ModItems.wootzchunkhot, 1));
|
||||
world.playEvent(1031, pos, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}; //wootz_ingot wootzball.json wootzballhot.json
|
||||
|
||||
ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "chunk");
|
||||
ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "chunk"); //Lyle to make assets clean_iron_ingot, blockstate\ironcleanchunk.json, item\ironcleanchunk.json, item\ironcleanchunkhot.json - done
|
||||
steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done
|
||||
wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done
|
||||
|
||||
stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true);
|
||||
ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
|
||||
//ironballitemcool = new ItemBlockIngotBall(ironball);
|
||||
//ironballitemhot = new ItemBlockIngotBall(ironball);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void register() {
|
||||
registerBlock(forge_brick);
|
||||
registerBlock(forge_adobe);
|
||||
registerBlock(bloomery_brick);
|
||||
registerBlock(bloomery_adobe);
|
||||
registerBlock(blockbreaker);
|
||||
registerBlock(castingform);
|
||||
registerBlock(castingblock);
|
||||
|
||||
registerBlock(pistonbellowsoak);
|
||||
registerBlock(pistonbellowsjungle);
|
||||
registerBlock(pistonbellowsbirch);
|
||||
registerBlock(pistonbellowsspruce);
|
||||
registerBlock(pistonbellowsdarkoak);
|
||||
registerBlock(pistonbellowsacacia);
|
||||
|
||||
registerBlock(emptycrucible);
|
||||
registerBlock(emptycruciblehot);
|
||||
registerBlock(emptycruciblecracked);
|
||||
registerBlock(emptycruciblecrackedhot);
|
||||
|
||||
registerBlock(rawbronzecrucible);
|
||||
registerBlock(hotbronzecrucible);
|
||||
registerBlock(hotcookedbronzecrucible);
|
||||
|
||||
registerBlock(rawbronzecrucible_diamond);
|
||||
registerBlock(hotbronzecrucible_diamond);
|
||||
registerBlock(hotcookedbronzecrucible_diamond);
|
||||
|
||||
registerBlock(rawbronzecrucible_emerald);
|
||||
registerBlock(hotbronzecrucible_emerald);
|
||||
registerBlock(hotcookedbronzecrucible_emerald);
|
||||
|
||||
registerBlock(rawbronzecrucible_redstone);
|
||||
registerBlock(hotbronzecrucible_redstone);
|
||||
registerBlock(hotcookedbronzecrucible_redstone);
|
||||
|
||||
registerBlock(rawbronzecrucible_lapis);
|
||||
registerBlock(hotbronzecrucible_lapis);
|
||||
registerBlock(hotcookedbronzecrucible_lapis);
|
||||
|
||||
registerBlock(rawironcrucible);
|
||||
registerBlock(hotironcrucible);
|
||||
registerBlock(hotcookedironcrucible);
|
||||
registerBlock(coolironcrucible);
|
||||
registerBlock(failedironcrucible);
|
||||
registerBlock(failedironcruciblehot);
|
||||
|
||||
registerBlock(rawcleanironcrucible);
|
||||
registerBlock(hotcleanironcrucible);
|
||||
registerBlock(hotcookedcleanironcrucible);
|
||||
registerBlock(coolcleanironcrucible);
|
||||
registerBlock(failedcleanironcrucible);
|
||||
registerBlock(failedcleanironcruciblehot);
|
||||
|
||||
registerBlock(rawsteelcrucible);
|
||||
registerBlock(hotsteelcrucible);
|
||||
registerBlock(hotcookedsteelcrucible);
|
||||
registerBlock(coolsteelcrucible);
|
||||
registerBlock(failedsteelcrucible);
|
||||
registerBlock(failedsteelcruciblehot);
|
||||
|
||||
registerBlock(rawwootzcrucible);
|
||||
registerBlock(hotwootzcrucible);
|
||||
registerBlock(hotcookedwootzcrucible);
|
||||
registerBlock(coolwootzcrucible);
|
||||
registerBlock(failedwootzcrucible);
|
||||
registerBlock(failedwootzcruciblehot);
|
||||
|
||||
registerBlock(ironball);
|
||||
registerBlock(ironchunk);
|
||||
|
||||
registerBlock(ironcleanball);
|
||||
registerBlock(ironcleanchunk);
|
||||
|
||||
registerBlock(steelball);
|
||||
registerBlock(steelchunk);
|
||||
|
||||
registerBlock(wootzball);
|
||||
registerBlock(wootzchunk);
|
||||
//registerBlockSubType(ironball, ironballitemcool, "ironcool");
|
||||
//registerBlockSubType(ironball, ironballitemhot, "ironhot");
|
||||
|
||||
registerBlock(stoneanvil);
|
||||
registerBlock(ironanvil);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerRenders() {
|
||||
registerRender(forge_brick);
|
||||
registerRender(forge_adobe);
|
||||
registerRender(castingform);
|
||||
registerRender(castingblock);
|
||||
|
||||
registerRender(blockbreaker);
|
||||
registerRender(pistonbellowsoak);
|
||||
registerRender(pistonbellowsjungle);
|
||||
registerRender(pistonbellowsbirch);
|
||||
registerRender(pistonbellowsspruce);
|
||||
registerRender(pistonbellowsdarkoak);
|
||||
registerRender(pistonbellowsacacia);
|
||||
|
||||
registerRender(bloomery_brick);
|
||||
registerRender(bloomery_adobe);
|
||||
|
||||
registerRender(emptycrucible);
|
||||
registerRender(emptycruciblehot);
|
||||
registerRender(emptycruciblecracked);
|
||||
registerRender(emptycruciblecrackedhot);
|
||||
|
||||
registerRender(rawbronzecrucible);
|
||||
registerRender(hotbronzecrucible);
|
||||
registerRender(hotcookedbronzecrucible);
|
||||
|
||||
registerRender(rawbronzecrucible_diamond);
|
||||
registerRender(hotbronzecrucible_diamond);
|
||||
registerRender(hotcookedbronzecrucible_diamond);
|
||||
|
||||
registerRender(rawbronzecrucible_emerald);
|
||||
registerRender(hotbronzecrucible_emerald);
|
||||
registerRender(hotcookedbronzecrucible_emerald);
|
||||
|
||||
registerRender(rawbronzecrucible_redstone);
|
||||
registerRender(hotbronzecrucible_redstone);
|
||||
registerRender(hotcookedbronzecrucible_redstone);
|
||||
|
||||
registerRender(rawbronzecrucible_lapis);
|
||||
registerRender(hotbronzecrucible_lapis);
|
||||
registerRender(hotcookedbronzecrucible_lapis);
|
||||
|
||||
registerRender(rawironcrucible);
|
||||
registerRender(hotironcrucible);
|
||||
registerRender(hotcookedironcrucible);
|
||||
registerRender(coolironcrucible);
|
||||
registerRender(failedironcrucible);
|
||||
registerRender(failedironcruciblehot);
|
||||
|
||||
registerRender(rawcleanironcrucible);
|
||||
registerRender(hotcleanironcrucible);
|
||||
registerRender(hotcookedcleanironcrucible);
|
||||
registerRender(coolcleanironcrucible);
|
||||
registerRender(failedcleanironcrucible);
|
||||
registerRender(failedcleanironcruciblehot);
|
||||
|
||||
registerRender(rawsteelcrucible);
|
||||
registerRender(hotsteelcrucible);
|
||||
registerRender(hotcookedsteelcrucible);
|
||||
registerRender(coolsteelcrucible);
|
||||
registerRender(failedsteelcrucible);
|
||||
registerRender(failedsteelcruciblehot);
|
||||
|
||||
registerRender(rawwootzcrucible);
|
||||
registerRender(hotwootzcrucible);
|
||||
registerRender(hotcookedwootzcrucible);
|
||||
registerRender(coolwootzcrucible);
|
||||
registerRender(failedwootzcrucible);
|
||||
registerRender(failedwootzcruciblehot);
|
||||
|
||||
registerRender(ironball);
|
||||
registerRender(ironchunk);
|
||||
|
||||
registerRender(ironcleanball);
|
||||
registerRender(ironcleanchunk);
|
||||
|
||||
registerRender(steelball);
|
||||
registerRender(steelchunk);
|
||||
|
||||
registerRender(wootzball);
|
||||
registerRender(wootzchunk);
|
||||
//registerRenderCustom(ironballitemcool, 0, new ModelResourceLocation(ironballitemcool.getUnlocalizedName()));
|
||||
//registerRenderCustom(ironballitemhot, 1, new ModelResourceLocation(ironballitemhot.getUnlocalizedName()));
|
||||
|
||||
registerRender(stoneanvil);
|
||||
registerRender(ironanvil);
|
||||
|
||||
}
|
||||
|
||||
private static void registerBlock(Block block) {
|
||||
GameRegistry.register(block);
|
||||
ItemBlock item = new ItemBlock(block);
|
||||
item.setRegistryName(block.getRegistryName());
|
||||
GameRegistry.register(item);
|
||||
}
|
||||
|
||||
private static void registerBlockSubType(Block block, ItemBlock itemBlock, String registryName){
|
||||
GameRegistry.register(block);
|
||||
ItemBlock item = itemBlock;
|
||||
item.setRegistryName(registryName);
|
||||
GameRegistry.register(item);
|
||||
}
|
||||
|
||||
private static void registerRender(Block block) {
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model){
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, model);
|
||||
}
|
||||
|
||||
}
|
||||
47
kfc/src/main/java/nmd/primal/forgecraft/init/ModConfig.java
Normal file
47
kfc/src/main/java/nmd/primal/forgecraft/init/ModConfig.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
import net.minecraftforge.common.config.Config;
|
||||
import nmd.primal.forgecraft.ForgeCraft;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
@Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "")
|
||||
@Config.LangKey("forgecraft.config.title")
|
||||
@SuppressWarnings("unused")
|
||||
public class ModConfig
|
||||
{
|
||||
static {
|
||||
ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
|
||||
}
|
||||
|
||||
/**
|
||||
* Main Config Sections
|
||||
*/
|
||||
public static Compatibility compatibility;
|
||||
public static ModConfig.Features features;
|
||||
|
||||
/**
|
||||
* Options related to compatibility with mods and vanilla features
|
||||
*/
|
||||
public static class Compatibility
|
||||
{
|
||||
@Config.Comment({"Ore Dictionary Wootz steel for compatibility with common mod steel"})
|
||||
public static boolean COMPAT_DICTIONARY_WOOTZ_STEEL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize main features of the mod
|
||||
*/
|
||||
public static class Features
|
||||
{
|
||||
@Config.Comment({"Smoke is produced from various forge blocks when active"})
|
||||
public static boolean FEATURE_ENABLE_SMOKE = true;
|
||||
|
||||
@Config.RequiresMcRestart
|
||||
@Config.Comment({"Various forge blocks will set fire to their surroundings when active"})
|
||||
public static boolean FEATURE_ENABLE_FIRE = true;
|
||||
|
||||
@Config.Comment({"Sample config for a numeric range"})
|
||||
@Config.RangeInt(min = 0, max = 1000)
|
||||
public static int FEATURE_HEAT_RANGE = 0;
|
||||
}
|
||||
}
|
||||
1892
kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java
Normal file
1892
kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java
Normal file
File diff suppressed because it is too large
Load Diff
18
kfc/src/main/java/nmd/primal/forgecraft/init/ModEvents.java
Normal file
18
kfc/src/main/java/nmd/primal/forgecraft/init/ModEvents.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import nmd.primal.forgecraft.CommonEvents;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/15/17.
|
||||
*/
|
||||
public class ModEvents {
|
||||
|
||||
public static void registerCommonEvents()
|
||||
{
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
634
kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java
Normal file
634
kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java
Normal file
@@ -0,0 +1,634 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalMaterials;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.items.*;
|
||||
import nmd.primal.forgecraft.items.casting.CastingPart;
|
||||
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.items.tools.*;
|
||||
import nmd.primal.forgecraft.items.weapons.CustomShield;
|
||||
import nmd.primal.forgecraft.items.weapons.CustomSword;
|
||||
import nmd.primal.forgecraft.items.weapons.SlayerSword;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class ModItems {
|
||||
|
||||
//public static Item test;
|
||||
public static Item bellowshandle;
|
||||
public static Item forgehammer;
|
||||
public static Item softcrucible;
|
||||
public static Item stonetongs;
|
||||
public static Item castingmud;
|
||||
|
||||
public static Item ironingotballhot;
|
||||
public static Item ironchunkhot;
|
||||
public static Item ironcleaningotballhot;
|
||||
public static Item ironcleanchunkhot;
|
||||
public static Item steelingotballhot;
|
||||
public static Item steelchunkhot;
|
||||
public static Item wootzingotballhot;
|
||||
public static Item wootzchunkhot;
|
||||
|
||||
|
||||
public static Item cast_axe;
|
||||
public static Item cast_gladius;
|
||||
public static Item cast_hoe;
|
||||
public static Item cast_pickaxe;
|
||||
public static Item cast_shovel;
|
||||
|
||||
|
||||
public static Item pickaxehead;
|
||||
public static Item ironaxehead;
|
||||
public static Item ironshovelhead;
|
||||
public static Item ironhoehead;
|
||||
|
||||
public static Item cleanironpickaxehead;
|
||||
public static Item cleanironaxehead;
|
||||
public static Item cleanironshovelhead;
|
||||
public static Item cleanironhoehead;
|
||||
|
||||
public static Item steelpickaxehead;
|
||||
public static Item steelaxehead;
|
||||
public static Item steelshovelhead;
|
||||
public static Item steelhoehead;
|
||||
|
||||
public static Item wootzpickaxehead;
|
||||
public static Item wootzaxehead;
|
||||
public static Item wootzshovelhead;
|
||||
public static Item wootzhoehead;
|
||||
|
||||
|
||||
public static Item bronzepickaxehead;
|
||||
public static Item bronzeaxehead;
|
||||
public static Item bronzeshovelhead;
|
||||
public static Item bronzehoehead;
|
||||
|
||||
public static Item bronzepickaxe;
|
||||
public static Item bronzeaxe;
|
||||
public static Item bronzeshovel;
|
||||
public static Item bronzehoe;
|
||||
|
||||
public static Item ironpickaxe;
|
||||
public static Item ironaxe;
|
||||
public static Item ironshovel;
|
||||
public static Item ironhoe;
|
||||
|
||||
public static Item cleanironpickaxe;
|
||||
public static Item cleanironaxe;
|
||||
public static Item cleanironshovel;
|
||||
public static Item cleanironhoe;
|
||||
|
||||
public static Item steelpickaxe;
|
||||
public static Item steelaxe;
|
||||
public static Item steelshovel;
|
||||
public static Item steelhoe;
|
||||
|
||||
public static Item wootzpickaxe;
|
||||
public static Item wootzaxe;
|
||||
public static Item wootzshovel;
|
||||
public static Item wootzhoe;
|
||||
|
||||
public static Item bronzegladius;
|
||||
public static Item wroughtirongladius;
|
||||
public static Item cleanirongladius;
|
||||
public static Item steelgladius;
|
||||
|
||||
public static Item cleanironlongsword;
|
||||
public static Item steellongsword;
|
||||
|
||||
public static Item wroughtironslayer;
|
||||
public static Item cleanironslayer;
|
||||
public static Item steelslayer;
|
||||
|
||||
public static Item wroughtironshield;
|
||||
//public static Item cleanironshield;
|
||||
//public static Item steelshield;
|
||||
//public static Item wootzshield;
|
||||
|
||||
public static Item matchlockmusket;
|
||||
|
||||
//public static Item forgingmanual;
|
||||
|
||||
public static void init() {
|
||||
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
|
||||
//pistonbellows = new ItemBellowsHandle("pistonbellows");
|
||||
bellowshandle = new BaseItem("bellowshandle");
|
||||
softcrucible = new ItemSoftCrucible("softcrucible");
|
||||
stonetongs = new ItemStoneTongs("stonetongs");
|
||||
forgehammer = new ForgeHammer("forgehammer");
|
||||
castingmud = new BaseItem("castingmud");
|
||||
//matchlockmusket = new Musket("matchlock_musket");
|
||||
|
||||
/**********
|
||||
CASTING PARTS
|
||||
**********/
|
||||
cast_axe = new CastingPart("cast_axe");
|
||||
cast_gladius = new CastingPart("cast_gladius");
|
||||
cast_hoe = new CastingPart("cast_hoe");
|
||||
cast_pickaxe = new CastingPart("cast_pickaxe");
|
||||
cast_shovel = new CastingPart("cast_shovel");
|
||||
|
||||
/**********
|
||||
TOOL PARTS
|
||||
**********/
|
||||
|
||||
bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalMaterials.TOOL_BRONZE, 41);
|
||||
bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalMaterials.TOOL_BRONZE, 42);
|
||||
bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalMaterials.TOOL_BRONZE, 43);
|
||||
bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalMaterials.TOOL_BRONZE, 44);
|
||||
|
||||
pickaxehead = new ToolPart("ironpickaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 8);
|
||||
ironaxehead = new ToolPart("ironaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 9);
|
||||
ironshovelhead = new ToolPart("ironshovelhead", PrimalMaterials.TOOL_WROUGHT_IRON, 10);
|
||||
ironhoehead = new ToolPart("ironhoehead", PrimalMaterials.TOOL_WROUGHT_IRON, 11);
|
||||
|
||||
cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 17);
|
||||
cleanironaxehead = new ToolPart("cleanironaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 18);
|
||||
cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalMaterials.TOOL_CLEAN_IRON, 19);
|
||||
cleanironhoehead = new ToolPart("cleanironhoehead", PrimalMaterials.TOOL_CLEAN_IRON, 20);
|
||||
|
||||
steelpickaxehead = new ToolPart("steelpickaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 26);
|
||||
steelaxehead = new ToolPart("steelaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 27);
|
||||
steelshovelhead = new ToolPart("steelshovelhead", PrimalMaterials.TOOL_BASIC_STEEL, 28);
|
||||
steelhoehead = new ToolPart("steelhoehead", PrimalMaterials.TOOL_BASIC_STEEL, 29);
|
||||
|
||||
wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 35);
|
||||
wootzaxehead = new ToolPart("wootzaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 36);
|
||||
wootzshovelhead = new ToolPart("wootzshovelhead", PrimalMaterials.TOOL_WOOTZ_STEEL, 37);
|
||||
wootzhoehead = new ToolPart("wootzhoehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 38);
|
||||
/**********
|
||||
TOOLS
|
||||
**********/
|
||||
bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalMaterials.TOOL_BRONZE);
|
||||
bronzeaxe = new BronzeAxe("bronzeaxe", PrimalMaterials.TOOL_BRONZE);
|
||||
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE);
|
||||
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE);
|
||||
|
||||
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
|
||||
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
|
||||
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON);
|
||||
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON);
|
||||
|
||||
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON);
|
||||
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON);
|
||||
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON);
|
||||
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON);
|
||||
|
||||
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL);
|
||||
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL);
|
||||
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL);
|
||||
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL);
|
||||
|
||||
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
||||
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
||||
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
||||
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
||||
|
||||
/**********
|
||||
WEAPONS
|
||||
**********/
|
||||
bronzegladius = new CustomSword("bronzegladius", PrimalMaterials.TOOL_BRONZE, 5D, 2D);
|
||||
wroughtirongladius = new CustomSword("wroughtirongladius", PrimalMaterials.TOOL_WROUGHT_IRON, 4.5D, -1.85D);
|
||||
cleanirongladius = new CustomSword("cleanirongladius", PrimalMaterials.TOOL_CLEAN_IRON, 5D, -1.85D);
|
||||
steelgladius = new CustomSword("steelgladius", PrimalMaterials.TOOL_BASIC_STEEL,6D, -1.85D);
|
||||
|
||||
cleanironlongsword = new CustomSword("cleanironlongsword", PrimalMaterials.TOOL_CLEAN_IRON, 7D, -2.5D);
|
||||
steellongsword = new CustomSword("steellongsword", PrimalMaterials.TOOL_BASIC_STEEL,8D, -2.25D);
|
||||
|
||||
wroughtironslayer = new SlayerSword("wroughtironslayer", PrimalMaterials.TOOL_WROUGHT_IRON, 11.5D, -3.7D);
|
||||
cleanironslayer = new SlayerSword("cleanironslayer", PrimalMaterials.TOOL_CLEAN_IRON, 10D, -3.5D);
|
||||
steelslayer = new SlayerSword("steelslayer", PrimalMaterials.TOOL_BASIC_STEEL,11D, -3.3D);
|
||||
|
||||
wroughtironshield = new CustomShield("wroughtironshield", PrimalMaterials.TOOL_WROUGHT_IRON);
|
||||
|
||||
/**********
|
||||
INGOTS AND CHUNKS
|
||||
**********/
|
||||
ironingotballhot = new BaseMultiItem("ironingothot", PrimalMaterials.TOOL_WROUGHT_IRON, 6);
|
||||
ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalMaterials.TOOL_WROUGHT_IRON, 7);
|
||||
ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalMaterials.TOOL_CLEAN_IRON, 15);
|
||||
ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalMaterials.TOOL_CLEAN_IRON, 16);
|
||||
steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalMaterials.TOOL_BASIC_STEEL, 24);
|
||||
steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalMaterials.TOOL_BASIC_STEEL, 25);
|
||||
wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 33);
|
||||
wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 34);
|
||||
|
||||
//forgingmanual = new ItemForgingManual();
|
||||
//test = new ItemTest("ironsword");
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
GameRegistry.register(castingmud);
|
||||
GameRegistry.register(bellowshandle);
|
||||
GameRegistry.register(softcrucible);
|
||||
GameRegistry.register(stonetongs);
|
||||
GameRegistry.register(forgehammer);
|
||||
GameRegistry.register(ironingotballhot);
|
||||
GameRegistry.register(ironchunkhot);
|
||||
GameRegistry.register(ironcleaningotballhot);
|
||||
GameRegistry.register(ironcleanchunkhot);
|
||||
GameRegistry.register(steelingotballhot);
|
||||
GameRegistry.register(steelchunkhot);
|
||||
GameRegistry.register(wootzingotballhot);
|
||||
GameRegistry.register(wootzchunkhot);
|
||||
//GameRegistry.register(test);
|
||||
|
||||
/**********
|
||||
CASTING PARTS
|
||||
**********/
|
||||
GameRegistry.register(cast_axe);
|
||||
GameRegistry.register(cast_gladius);
|
||||
GameRegistry.register(cast_hoe);
|
||||
GameRegistry.register(cast_pickaxe);
|
||||
GameRegistry.register(cast_shovel);
|
||||
|
||||
/**********
|
||||
TOOL PARTS
|
||||
**********/
|
||||
GameRegistry.register(bronzepickaxehead);
|
||||
GameRegistry.register(bronzeaxehead);
|
||||
GameRegistry.register(bronzeshovelhead);
|
||||
GameRegistry.register(bronzehoehead);
|
||||
|
||||
GameRegistry.register(pickaxehead);
|
||||
GameRegistry.register(ironaxehead);
|
||||
GameRegistry.register(ironshovelhead);
|
||||
GameRegistry.register(ironhoehead);
|
||||
|
||||
GameRegistry.register(cleanironpickaxehead);
|
||||
GameRegistry.register(cleanironaxehead);
|
||||
GameRegistry.register(cleanironshovelhead);
|
||||
GameRegistry.register(cleanironhoehead);
|
||||
|
||||
GameRegistry.register(steelpickaxehead);
|
||||
GameRegistry.register(steelaxehead);
|
||||
GameRegistry.register(steelshovelhead);
|
||||
GameRegistry.register(steelhoehead);
|
||||
|
||||
GameRegistry.register(wootzpickaxehead);
|
||||
GameRegistry.register(wootzaxehead);
|
||||
GameRegistry.register(wootzshovelhead);
|
||||
GameRegistry.register(wootzhoehead);
|
||||
|
||||
/**********
|
||||
TOOLS
|
||||
**********/
|
||||
GameRegistry.register(bronzepickaxe);
|
||||
GameRegistry.register(bronzeaxe);
|
||||
GameRegistry.register(bronzeshovel);
|
||||
GameRegistry.register(bronzehoe);
|
||||
|
||||
GameRegistry.register(ironpickaxe);
|
||||
GameRegistry.register(ironaxe);
|
||||
GameRegistry.register(ironshovel);
|
||||
GameRegistry.register(ironhoe);
|
||||
|
||||
GameRegistry.register(cleanironpickaxe);
|
||||
GameRegistry.register(cleanironaxe);
|
||||
GameRegistry.register(cleanironshovel);
|
||||
GameRegistry.register(cleanironhoe);
|
||||
|
||||
GameRegistry.register(steelpickaxe);
|
||||
GameRegistry.register(steelaxe);
|
||||
GameRegistry.register(steelshovel);
|
||||
GameRegistry.register(steelhoe);
|
||||
|
||||
GameRegistry.register(wootzpickaxe);
|
||||
GameRegistry.register(wootzaxe);
|
||||
GameRegistry.register(wootzshovel);
|
||||
GameRegistry.register(wootzhoe);
|
||||
|
||||
/**********
|
||||
WEAPONS
|
||||
**********/
|
||||
GameRegistry.register(wroughtirongladius);
|
||||
GameRegistry.register(bronzegladius);
|
||||
GameRegistry.register(cleanirongladius);
|
||||
GameRegistry.register(steelgladius);
|
||||
|
||||
GameRegistry.register(cleanironlongsword);
|
||||
GameRegistry.register(steellongsword);
|
||||
|
||||
GameRegistry.register(wroughtironslayer);
|
||||
GameRegistry.register(cleanironslayer);
|
||||
GameRegistry.register(steelslayer);
|
||||
//GameRegistry.register(matchlockmusket);
|
||||
|
||||
//GameRegistry.register(forgingmanual);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerRenders() {
|
||||
registerRender(castingmud);
|
||||
registerRender(bellowshandle);
|
||||
registerRender(softcrucible);
|
||||
registerRender(forgehammer);
|
||||
registerRender(ironingotballhot);
|
||||
registerRender(ironchunkhot);
|
||||
registerRender(ironcleaningotballhot);
|
||||
registerRender(ironcleanchunkhot);
|
||||
registerRender(steelingotballhot);
|
||||
registerRender(steelchunkhot);
|
||||
//registerRender(test);
|
||||
|
||||
/**********
|
||||
CASTING PARTS
|
||||
**********/
|
||||
registerRender(cast_axe);
|
||||
registerRender(cast_gladius);
|
||||
registerRender(cast_hoe);
|
||||
registerRender(cast_pickaxe);
|
||||
registerRender(cast_shovel);
|
||||
|
||||
/**********
|
||||
TOOL PARTS
|
||||
**********/
|
||||
registerRender(bronzepickaxehead);
|
||||
registerRender(bronzeaxehead);
|
||||
registerRender(bronzeshovelhead);
|
||||
registerRender(bronzehoehead);
|
||||
|
||||
registerRender(pickaxehead);
|
||||
registerRender(ironaxehead);
|
||||
registerRender(ironshovelhead);
|
||||
registerRender(ironhoehead);
|
||||
|
||||
registerRender(cleanironpickaxehead);
|
||||
registerRender(cleanironaxehead);
|
||||
registerRender(cleanironshovelhead);
|
||||
registerRender(cleanironhoehead);
|
||||
|
||||
registerRender(steelpickaxehead);
|
||||
registerRender(steelaxehead);
|
||||
registerRender(steelshovelhead);
|
||||
registerRender(steelhoehead);
|
||||
|
||||
registerRender(wootzpickaxehead);
|
||||
registerRender(wootzaxehead);
|
||||
registerRender(wootzshovelhead);
|
||||
registerRender(wootzhoehead);
|
||||
|
||||
/**********
|
||||
TOOLS
|
||||
**********/
|
||||
registerRender(bronzepickaxe);
|
||||
registerRender(bronzeaxe);
|
||||
registerRender(bronzeshovel);
|
||||
registerRender(bronzehoe);
|
||||
|
||||
registerRender(ironpickaxe);
|
||||
registerRender(ironaxe);
|
||||
registerRender(ironshovel);
|
||||
registerRender(ironhoe);
|
||||
|
||||
registerRender(cleanironpickaxe);
|
||||
registerRender(cleanironaxe);
|
||||
registerRender(cleanironshovel);
|
||||
registerRender(cleanironhoe);
|
||||
|
||||
registerRender(steelpickaxe);
|
||||
registerRender(steelaxe);
|
||||
registerRender(steelshovel);
|
||||
registerRender(steelhoe);
|
||||
|
||||
registerRender(wootzpickaxe);
|
||||
registerRender(wootzaxe);
|
||||
registerRender(wootzshovel);
|
||||
registerRender(wootzhoe);
|
||||
|
||||
/**********
|
||||
WEAPONS
|
||||
**********/
|
||||
registerRender(wroughtironshield);
|
||||
|
||||
registerRender(bronzegladius);
|
||||
registerRender(wroughtirongladius);
|
||||
registerRender(cleanirongladius);
|
||||
registerRender(steelgladius);
|
||||
|
||||
registerRender(cleanironlongsword);
|
||||
registerRender(steellongsword);
|
||||
|
||||
registerRender(wroughtironslayer);
|
||||
registerRender(cleanironslayer);
|
||||
registerRender(steelslayer);
|
||||
|
||||
//registerRender(forgingmanual);
|
||||
//registerRender(matchlockmusket);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerCustomRenders(){
|
||||
ModelBakery.registerItemVariants(ModItems.stonetongs, ModItems.stonetongs.getRegistryName(),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhotcracked"),
|
||||
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotiron"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironcooked"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironfailed"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_ingot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_chunk"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_pickaxe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_axe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_shovel_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hoe_hot"),
|
||||
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleaniron"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironcooked"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironfailed"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironingot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironchunk"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_pickaxe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_axe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_shovel_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_hoe_hot"),
|
||||
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteel"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelcooked"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelfailed"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelingot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelchunk"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_pickaxe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_axe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_shovel_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_hoe_hot"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_lapis"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_lapis"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_redstone"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_redstone"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_emerald"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_emerald"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_diamond"),
|
||||
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_diamond")
|
||||
);
|
||||
ModelLoader.setCustomMeshDefinition(ModItems.stonetongs, new ItemMeshDefinition() {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getTagCompound().getInteger("type") == 0 ){
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_default", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 1 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 2 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhotcracked", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 3 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotiron", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 4 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironcooked", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 5 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironfailed", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 6 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_ingot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 7 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_chunk", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 8 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_pickaxe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 9 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_axe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 10 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_shovel_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 11 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hoe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 12 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleaniron", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 13 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironcooked", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 14 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironfailed", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 15 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironingot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 16 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironchunk", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 17 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_pickaxe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 18 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_axe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 19 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_shovel_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 20 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_hoe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 21 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteel", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 22 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelcooked", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 23 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelfailed", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 24 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelingot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 25 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelchunk", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 26 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_pickaxe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 27 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_axe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 28 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_shovel_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 29 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_hoe_hot", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 39 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 40 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 45 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_emerald", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 46 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_emerald", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 47 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_diamond", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 48 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_diamond", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 49 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_redstone", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 50 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_redstone", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 51 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_lapis", "inventory");
|
||||
}
|
||||
else if (stack.getTagCompound().getInteger("type") == 52 ) {
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_lapis", "inventory");
|
||||
}
|
||||
else return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
|
||||
}
|
||||
return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void registerRender(Item item) {
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
private static void registerRenderItemBlock(ItemBlock item){
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
/*public static void registerRender(Item item, int meta, String fileName) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(fileName), "inventory"));
|
||||
|
||||
}
|
||||
|
||||
public static void registerRender(Item item, int meta, String fileName) {
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(fileName, "inventory"));
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 12/3/2016.
|
||||
*/
|
||||
public class ModRegistries {
|
||||
|
||||
public static void registerFuels()
|
||||
{
|
||||
//if (ModConfig.FEATURE_ENABLE_FUELS)
|
||||
//{
|
||||
|
||||
}
|
||||
}
|
||||
31
kfc/src/main/java/nmd/primal/forgecraft/init/ModSounds.java
Normal file
31
kfc/src/main/java/nmd/primal/forgecraft/init/ModSounds.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/24/17.
|
||||
*/
|
||||
public class ModSounds {
|
||||
|
||||
public static SoundEvent PISTON_BELLOWS;
|
||||
public static SoundEvent MUSKET_SHOT;
|
||||
|
||||
public static void registerSounds()
|
||||
{
|
||||
PISTON_BELLOWS = registerSound("piston_bellows");
|
||||
MUSKET_SHOT = registerSound("musket_shot");
|
||||
}
|
||||
|
||||
private static SoundEvent registerSound(String name)
|
||||
{
|
||||
ResourceLocation location = new ResourceLocation(ModInfo.MOD_ID, name);
|
||||
SoundEvent sound = new SoundEvent(location);
|
||||
sound.setRegistryName(location);
|
||||
ForgeRegistries.SOUND_EVENTS.register(sound);
|
||||
return sound;
|
||||
}
|
||||
|
||||
}
|
||||
26
kfc/src/main/java/nmd/primal/forgecraft/init/ModTiles.java
Normal file
26
kfc/src/main/java/nmd/primal/forgecraft/init/ModTiles.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package nmd.primal.forgecraft.init;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import nmd.primal.forgecraft.tiles.*;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 12/2/2016.
|
||||
*/
|
||||
public class ModTiles {
|
||||
|
||||
public static void registerTileEntities () {
|
||||
registerTileEntity(TileForge.class, "firebox");
|
||||
registerTileEntity(TilePistonBellows.class, "pistonbellows");
|
||||
registerTileEntity(TileBloomery.class, "bloomery");
|
||||
registerTileEntity(TileBaseCrucible.class, "basecrucible");
|
||||
registerTileEntity(TileAnvil.class, "anvil");
|
||||
registerTileEntity(TileBreaker.class, "breaker");
|
||||
registerTileEntity(TileCastingForm.class, "castingform");
|
||||
registerTileEntity(TileCastingBlock.class, "castingblock");
|
||||
}
|
||||
|
||||
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {
|
||||
GameRegistry.registerTileEntity(tile_class, "tile.forgecraft." + baseName);
|
||||
}
|
||||
}
|
||||
27
kfc/src/main/java/nmd/primal/forgecraft/items/BaseItem.java
Normal file
27
kfc/src/main/java/nmd/primal/forgecraft/items/BaseItem.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class BaseItem extends Item
|
||||
{
|
||||
public BaseItem(String registryName)
|
||||
{
|
||||
this.setRegistryName(registryName);
|
||||
this.setUnlocalizedName(registryName);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.getRegistryName().toString();
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/19/17.
|
||||
*/
|
||||
public class BaseMultiItem extends BaseItem {
|
||||
|
||||
private Item.ToolMaterial mat;
|
||||
private int ID;
|
||||
|
||||
public BaseMultiItem( String registryName, Item.ToolMaterial material, Integer ID) {
|
||||
super(registryName);
|
||||
mat = material;
|
||||
this.ID = ID;
|
||||
|
||||
}
|
||||
|
||||
public Item.ToolMaterial getMaterial(Item item){
|
||||
return mat;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/7/17.
|
||||
*/
|
||||
public class ForgeHammer extends Item {
|
||||
|
||||
public ForgeHammer(String unlocalizedName) {
|
||||
setUnlocalizedName(unlocalizedName);
|
||||
this.setRegistryName(unlocalizedName);
|
||||
this.setMaxDamage(1000);
|
||||
//this.setHasSubtypes(true); //This just says the item has metadata
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.forgecraft.ForgeCraft;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/4/17.
|
||||
*/
|
||||
public class ItemForgingManual extends BaseItem {
|
||||
|
||||
public ItemForgingManual(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
if (world.isRemote) {
|
||||
//player.openGui(ForgeCraft.instance, GuiHandler., world, 0, 0, 0);
|
||||
player.openGui(ForgeCraft.instance, 0, world, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand));
|
||||
}
|
||||
return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/22/17.
|
||||
*/
|
||||
public class ItemSoftCrucible extends BaseItem {
|
||||
|
||||
public ItemSoftCrucible(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,897 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.BloomeryBase;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
|
||||
import nmd.primal.forgecraft.blocks.Forge;
|
||||
import nmd.primal.forgecraft.blocks.IngotBall;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/23/17.
|
||||
*/
|
||||
public class ItemStoneTongs extends Item {
|
||||
|
||||
public ItemStoneTongs(String unlocalizedName) {
|
||||
setUnlocalizedName(unlocalizedName);
|
||||
this.setRegistryName(unlocalizedName);
|
||||
//this.setMaxDamage(0);
|
||||
//this.setHasSubtypes(true); //This just says the item has metadata
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
//this.setDamage(item, 1000);
|
||||
item.getTagCompound().setInteger("type", 0);
|
||||
item.getTagCompound().setInteger("cooldown", 0);
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
item.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
item.getSubCompound("tags").setBoolean("emerald", false);
|
||||
item.getSubCompound("tags").setInteger("diamond", 0);
|
||||
item.getSubCompound("tags").setInteger("redstone", 0);
|
||||
item.getSubCompound("tags").setInteger("lapis", 0);
|
||||
item.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
|
||||
/*
|
||||
0 | Default StoneTongs
|
||||
1 | Empty Crucible Hot
|
||||
2 | Empty Crucible Cracked Hot
|
||||
|
||||
================================
|
||||
|
||||
3 | Hot Iron Crucible
|
||||
4 | Hot Cooked Iron Crucible
|
||||
5 | Hot Failed Iron Crucible
|
||||
6 | Hot Iron Ingot
|
||||
7 | Hot Iron Chunk
|
||||
--------------------------------
|
||||
8 | Hot Iron Pickaxe Head
|
||||
9 | Hot Iron Axe Head
|
||||
10 | Hot Iron Shovel Head
|
||||
11 | Hot Iron Hoe Head
|
||||
|
||||
================================
|
||||
|
||||
12 | Hot Clean Iron Crucible
|
||||
13 | Hot Cooked Clean Iron Crucible
|
||||
14 | Hot Failed Clean Iron Crucible
|
||||
15 | Hot Clean Iron Ball
|
||||
16 | Hot Clean Iron Chunk
|
||||
--------------------------------
|
||||
17 | Hot Clean Iron Pickaxe Head
|
||||
18 | Hot Clean Iron Axe Head
|
||||
19 | Hot Clean Iron Shovel Head
|
||||
20 | Hot Clean Iron Hoe Head
|
||||
|
||||
================================
|
||||
|
||||
21 | Hot Steel Crucible
|
||||
22 | Hot Cooked Steel Crucible
|
||||
23 | Hot Failed Steel Crucible
|
||||
24 | Hot Steel Ingot
|
||||
25 | Hot Steel Chunk
|
||||
--------------------------------
|
||||
26 | Hot Steel Pickaxe Head
|
||||
27 | Hot Steel Axe Head
|
||||
28 | Hot Steel Shovel Head
|
||||
29 | Hot Steel Hoe Head
|
||||
|
||||
================================
|
||||
|
||||
30 | Hot Wootz Crucible
|
||||
31 | Hot Cooked Wootz Crucible
|
||||
32 | Hot Failed Wootz Crucible
|
||||
33 | Hot Wootz Ingot
|
||||
34 | Hot Wootz Chunk
|
||||
--------------------------------
|
||||
35 | Hot Wootz Pickaxe Head
|
||||
36 | Hot Wootz Axe Head
|
||||
37 | Hot Wootz Shovel Head
|
||||
38 | Hot Wootz Hoe Head
|
||||
|
||||
================================
|
||||
|
||||
39 | Hot Bronze Crucible
|
||||
40 | Hot Cooked Bronze Crucible
|
||||
41 | Bronze Pickaxe Head
|
||||
42 | Bronze Axe Head
|
||||
43 | Bronze Shovel Head
|
||||
44 | Bronze Hoe Head
|
||||
45 | Hot Bronze Crucible Emerald
|
||||
46 | Hot Cooked Bronze Crucible Emerald
|
||||
47 | Hot Bronze Crucible Diamond
|
||||
48 | Hot Cooked Bronze Crucible Diamond
|
||||
49 | Hot Bronze Crucible Redstone
|
||||
50 | Hot Cooked Bronze Crucible Redstone
|
||||
51 | Hot Bronze Crucible Lapis
|
||||
52 | Hot Cooked Bronze Crucible Lapis
|
||||
|
||||
|
||||
*/
|
||||
|
||||
if(!world.isRemote) {
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
//System.out.println(itemstack.getTagCompound().getInteger("type"));
|
||||
//System.out.println(itemstack.getSubCompound("tags"));
|
||||
|
||||
/*****
|
||||
Picks Up Hot Ingots from the Ground
|
||||
*****/
|
||||
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof IngotBall) {
|
||||
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true) {
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) {
|
||||
itemstack.getTagCompound().setInteger("type", 6);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.ironchunk) {
|
||||
itemstack.getTagCompound().setInteger("type", 7);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanball) {
|
||||
itemstack.getTagCompound().setInteger("type", 15);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanchunk) {
|
||||
itemstack.getTagCompound().setInteger("type", 16);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.steelball) {
|
||||
itemstack.getTagCompound().setInteger("type", 24);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.steelchunk) {
|
||||
itemstack.getTagCompound().setInteger("type", 25);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
/* TODO Wootz */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****
|
||||
Picks Up Hot Crucibles from the Ground
|
||||
*****/
|
||||
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
|
||||
if(world.getBlockState(pos).getBlock() instanceof CrucibleHot) {
|
||||
TileBaseCrucible tileCrucible = (TileBaseCrucible) world.getTileEntity(pos);
|
||||
/***************************
|
||||
* Crucibles *
|
||||
***************************/
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblehot) {
|
||||
itemstack.getTagCompound().setInteger("type", 1);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblecrackedhot) {
|
||||
itemstack.getTagCompound().setInteger("type", 2);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
/***************************
|
||||
* Iron *
|
||||
***************************/
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotironcrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 3);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedironcrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 4);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.failedironcruciblehot) {
|
||||
itemstack.getTagCompound().setInteger("type", 5);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
/***************************
|
||||
* Clean Iron *
|
||||
***************************/
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcleanironcrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 12);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedcleanironcrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 13);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.failedcleanironcruciblehot) {
|
||||
itemstack.getTagCompound().setInteger("type", 14);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
/***************************
|
||||
* Steel *
|
||||
***************************/
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotsteelcrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 21);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedsteelcrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 22);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.failedsteelcruciblehot) {
|
||||
itemstack.getTagCompound().setInteger("type", 23);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
/* TODO Wootz */
|
||||
|
||||
|
||||
/***************************
|
||||
* Bronze *
|
||||
*
|
||||
45 | Hot Bronze Crucible Emerald
|
||||
46 | Hot Cooked Bronze Crucible Emerald
|
||||
47 | Hot Bronze Crucible Diamond
|
||||
48 | Hot Cooked Bronze Crucible Diamond
|
||||
49 | Hot Bronze Crucible Redstone
|
||||
50 | Hot Cooked Bronze Crucible Redstone
|
||||
51 | Hot Bronze Crucible Lapis
|
||||
52 | Hot Cooked Bronze Crucible Lapis
|
||||
***************************/
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 39);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible) {
|
||||
itemstack.getTagCompound().setInteger("type", 40);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_emerald) {
|
||||
itemstack.getTagCompound().setInteger("type", 45);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_emerald) {
|
||||
itemstack.getTagCompound().setInteger("type", 46);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_diamond) {
|
||||
itemstack.getTagCompound().setInteger("type", 47);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_diamond) {
|
||||
itemstack.getTagCompound().setInteger("type", 48);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_redstone) {
|
||||
itemstack.getTagCompound().setInteger("type", 49);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_redstone) {
|
||||
itemstack.getTagCompound().setInteger("type", 50);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_lapis) {
|
||||
itemstack.getTagCompound().setInteger("type", 51);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_lapis) {
|
||||
itemstack.getTagCompound().setInteger("type", 52);
|
||||
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
|
||||
world.setBlockToAir(pos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
/*****
|
||||
Places the content from the Tongs to the World
|
||||
*****/
|
||||
if ((world.getBlockState(pos).getBlock() instanceof Crucible) || (world.getBlockState(pos).getBlock() instanceof CrucibleHot)) {
|
||||
return EnumActionResult.FAIL;
|
||||
} else if (world.getBlockState(pos).getMaterial() == Material.ROCK ||
|
||||
world.getBlockState(pos).getMaterial() == Material.SAND ||
|
||||
world.getBlockState(pos).getMaterial() == Material.IRON ||
|
||||
world.getBlockState(pos).getMaterial() == Material.ANVIL )
|
||||
{
|
||||
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
|
||||
if (world.getBlockState(tempPos).getBlock() == Blocks.AIR) {
|
||||
switch (itemstack.getTagCompound().getInteger("type")) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
world.setBlockState(tempPos, ModBlocks.emptycruciblehot.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible1 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible1.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 2:
|
||||
world.setBlockState(tempPos, ModBlocks.emptycruciblecrackedhot.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible2 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible2.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 3:
|
||||
world.setBlockState(tempPos, ModBlocks.hotironcrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible3 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible3.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 4:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedironcrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible4 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible4.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 5:
|
||||
world.setBlockState(tempPos, ModBlocks.failedironcruciblehot.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible5 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible5.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 6:
|
||||
world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 7:
|
||||
world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 8:
|
||||
return EnumActionResult.FAIL;
|
||||
case 9:
|
||||
return EnumActionResult.FAIL;
|
||||
case 10:
|
||||
return EnumActionResult.FAIL;
|
||||
case 11:
|
||||
return EnumActionResult.FAIL;
|
||||
case 12:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcleanironcrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible12 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible12.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 13:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedcleanironcrucible.getDefaultState(), 2);
|
||||
TileBaseCrucible tileCrucible13 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible13.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 14:
|
||||
world.setBlockState(tempPos, ModBlocks.failedcleanironcruciblehot.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible14 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible14.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 15:
|
||||
world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 16:
|
||||
world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 17:
|
||||
return EnumActionResult.FAIL;
|
||||
case 18:
|
||||
return EnumActionResult.FAIL;
|
||||
case 19:
|
||||
return EnumActionResult.FAIL;
|
||||
case 20:
|
||||
return EnumActionResult.FAIL;
|
||||
case 21:
|
||||
world.setBlockState(tempPos, ModBlocks.hotsteelcrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible21 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible21.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 22:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedsteelcrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible22 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible22.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 23:
|
||||
world.setBlockState(tempPos, ModBlocks.failedsteelcruciblehot.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible23 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible23.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 24:
|
||||
world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 25:
|
||||
world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 39:
|
||||
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible39 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible39.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 40:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible40 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible40.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
/***************************
|
||||
* Bronze *
|
||||
*
|
||||
45 | Hot Bronze Crucible Emerald
|
||||
46 | Hot Cooked Bronze Crucible Emerald
|
||||
47 | Hot Bronze Crucible Diamond
|
||||
48 | Hot Cooked Bronze Crucible Diamond
|
||||
49 | Hot Bronze Crucible Redstone
|
||||
50 | Hot Cooked Bronze Crucible Redstone
|
||||
51 | Hot Bronze Crucible Lapis
|
||||
52 | Hot Cooked Bronze Crucible Lapis
|
||||
***************************/
|
||||
case 45:
|
||||
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_emerald.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible45 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible45.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 46:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_emerald.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible46 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible46.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 47:
|
||||
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_diamond.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible47 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible47.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 48:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_diamond.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible48 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible48.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 49:
|
||||
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_redstone.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible49 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible49.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 50:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_redstone.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible50 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible50.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 51:
|
||||
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_lapis.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible51 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible51.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
case 52:
|
||||
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_lapis.getDefaultState(), 3);
|
||||
TileBaseCrucible tileCrucible52 = (TileBaseCrucible) world.getTileEntity(tempPos);
|
||||
tileCrucible52.countdown = itemstack.getTagCompound().getInteger("cooldown");
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 0);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*****
|
||||
Pulls the crucible from the Bloomery
|
||||
*****/
|
||||
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase) {
|
||||
if (itemstack.getTagCompound().getInteger("type") == 0) {
|
||||
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
|
||||
if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblehot))) {
|
||||
itemstack.getTagCompound().setInteger("type", 1);
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblecrackedhot))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 2);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotironcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 3);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedironcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 4);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedironcruciblehot))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 5);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcleanironcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 12);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedcleanironcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 13);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedcleanironcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 14);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotsteelcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 21);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedsteelcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 22);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedsteelcrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 23);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 39);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 40);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
/***************************
|
||||
* Bronze *
|
||||
*
|
||||
45 | Hot Bronze Crucible Emerald
|
||||
46 | Hot Cooked Bronze Crucible Emerald
|
||||
47 | Hot Bronze Crucible Diamond
|
||||
48 | Hot Cooked Bronze Crucible Diamond
|
||||
49 | Hot Bronze Crucible Redstone
|
||||
50 | Hot Cooked Bronze Crucible Redstone
|
||||
51 | Hot Bronze Crucible Lapis
|
||||
52 | Hot Cooked Bronze Crucible Lapis
|
||||
***************************/
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_emerald))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 45);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_emerald))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 46);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_diamond))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 47);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_diamond))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 48);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_redstone))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 49);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_redstone))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 50);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_lapis))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 51);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_lapis))) {
|
||||
itemstack.getTagCompound().setInteger("cooldown", 0);
|
||||
itemstack.getTagCompound().setInteger("type", 52);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*****
|
||||
Pulls the Tool Parts from the Forge
|
||||
*****/
|
||||
if(itemstack.getTagCompound().getInteger("type") == 0){
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
itemstack.getTagCompound().setInteger("type", 7);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
itemstack.getTagCompound().setInteger("type", 6);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.pickaxehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 8);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironaxehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 9);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironshovelhead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 10);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironhoehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 11);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleanchunkhot)) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
itemstack.getTagCompound().setInteger("type", 16);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleaningotballhot)) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
itemstack.getTagCompound().setInteger("type", 15);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironpickaxehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 17);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironaxehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 18);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironshovelhead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 19);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironhoehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 20);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.steelchunkhot)) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
itemstack.getTagCompound().setInteger("type", 25);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.steelingotballhot)) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
itemstack.getTagCompound().setInteger("type", 24);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.steelpickaxehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 26);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.steelaxehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 27);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.steelshovelhead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 28);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem().equals(ModItems.steelhoehead)) {
|
||||
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
|
||||
itemstack.getTagCompound().setInteger("type", 29);
|
||||
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
|
||||
itemstack.getTagCompound().setTag("tags", tags);
|
||||
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
|
||||
//itemstack.getSubCompound("tags").setBoolean("hot", true);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
else return EnumActionResult.FAIL;
|
||||
//System.out.println(itemstack.getTagCompound().getInteger("type"));
|
||||
}
|
||||
//System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
//tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
|
||||
//tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
|
||||
}
|
||||
|
||||
}
|
||||
12
kfc/src/main/java/nmd/primal/forgecraft/items/ItemTest.java
Normal file
12
kfc/src/main/java/nmd/primal/forgecraft/items/ItemTest.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class ItemTest extends BaseItem {
|
||||
|
||||
public ItemTest(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package nmd.primal.forgecraft.items.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.enumhandler.EnumHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//import static nmd.primal.forgecraft.enumhandler.EnumHandler.IngotTypes.*;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/12/17.
|
||||
*/
|
||||
public class ItemBlockIngotBall extends ItemBlock {
|
||||
|
||||
public ItemBlockIngotBall(Block block){
|
||||
super(block);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
//this.setRegistryName(name);
|
||||
}
|
||||
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
|
||||
public String getUnlocalizedNameInefficiently(ItemStack stack) {
|
||||
EnumHandler.IngotTypes v = EnumHandler.IngotTypes.values()[stack.getItemDamage()];
|
||||
//EnumOreType z = EnumOreType.values()[stack.getItemDamage()];
|
||||
switch(v) {
|
||||
case IRONCOOL:
|
||||
case IRONHOT:
|
||||
|
||||
return "item.forgecraft:"+v.name;
|
||||
default:
|
||||
return "item.forgecraft:unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
subItems.add(new ItemStack(itemIn, 1, EnumHandler.IngotTypes.IRONCOOL.meta));
|
||||
subItems.add(new ItemStack(itemIn, 1, EnumHandler.IngotTypes.IRONHOT.meta));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package nmd.primal.forgecraft.items.casting;
|
||||
|
||||
import nmd.primal.forgecraft.items.BaseItem;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/24/17.
|
||||
*/
|
||||
public class CastingPart extends BaseItem {
|
||||
|
||||
public CastingPart(String registryName) {
|
||||
super(registryName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package nmd.primal.forgecraft.items.parts;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/9/17.
|
||||
*/
|
||||
public class BronzeToolPart extends Item implements ToolNBT{
|
||||
|
||||
private int ID;
|
||||
|
||||
public BronzeToolPart(String name, ToolMaterial material, Integer ID) {
|
||||
this.setMaxDamage(material.getMaxUses());
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
//this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.ID = ID;
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
|
||||
{
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
|
||||
if (getModifiers(item) != 0) {
|
||||
if (getEmerald(item)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if (getDiamondLevel(item) == 1) {
|
||||
return 0.2F;
|
||||
}
|
||||
|
||||
if ( getRedstoneLevel(item) == 1) {
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
if (getLapisLevel(item) == 1) {
|
||||
return 0.4F;
|
||||
}
|
||||
}
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
|
||||
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades");
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item));
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
package nmd.primal.forgecraft.items.parts;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/9/17.
|
||||
*/
|
||||
public class ToolPart extends Item implements ToolNBT{
|
||||
|
||||
private int ID;
|
||||
|
||||
public ToolPart(String name, Item.ToolMaterial material, Integer ID) {
|
||||
this.setMaxDamage(material.getMaxUses());
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
//this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.ID = ID;
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
|
||||
{
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) != 0) {
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.11F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.102F;
|
||||
}
|
||||
|
||||
// ============
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.01F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.02F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 3) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 3) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.003F;
|
||||
}
|
||||
|
||||
//=========
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 3)) {
|
||||
return 0.0003F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2) ) {
|
||||
return 0.0102F;
|
||||
}
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 1) ) {
|
||||
return 0.0011F;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getHot(item) == true) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
|
||||
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades");
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item));
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/25/17.
|
||||
*/
|
||||
public class BronzeAxe extends ItemAxe implements ToolNBT {
|
||||
|
||||
public BronzeAxe(String name, Item.ToolMaterial material) {
|
||||
super(material, 5, -2f);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
|
||||
if (getModifiers(item) != 0) {
|
||||
if (getEmerald(item)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if (getDiamondLevel(item) == 1) {
|
||||
return 0.2F;
|
||||
}
|
||||
|
||||
if ( getRedstoneLevel(item) == 1) {
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
if (getLapisLevel(item) == 1) {
|
||||
return 0.4F;
|
||||
}
|
||||
}
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
}
|
||||
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
|
||||
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzeaxehead, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(!item.isEmpty()) {
|
||||
if (player.getEntityWorld().isRemote) {
|
||||
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + "1" );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + "5" );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
//System.out.println(world.getBlockState(pos).getBlock());
|
||||
if(itemstack.getItem() instanceof CustomAxe){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
/*if( getDiamondLevel(itemstack) > 0 ){
|
||||
itemstack.getItem().setHarvestLevel("pickaxe", 3);
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
Material material = state.getMaterial();
|
||||
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||
|
||||
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
|
||||
return super.getStrVsBlock(stack, state);
|
||||
} else {
|
||||
return this.efficiencyOnProperMaterial + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/21/17.
|
||||
*/
|
||||
public class BronzeHoe extends ItemHoe implements ToolNBT {
|
||||
|
||||
public BronzeHoe(String name, ToolMaterial material) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
|
||||
if (getModifiers(item) != 0) {
|
||||
if (getEmerald(item)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if (getDiamondLevel(item) == 1) {
|
||||
return 0.2F;
|
||||
}
|
||||
|
||||
if ( getRedstoneLevel(item) == 1) {
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
if (getLapisLevel(item) == 1) {
|
||||
return 0.4F;
|
||||
}
|
||||
}
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
|
||||
}
|
||||
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
|
||||
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzehoehead, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
if(itemstack.getItem() instanceof BronzeHoe){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
/*if( getDiamondLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
|
||||
itemstack.getItem().setHarvestLevel("pickaxe", 3);
|
||||
}*/
|
||||
/*if( getRedstoneLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
|
||||
//System.out.println(itemstack.getEnchantmentTagList());
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/14/17.
|
||||
*/
|
||||
public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
|
||||
|
||||
public BronzePickaxe(String name, ToolMaterial material) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
//this.toolClass = "pickaxe";
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
|
||||
if (getModifiers(item) != 0) {
|
||||
if (getEmerald(item)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if (getDiamondLevel(item) == 1) {
|
||||
return 0.2F;
|
||||
}
|
||||
|
||||
if ( getRedstoneLevel(item) == 1) {
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
if (getLapisLevel(item) == 1) {
|
||||
return 0.4F;
|
||||
}
|
||||
}
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
|
||||
}
|
||||
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
|
||||
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzepickaxehead, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
//System.out.println(world.getBlockState(pos).getBlock());
|
||||
if(itemstack.getItem() instanceof BronzePickaxe){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
/*if( getDiamondLevel(itemstack) > 0 ){
|
||||
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
|
||||
itemstack.getItem().setHarvestLevel("pickaxe", 3);
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
Material material = state.getMaterial();
|
||||
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||
|
||||
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
|
||||
return super.getStrVsBlock(stack, state);
|
||||
} else {
|
||||
return this.efficiencyOnProperMaterial + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/21/17.
|
||||
*/
|
||||
public class BronzeShovel extends ItemSpade implements ToolNBT {
|
||||
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
|
||||
|
||||
public BronzeShovel(String name, ToolMaterial material) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
|
||||
if (getModifiers(item) != 0) {
|
||||
if (getEmerald(item)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if (getDiamondLevel(item) == 1) {
|
||||
return 0.2F;
|
||||
}
|
||||
|
||||
if ( getRedstoneLevel(item) == 1) {
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
if (getLapisLevel(item) == 1) {
|
||||
return 0.4F;
|
||||
}
|
||||
}
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
|
||||
}
|
||||
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
|
||||
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzeshovelhead, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
if(itemstack.getItem() instanceof BronzeShovel){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
for (String type : getToolClasses(stack))
|
||||
{
|
||||
if (state.getBlock().isToolEffective(type, state))
|
||||
return efficiencyOnProperMaterial;
|
||||
}
|
||||
return this.efficiencyOnProperMaterial + 1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/20/17.
|
||||
*/
|
||||
public class CustomAxe extends ItemAxe implements ToolNBT {
|
||||
|
||||
public CustomAxe(String name, Item.ToolMaterial material) {
|
||||
super(material, 6, -3.1f);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
|
||||
|
||||
if (getHot(item) != true) {
|
||||
if (getModifiers(item) != 0) {
|
||||
if ((getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.11F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.111F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.102F;
|
||||
}
|
||||
|
||||
// ============
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.01F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.02F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 3) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.001F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.002F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 3) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.003F;
|
||||
}
|
||||
|
||||
//=========
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0001F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0002F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 3)) {
|
||||
return 0.0003F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0111F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.021F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.012F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0012F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0021F;
|
||||
}
|
||||
|
||||
if ((getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0102F;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getHot(item) == true) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
}
|
||||
if( this.getMaxDamage(item) - this.getDamage(item) < 5 ){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(!item.isEmpty()) {
|
||||
if (player.getEntityWorld().isRemote) {
|
||||
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
//System.out.println(world.getBlockState(pos).getBlock());
|
||||
if(itemstack.getItem() instanceof CustomAxe){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
if( getDiamondLevel(itemstack) > 0 ){
|
||||
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
|
||||
itemstack.getItem().setHarvestLevel("pickaxe", 3);
|
||||
}
|
||||
/*if( getRedstoneLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
|
||||
//System.out.println(itemstack.getEnchantmentTagList());
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
Material material = state.getMaterial();
|
||||
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||
|
||||
if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){
|
||||
return super.getStrVsBlock(stack, state);
|
||||
} else {
|
||||
return this.efficiencyOnProperMaterial * ( (this.getRedstoneLevel(stack) * 2 ) + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/21/17.
|
||||
*/
|
||||
public class CustomHoe extends ItemHoe implements ToolNBT {
|
||||
|
||||
public CustomHoe(String name, Item.ToolMaterial material) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) != 0) {
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.11F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.102F;
|
||||
}
|
||||
|
||||
// ============
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.01F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.02F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 3) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 3) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.003F;
|
||||
}
|
||||
|
||||
//=========
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 3)) {
|
||||
return 0.0003F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2) ) {
|
||||
return 0.0102F;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getHot(item) == true) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
if(itemstack.getItem() instanceof CustomHoe){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
/*if( getDiamondLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
|
||||
itemstack.getItem().setHarvestLevel("pickaxe", 3);
|
||||
}*/
|
||||
/*if( getRedstoneLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
|
||||
//System.out.println(itemstack.getEnchantmentTagList());
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/14/17.
|
||||
*/
|
||||
public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
|
||||
|
||||
public CustomPickaxe(String name, Item.ToolMaterial material) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
//this.toolClass = "pickaxe";
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) != 0) {
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.11F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.102F;
|
||||
}
|
||||
|
||||
// ============
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.01F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.02F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 3) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 3) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.003F;
|
||||
}
|
||||
|
||||
//=========
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 3)) {
|
||||
return 0.0003F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2) ) {
|
||||
return 0.0102F;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getHot(item) == true) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
|
||||
}
|
||||
}
|
||||
/*if(){
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
//tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() );
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
//System.out.println(world.getBlockState(pos).getBlock());
|
||||
if(itemstack.getItem() instanceof CustomPickaxe){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
if( getDiamondLevel(itemstack) > 0 ){
|
||||
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
|
||||
itemstack.getItem().setHarvestLevel("pickaxe", 3);
|
||||
}
|
||||
/*if( getRedstoneLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
|
||||
//System.out.println(itemstack.getEnchantmentTagList());
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
Material material = state.getMaterial();
|
||||
//return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||
|
||||
if(material != Material.IRON && material != Material.ANVIL && material != Material.ROCK){
|
||||
return super.getStrVsBlock(stack, state);
|
||||
} else {
|
||||
return this.efficiencyOnProperMaterial * ( (this.getRedstoneLevel(stack) * 2 ) + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
package nmd.primal.forgecraft.items.tools;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/21/17.
|
||||
*/
|
||||
public class CustomShovel extends ItemSpade implements ToolNBT {
|
||||
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
|
||||
|
||||
public CustomShovel(String name, Item.ToolMaterial material) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
/***
|
||||
|
||||
hot . emerald . diamond . redstone . lapis
|
||||
0 . 0 . 0 . 0 . 0
|
||||
|
||||
***/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
if (item.hasTagCompound()) {
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) != 0) {
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.11F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == true) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.102F;
|
||||
}
|
||||
|
||||
// ============
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.01F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.02F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 3) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 3) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.003F;
|
||||
}
|
||||
|
||||
//=========
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0001F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0002F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 3)) {
|
||||
return 0.0003F;
|
||||
}
|
||||
|
||||
//=======
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0111F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 2) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 0)) {
|
||||
return 0.012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 1) &&
|
||||
(getLapisLevel(item) == 2)) {
|
||||
return 0.0012F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 0) &&
|
||||
(getRedstoneLevel(item) == 2) &&
|
||||
(getLapisLevel(item) == 1)) {
|
||||
return 0.0021F;
|
||||
}
|
||||
|
||||
if ( (getEmerald(item) == false) &&
|
||||
(getDiamondLevel(item) == 1) &&
|
||||
(getRedstoneLevel(item) == 0) &&
|
||||
(getLapisLevel(item) == 2) ) {
|
||||
return 0.0102F;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getHot(item) == true) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
if (getHot(item) == false) {
|
||||
if (getModifiers(item) == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
/*setHot(item, false);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
if (!item.hasTagCompound()) {
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
item.getTagCompound().setTag("tags", tags);
|
||||
|
||||
setHot(item, false);
|
||||
setEmerald(item, false);
|
||||
setDiamondLevel(item, 0);
|
||||
setRedstoneLevel(item, 0);
|
||||
setLapisLevel(item, 0);
|
||||
setModifiers(item, 0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void onItemTooltip(ItemTooltipEvent event){
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
if(player.getEntityWorld().isRemote) {
|
||||
|
||||
if(item.hasTagCompound()) {
|
||||
|
||||
tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
|
||||
if (getEmerald(item) == true) {
|
||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||
}
|
||||
if (getDiamondLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
|
||||
}
|
||||
if (getRedstoneLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
|
||||
}
|
||||
if (getLapisLevel(item) > 0) {
|
||||
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
|
||||
}
|
||||
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
if(!player.world.isRemote){
|
||||
World world = player.getEntityWorld();
|
||||
if(itemstack.getItem() instanceof CustomShovel){
|
||||
if( getEmerald(itemstack)){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
if( getDiamondLevel(itemstack) > 0 ){
|
||||
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
|
||||
itemstack.getItem().setHarvestLevel("shovel", 3);
|
||||
}
|
||||
/*if( getRedstoneLevel(itemstack) > 0 ){
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
|
||||
//System.out.println(itemstack.getEnchantmentTagList());
|
||||
}*/
|
||||
if ( getLapisLevel(itemstack) > 0) {
|
||||
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
|
||||
stack.getTagCompound().removeTag("ench");
|
||||
//System.out.println(stack.getTagCompound());
|
||||
if(getDiamondLevel(stack) > 0) {
|
||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||
stack.damageItem(1, entityLiving);
|
||||
}
|
||||
} else stack.damageItem(1, entityLiving);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
for (String type : getToolClasses(stack))
|
||||
{
|
||||
if (state.getBlock().isToolEffective(type, state))
|
||||
return efficiencyOnProperMaterial;
|
||||
}
|
||||
return this.EFFECTIVE_ON.contains(state.getBlock()) ? (this.efficiencyOnProperMaterial * ( (this.getRedstoneLevel(stack) * 2 ) + 1)) : 1.0F;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package nmd.primal.forgecraft.items.weapons;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemShield;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/30/17.
|
||||
*/
|
||||
public class CustomShield extends ItemShield {
|
||||
|
||||
public CustomShield(String name, Item.ToolMaterial material)
|
||||
{
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
this.setMaxDamage(material.getMaxUses());
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("blocking"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package nmd.primal.forgecraft.items.weapons;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/23/17.
|
||||
*/
|
||||
public class CustomSword extends ItemSword {
|
||||
|
||||
private double attack, speed;
|
||||
|
||||
public CustomSword(String name, Item.ToolMaterial material, double attackDamage, double attackSpeed) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
this.attack = attackDamage;
|
||||
this.speed = attackSpeed;
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
|
||||
{
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attack, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.speed, 0));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package nmd.primal.forgecraft.items.weapons;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.entities.projectiles.EntityMuckBall;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModSounds;
|
||||
import nmd.primal.forgecraft.items.BaseItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Lyle on 4/2/2017.
|
||||
*/
|
||||
public class Musket extends BaseItem{
|
||||
|
||||
public Musket(String name) {
|
||||
super(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
//this.description = ".72 Calibre"
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
if(item.hasTagCompound()){
|
||||
if ( item.getTagCompound().getBoolean("use") == true) {
|
||||
return 0.1f;
|
||||
} else return 0.0f;
|
||||
} else return 0.0f;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// Temporary onItemRightClick method
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft)
|
||||
{
|
||||
System.out.println("Stopped Using");
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
System.out.println(player.getItemInUseCount());
|
||||
|
||||
|
||||
//if(player.getItemInUseCount() > 5) {
|
||||
world.playSound( null, player.posX, player.posY, player.posZ, ModSounds.MUSKET_SHOT, SoundCategory.BLOCKS, 0.5F, 0.3F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
EntityMuckBall entity = new EntityMuckBall(world, player);
|
||||
entity.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 7.0F, 0.5F);
|
||||
world.spawnEntity(entity);
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
stack.getTagCompound().setBoolean("use", false);
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entityLiving)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
world.playSound( null, player.posX, player.posY, player.posZ, ModSounds.MUSKET_SHOT, SoundCategory.BLOCKS, 0.5F, 0.3F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
EntityMuckBall entity = new EntityMuckBall(world, player);
|
||||
entity.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0F, 7.0F, 0.5F);
|
||||
world.spawnEntity(entity);
|
||||
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
|
||||
{
|
||||
ItemStack itemstack = playerIn.getHeldItem(handIn);
|
||||
boolean flag = true;
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
itemstack.getTagCompound().setBoolean("use", true);
|
||||
|
||||
ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, worldIn, playerIn, handIn, flag);
|
||||
if (ret != null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!playerIn.capabilities.isCreativeMode && !flag)
|
||||
{
|
||||
return flag ? new ActionResult(EnumActionResult.PASS, itemstack) : new ActionResult(EnumActionResult.FAIL, itemstack);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerIn.setActiveHand(handIn);
|
||||
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 7200;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public EnumAction getItemUseAction(ItemStack stack)
|
||||
{
|
||||
return EnumAction.BOW;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package nmd.primal.forgecraft.items.weapons;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/25/17.
|
||||
*/
|
||||
public class SlayerSword extends ItemSword {
|
||||
|
||||
private double attack, speed;
|
||||
|
||||
public SlayerSword(String name, Item.ToolMaterial material, double attackDamage, double attackSpeed) {
|
||||
super(material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
this.attack = attackDamage;
|
||||
this.speed = attackSpeed;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity playerin, int itemSlot, boolean isSelected) {
|
||||
|
||||
if(isSelected){
|
||||
playerin.setSprinting(false);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemEnchantability(ItemStack stack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
|
||||
{
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attack, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.speed, 0));
|
||||
}
|
||||
|
||||
return multimap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package nmd.primal.forgecraft.proxy;
|
||||
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.renders.blocks.*;
|
||||
import nmd.primal.forgecraft.tiles.*;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class ClientProxy implements CommonProxy {
|
||||
|
||||
@Override
|
||||
public void preInit(){
|
||||
ModItems.registerCustomRenders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
|
||||
//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.stonetongs, 0, new ModelResourceLocation("stonetongs", "inventory"));
|
||||
ModItems.registerRenders();
|
||||
ModBlocks.registerRenders();
|
||||
//this.registerModelBakeryStuff();
|
||||
this.registerTileRendering();
|
||||
}
|
||||
|
||||
//@Override
|
||||
public void registerTileRendering()
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileForge.class, new TileForgeRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePistonBellows.class, new TilePistonBellowsRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBloomery.class, new TileBloomeryRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAnvil.class, new TileAnvilRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBreaker.class, new TileBreakerRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingForm.class, new TileCastingformRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingBlock.class, new TileCastingBlockRender());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModelBakeryVariants(){
|
||||
//ModelBakery.registerItemVariants(ModItems.stonetongs, new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),
|
||||
// new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhot"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package nmd.primal.forgecraft.proxy;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public interface CommonProxy {
|
||||
|
||||
public void preInit();
|
||||
|
||||
public void init();
|
||||
|
||||
public void registerModelBakeryVariants();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package nmd.primal.forgecraft.proxy;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class ServerProxy implements CommonProxy {
|
||||
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
}
|
||||
|
||||
public void init(){
|
||||
|
||||
}
|
||||
|
||||
public void registerModelBakeryVariants(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,533 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
|
||||
import nmd.primal.forgecraft.blocks.IngotBall;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/5/17.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
|
||||
{
|
||||
|
||||
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileAnvil tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof AnvilBase) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y + 1.5D, z);
|
||||
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
/*
|
||||
NORTH
|
||||
SLOT | X | Y
|
||||
0 | 2/16 | 2/16
|
||||
1 | 5/16 | 2/16
|
||||
2 | 8/16 | 2/16
|
||||
3 | 11/16 | 2/16
|
||||
4 | 14/16 | 2/16
|
||||
--------------------
|
||||
5 | 2/16 | 5/16
|
||||
6 | 5/16 | 5/16
|
||||
7 | 8/16 | 5/16
|
||||
8 | 11/16 | 5/16
|
||||
9 | 14/16 | 5/16
|
||||
--------------------
|
||||
10 | 2/16 | 8/16
|
||||
11 | 5/16 | 8/16
|
||||
12 | 8/16 | 8/16
|
||||
13 | 11/16 | 8/16
|
||||
14 | 14/16 | 8/16
|
||||
--------------------
|
||||
15 | 2/16 | 11/16
|
||||
16 | 5/16 | 11/16
|
||||
17 | 8/16 | 11/16
|
||||
18 | 11/16 | 11/16
|
||||
19 | 14/16 | 11/16
|
||||
--------------------
|
||||
20 | 2/16 | 14/16
|
||||
21 | 5/16 | 14/16
|
||||
22 | 8/16 | 14/16
|
||||
23 | 11/16 | 14/16
|
||||
24 | 14/16 | 14/16
|
||||
*/
|
||||
|
||||
|
||||
if (state.getValue(AnvilBase.FACING) == EnumFacing.NORTH) {
|
||||
int counter = 0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int a = 0; a < 5; a++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(Items.REDSTONE) ||
|
||||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
|
||||
item.equals(PrimalItems.EMERALD_KNAPP) ||
|
||||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
|
||||
item.equals(Items.DIAMOND) ||
|
||||
item.equals(Items.EMERALD)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.499D, tile.getNormalZ(i));
|
||||
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
|
||||
GL11.glScaled(0.25D, 0.25D, 0.25D);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.pickaxehead) ||
|
||||
item.equals(ModItems.cleanironpickaxehead) ||
|
||||
item.equals(ModItems.steelpickaxehead) ||
|
||||
item.equals(ModItems.wootzpickaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.465D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironaxehead) ||
|
||||
item.equals(ModItems.cleanironaxehead) ||
|
||||
item.equals(ModItems.steelaxehead) ||
|
||||
item.equals(ModItems.wootzaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.51D, tile.getNormalZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotated(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironshovelhead) ||
|
||||
item.equals(ModItems.cleanironshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.450D, tile.getNormalZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotated(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironhoehead) ||
|
||||
item.equals(ModItems.cleanironhoehead) ||
|
||||
item.equals(ModItems.steelhoehead) ||
|
||||
item.equals(ModItems.steelhoehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.50D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(AnvilStone.FACING) == EnumFacing.SOUTH) {
|
||||
int counter = 0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int a = 0; a < 5; a++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(Items.REDSTONE) ||
|
||||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
|
||||
item.equals(PrimalItems.EMERALD_KNAPP) ||
|
||||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
|
||||
item.equals(Items.DIAMOND) ||
|
||||
item.equals(Items.EMERALD)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.49D, tile.getReverseZ(i));
|
||||
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
|
||||
GL11.glScaled(0.25D, 0.25D, 0.25D);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.pickaxehead) ||
|
||||
item.equals(ModItems.cleanironpickaxehead) ||
|
||||
item.equals(ModItems.steelpickaxehead) ||
|
||||
item.equals(ModItems.wootzpickaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironaxehead) ||
|
||||
item.equals(ModItems.cleanironaxehead) ||
|
||||
item.equals(ModItems.steelaxehead) ||
|
||||
item.equals(ModItems.wootzaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironshovelhead) ||
|
||||
item.equals(ModItems.cleanironshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironhoehead) ||
|
||||
item.equals(ModItems.cleanironhoehead) ||
|
||||
item.equals(ModItems.steelhoehead) ||
|
||||
item.equals(ModItems.wootzhoehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(AnvilStone.FACING) == EnumFacing.WEST) {
|
||||
int counter = 0;
|
||||
for (int a = 0; a < 5; a++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(Items.REDSTONE) ||
|
||||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
|
||||
item.equals(PrimalItems.EMERALD_KNAPP) ||
|
||||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
|
||||
item.equals(Items.DIAMOND) ||
|
||||
item.equals(Items.EMERALD)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.49D, tile.getReverseZ(i));
|
||||
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
|
||||
GL11.glScaled(0.25D, 0.25D, 0.25D);
|
||||
GL11.glRotated(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.pickaxehead) ||
|
||||
item.equals(ModItems.cleanironpickaxehead) ||
|
||||
item.equals(ModItems.steelpickaxehead) ||
|
||||
item.equals(ModItems.wootzpickaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironaxehead) ||
|
||||
item.equals(ModItems.cleanironaxehead) ||
|
||||
item.equals(ModItems.steelaxehead) ||
|
||||
item.equals(ModItems.wootzaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironshovelhead) ||
|
||||
item.equals(ModItems.cleanironshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironhoehead)) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getReverseZ(i));
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(AnvilStone.FACING) == EnumFacing.EAST) {
|
||||
int counter = 0;
|
||||
for (int a = 0; a < 5; a++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(Items.REDSTONE) ||
|
||||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
|
||||
item.equals(PrimalItems.EMERALD_KNAPP) ||
|
||||
item.equals(PrimalItems.DIAMOND_KNAPP) ||
|
||||
item.equals(Items.DIAMOND) ||
|
||||
item.equals(Items.EMERALD)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.49D, tile.getNormalZ(i));
|
||||
GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glScaled(0.25D, 0.25D, 0.25D);
|
||||
GL11.glRotated(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotated(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.pickaxehead) ||
|
||||
item.equals(ModItems.cleanironpickaxehead) ||
|
||||
item.equals(ModItems.steelpickaxehead) ||
|
||||
item.equals(ModItems.wootzpickaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironaxehead) ||
|
||||
item.equals(ModItems.cleanironaxehead) ||
|
||||
item.equals(ModItems.steelaxehead) ||
|
||||
item.equals(ModItems.wootzaxehead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironshovelhead) ||
|
||||
item.equals(ModItems.cleanironshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead) ||
|
||||
item.equals(ModItems.steelshovelhead)
|
||||
) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item.equals(ModItems.ironhoehead)) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.455D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void doRendering(TileAnvil tile, Integer counter, Integer i, Integer a){
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if(item.equals(Items.REDSTONE) ||
|
||||
(item.equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
|
||||
item.equals(PrimalItems.EMERALD_KNAPP) ||
|
||||
item.equals(PrimalItems.DIAMOND_KNAPP)
|
||||
){
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated( tile.getNormalX(a), -0.49D, tile.getNormalZ(i) );
|
||||
GL11.glRotated(-90.0F, 1.0F, -0.0F, 0.0F);
|
||||
GL11.glScaled(0.25D, 0.25D, 0.25D);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(item.equals(ModItems.pickaxehead)){
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(item.equals(ModItems.ironaxehead)){
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(item.equals(ModItems.ironshovelhead)){
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(item.equals(ModItems.ironhoehead)){
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.435D, tile.getNormalZ(i));
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(item == ModItems.ironingotballhot ){
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(item == ModItems.ironchunkhot){
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.455D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.BloomeryBase;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/22/17.
|
||||
*/
|
||||
public class TileBloomeryRender extends TileEntitySpecialRenderer<TileBloomery>
|
||||
{
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileBloomery tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof BloomeryBase) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y + 0.0626D, z + 0.5D);
|
||||
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
ItemStack stack0 = tile.getSlotStack(0);
|
||||
ItemStack stack1 = tile.getSlotStack(1);
|
||||
|
||||
|
||||
if (!stack0.isEmpty()) {
|
||||
|
||||
boolean is_block = stack0.getItem() instanceof ItemBlock;
|
||||
float scale = is_block ? 0.1725F : 0.3F;
|
||||
double xTrans = is_block ? -1.6D : -0.45D;
|
||||
double yTrans = is_block ? -1.26D : -0.7D;
|
||||
int stackRotation = stack0.getCount();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(stack0, renderItem.getItemModelMesher().getItemModel(stack0));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
for (int i = 0; i < Math.ceil(stackRotation / 8) + 1; i++) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glRotated(45.0F * i, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslated(xTrans, yTrans, 0.0D);
|
||||
renderItem.renderItem(stack0, renderItem.getItemModelMesher().getItemModel(stack0));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
if (!stack1.isEmpty()) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.50D, 0);
|
||||
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.Breaker;
|
||||
import nmd.primal.forgecraft.tiles.TileBreaker;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 4/9/17.
|
||||
*/
|
||||
public class TileBreakerRender extends TileEntitySpecialRenderer<TileBreaker>
|
||||
{
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileBreaker tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof Breaker) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
//ItemStack stack0 = tile.getSlotStack(0);
|
||||
|
||||
if (state.getValue(Breaker.FACING) == EnumFacing.NORTH) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5D, 0.450D, 0.7);
|
||||
GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(-135, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
|
||||
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (state.getValue(Breaker.FACING) == EnumFacing.EAST) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.3D, 0.450D, 0.5);
|
||||
//GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(-135, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
|
||||
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (state.getValue(Breaker.FACING) == EnumFacing.SOUTH) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5D, 0.450D, 0.3);
|
||||
GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(45, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, -1.0f);
|
||||
|
||||
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
|
||||
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (state.getValue(Breaker.FACING) == EnumFacing.WEST) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.7D, 0.450D, 0.5);
|
||||
//GL11.glRotated(90, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(45, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL11.glRotatef(tile.getCharge(), 0.0f, 0.0f, -1.0f);
|
||||
|
||||
GL11.glTranslatef(0.0f, 0.40f, 0.0f);
|
||||
GL11.glTranslated(-0.45D, 0.0D, 0.0D);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.CastingBlock;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.items.casting.CastingPart;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingBlock;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/21/17.
|
||||
*/
|
||||
public class TileCastingBlockRender extends TileEntitySpecialRenderer <TileCastingBlock> {
|
||||
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileCastingBlock tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof CastingBlock) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.25D, z + 0.5);
|
||||
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
GL11.glScaled(0.99D, 0.99D, 0.99D);
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) {
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
Item item = tile.getSlotStack(0).getItem();
|
||||
|
||||
if (item instanceof CastingPart) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) {
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
Item item = tile.getSlotStack(0).getItem();
|
||||
if (item instanceof CastingPart) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(90.0D, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) {
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
Item item = tile.getSlotStack(0).getItem();
|
||||
if (item instanceof CastingPart) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(90.0D, 1.0D, 0.0D, 0.0D);
|
||||
GL11.glRotated(90.0D, 0.0D, 0.0D, 1.0D);
|
||||
//GL11.glRotated(180.0D, 0.0D, 1.0D, 0.0D);
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) {
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
Item item = tile.getSlotStack(0).getItem();
|
||||
if (item instanceof CastingPart) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(90.0D, 1.0D, 0.0D, 0.0D);
|
||||
GL11.glRotated(-90.0D, 0.0D, 0.0D, 1.0D);
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(0), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.CastingForm;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/21/17.
|
||||
*/
|
||||
public class TileCastingformRender extends TileEntitySpecialRenderer <TileCastingForm> {
|
||||
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileCastingForm tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof CastingForm) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x+2/16D, y+0.25D, z+2/16D);
|
||||
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
/*
|
||||
NORTH
|
||||
SLOT | X | Y
|
||||
0 | 3/16 | 3/16
|
||||
1 | 5/16 | 3/16
|
||||
2 | 7/16 | 3/16
|
||||
3 | 9/16 | 3/16
|
||||
4 | 11/16 | 3/16
|
||||
--------------------
|
||||
5 | 3/16 | 5/16
|
||||
6 | 5/16 | 5/16
|
||||
7 | 7/16 | 5/16
|
||||
8 | 9/16 | 5/16
|
||||
9 | 11/16 | 5/16
|
||||
--------------------
|
||||
10 | 3/16 | 8/16
|
||||
11 | 5/16 | 8/16
|
||||
12 | 7/16 | 8/16
|
||||
13 | 9/16 | 8/16
|
||||
14 | 11/16 | 8/16
|
||||
--------------------
|
||||
15 | 3/16 | 11/16
|
||||
16 | 5/16 | 11/16
|
||||
17 | 7/16 | 11/16
|
||||
18 | 9/16 | 11/16
|
||||
19 | 11/16 | 11/16
|
||||
--------------------
|
||||
20 | 3/16 | 14/16
|
||||
21 | 5/16 | 14/16
|
||||
22 | 7/16 | 14/16
|
||||
23 | 9/16 | 14/16
|
||||
24 | 11/16 | 14/16
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) {
|
||||
int counter = 0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int a = 0; a < 5; a++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(ModItems.castingmud)) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getNormalX(a), 0.0D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) {
|
||||
int counter = 0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int a = 0; a < 5; a++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(ModItems.castingmud)) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getReverseX(a), 0.0D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) {
|
||||
int counter = 0;
|
||||
for (int a = 0; a < 5; a++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(ModItems.castingmud)) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getNormalX(a), 0.0D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) {
|
||||
int counter = 0;
|
||||
for (int a = 0; a < 5; a++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
if (item.equals(ModItems.castingmud)) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(tile.getReverseX(a), 0.0D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.Forge;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 12/4/2016.
|
||||
*/
|
||||
public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
|
||||
{
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileForge tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof Forge) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y + 0.95D, z + 0.5D);
|
||||
//GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
ItemStack stack1 = tile.getSlotStack(0);
|
||||
|
||||
boolean is_block = stack1.getItem() instanceof ItemBlock;
|
||||
float scale = is_block ? 0.1725F : 0.3F;
|
||||
double xTrans = is_block ? -1.6D : -0.45D;
|
||||
double yTrans = is_block ? -1.26D : 0.75D;
|
||||
|
||||
if (!stack1.isEmpty()) {
|
||||
int stackRotation = stack1.getCount();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
||||
GL11.glPopMatrix();
|
||||
for (int i = 0; i < Math.ceil(stackRotation / 8) + 1; i++) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glRotated(45.0F * i, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslated(xTrans, yTrans, 0.0D);
|
||||
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
if (!tile.getSlotStack(i).isEmpty()) {
|
||||
GL11.glPushMatrix();
|
||||
float tempScale = 0.8F;
|
||||
GL11.glScalef(tempScale, tempScale, tempScale);
|
||||
GL11.glTranslated(0.0F, 0.1D, 0.0F);
|
||||
if (i == 2) {
|
||||
GL11.glTranslated(-0.3, -0.05D, -0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
if (i == 3) {
|
||||
GL11.glTranslated(-0.3, -0.05D, 0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
if (i == 4) {
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
//GL11.glScalef(0.6F, 0.6F, 0.6F);
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.pickaxehead) {
|
||||
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.ironaxehead) {
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.ironshovelhead) {
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.ironhoehead) {
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslated(0.0, 0.025D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
if (i == 5) {
|
||||
GL11.glTranslated(0.3, -0.05D, -0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
if (i == 6) {
|
||||
GL11.glTranslated(0.3, -0.05D, 0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
renderItem.renderItem(tile.getSlotStack(i), ItemCameraTransforms.TransformType.FIXED);
|
||||
//renderItem.renderItem(tile.getSlotStack(i), renderItem.getItemModelMesher().getItemModel(tile.getSlotStack(i)));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package nmd.primal.forgecraft.renders.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.forgecraft.blocks.PistonBellows;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TilePistonBellows;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/7/17.
|
||||
*/
|
||||
public class TilePistonBellowsRender extends TileEntitySpecialRenderer<TilePistonBellows> {
|
||||
|
||||
private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TilePistonBellows tile, double x, double y, double z, float partialTicks, int destroyStage)
|
||||
{
|
||||
|
||||
BlockPos pos = tile.getPos();
|
||||
IBlockState state = this.getWorld().getBlockState(pos);
|
||||
if (state.getBlock() instanceof PistonBellows) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
float prevLGTX = OpenGlHelper.lastBrightnessX;
|
||||
float prevLGTY = OpenGlHelper.lastBrightnessY;
|
||||
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
|
||||
|
||||
GL11.glRotated(0, 0.0F, 1.0F, 0.0F);
|
||||
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
|
||||
//System.out.println(tile.getAnimation());
|
||||
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
|
||||
}
|
||||
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
|
||||
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
|
||||
}
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) {
|
||||
//GL11.glPushMatrix();
|
||||
GL11.glRotated(180, 0.0F, 1.0F, 0.0F);
|
||||
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
|
||||
//System.out.println(tile.getAnimation());
|
||||
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
|
||||
}
|
||||
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
|
||||
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
|
||||
//GL11.glPopMatrix();
|
||||
}
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) {
|
||||
//GL11.glPushMatrix();
|
||||
GL11.glRotated(270, 0.0F, 1.0F, 0.0F);
|
||||
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
|
||||
//System.out.println(tile.getAnimation());
|
||||
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
|
||||
}
|
||||
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
|
||||
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
|
||||
//GL11.glPopMatrix();
|
||||
}
|
||||
if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) {
|
||||
//GL11.glPushMatrix();
|
||||
GL11.glRotated(90, 0.0F, 1.0F, 0.0F);
|
||||
if (state.getValue(PrimalStates.ACTIVE) == Boolean.TRUE) {
|
||||
//System.out.println(tile.getAnimation());
|
||||
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation() / 25);
|
||||
}
|
||||
ItemStack stackToRender = new ItemStack(ModItems.bellowshandle, 1);
|
||||
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
|
||||
//GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package nmd.primal.forgecraft.renders.items;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.IModelCustomData;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/8/17.
|
||||
*/
|
||||
public class ModelPickaxe implements IModel, IModelCustomData {
|
||||
|
||||
public static final IModel MODEL = new ModelPickaxe();
|
||||
//private final ResourceLocation resourceHead;
|
||||
//private final ResourceLocation resourceHandle;
|
||||
|
||||
@Override
|
||||
public IModel process(ImmutableMap<String, String> customData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getTextures() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getDefaultState() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
76
kfc/src/main/java/nmd/primal/forgecraft/tiles/BaseTile.java
Normal file
76
kfc/src/main/java/nmd/primal/forgecraft/tiles/BaseTile.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 12/3/2016.
|
||||
*/
|
||||
public abstract class BaseTile extends TileEntity {
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
|
||||
{
|
||||
return oldState.getBlock() != newSate.getBlock();
|
||||
}
|
||||
|
||||
public void updateBlock()
|
||||
{
|
||||
// might be good
|
||||
//this.markDirty();
|
||||
|
||||
World world = this.getWorld();
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
world.notifyBlockUpdate(this.pos, state, state, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
this.readNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt = super.writeToNBT(nbt);
|
||||
return this.writeNBT(nbt);
|
||||
}
|
||||
|
||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||
{
|
||||
// Override in lower tile classes
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
// Override in lower tile classes
|
||||
return nbt;
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Packets
|
||||
// ***************************************************************************** //
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag()
|
||||
{
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||
return new SPacketUpdateTileEntity(this.pos, 0, this.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
this.readNBT(packet.getNbtCompound());
|
||||
}
|
||||
}
|
||||
82
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java
Normal file
82
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/4/17.
|
||||
*/
|
||||
public class TileAnvil extends TileBaseSlot implements ITickable {
|
||||
|
||||
double[] normalX = {0.125,0.3125,0.5,0.6875,0.875};
|
||||
|
||||
public double getNormalX(Integer x) {
|
||||
return normalX[x];
|
||||
}
|
||||
|
||||
double[] normalZ = {0.125,0.3125,0.5,0.6875,0.875};
|
||||
|
||||
public double getNormalZ(Integer z) {
|
||||
return normalZ[z];
|
||||
}
|
||||
|
||||
double[] reverseX = {0.875,0.6875,0.5,0.3125,0.125};
|
||||
|
||||
public double getReverseX(Integer x) {
|
||||
return reverseX[x];
|
||||
}
|
||||
|
||||
double[] reverseZ = {0.875,0.6875,0.5,0.3125,0.125};
|
||||
|
||||
public double getReverseZ(Integer z) {
|
||||
return reverseZ[z];
|
||||
}
|
||||
|
||||
|
||||
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
World world = this.getWorld();
|
||||
if (!world.isRemote) {
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
|
||||
if ( ThreadLocalRandom.current().nextInt(0,10000) == 0 ) {
|
||||
for(int i=0; i<this.getSlotListSize(); i++){
|
||||
if(this.getSlotStack(i).getItem() == ModItems.ironchunkhot){
|
||||
if(ThreadLocalRandom.current().nextInt(0,1000) == 1){
|
||||
this.setSlotStack(i, new ItemStack(ModBlocks.ironchunk, 1));
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(i).getItem() == ModItems.ironingotballhot){
|
||||
if(ThreadLocalRandom.current().nextInt(0,1000) == 2){
|
||||
this.setSlotStack(i, new ItemStack(ModBlocks.ironball, 1));
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(i).getItem() instanceof ToolPart){
|
||||
if(ThreadLocalRandom.current().nextInt(0,1000) == 3){
|
||||
((ToolPart) this.getSlotStack(i).getItem()).setHot(this.getSlotStack(i), false);
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/4/17.
|
||||
*/
|
||||
public class TileBaseCrucible extends BaseTile implements ITickable {
|
||||
|
||||
private int iteration = 0;
|
||||
public int countdown = 0;
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
if (!world.isRemote) {
|
||||
World world = this.getWorld();
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
iteration++;
|
||||
//System.out.println(iteration);
|
||||
if(iteration == 100 ){
|
||||
iteration = 0;
|
||||
countdown += 100;
|
||||
//System.out.println(countdown);
|
||||
BloomeryCrafting recipe = BloomeryCrafting.getRecipeFromOutput(new ItemStack(state.getBlock(), 1));
|
||||
if(recipe != null){
|
||||
if (countdown > recipe.getCooldown()){
|
||||
world.setBlockState(this.pos, Block.getBlockFromItem(recipe.getCoolOutput().getItem()).getDefaultState(), 3);
|
||||
countdown = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
109
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileBaseSlot.java
Normal file
109
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileBaseSlot.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.inventory.ItemStackHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 12/25/16.
|
||||
*/
|
||||
public abstract class TileBaseSlot extends BaseTile {
|
||||
|
||||
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
|
||||
|
||||
// ***************************************************************************** //
|
||||
// Controls
|
||||
// ***************************************************************************** //
|
||||
|
||||
// ***************************************************************************** //
|
||||
// get
|
||||
//
|
||||
public NonNullList<ItemStack> getSlotList()
|
||||
{
|
||||
return this.slotList;
|
||||
}
|
||||
|
||||
public ItemStack getSlotStack(int i)
|
||||
{
|
||||
return this.slotList.get(i);
|
||||
}
|
||||
|
||||
public int getSlotListSize()
|
||||
{
|
||||
return slotList.size();
|
||||
}
|
||||
|
||||
public int getSlotLimit()
|
||||
{
|
||||
//return ((ShelfBasic)this.getBlockType()).getShelfSize();
|
||||
//return 1;
|
||||
return 64;
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int index, int count)
|
||||
{
|
||||
return ItemStackHelper.getAndSplit(this.getSlotList(), index, count);
|
||||
}
|
||||
|
||||
public ItemStack incrementStackSize(List<ItemStack> stacks, int index, int count) {
|
||||
Integer tempCount = ((ItemStack)stacks.get(index)).getCount();
|
||||
ItemStack tempStack = ((ItemStack)stacks.get(index));
|
||||
if(tempCount + count > 64) {
|
||||
tempStack.setCount(64);
|
||||
}
|
||||
if(tempCount + count <= 64) {
|
||||
tempStack.setCount(tempCount + count);
|
||||
}
|
||||
|
||||
return tempStack;
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// set
|
||||
//
|
||||
public void setSlotStack(int index, ItemStack stack)
|
||||
{
|
||||
this.slotList.set(index, stack);
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
}
|
||||
|
||||
public void clearSlots()
|
||||
{
|
||||
this.slotList.clear();
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
}
|
||||
|
||||
public void clearSlot(int index) {
|
||||
this.slotList.set(index, ItemStack.EMPTY);
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// NBT
|
||||
// ***************************************************************************** //
|
||||
@Override
|
||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||
{
|
||||
//super.readNBT(nbt);
|
||||
this.slotList = NonNullList.<ItemStack>withSize(this.getSlotListSize(), ItemStack.EMPTY);
|
||||
ItemStackHelper.loadAllItems(nbt, this.slotList);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
//super.writeNBT(nbt);
|
||||
ItemStackHelper.saveAllItems(nbt, this.slotList);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
}
|
||||
262
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileBloomery.java
Normal file
262
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileBloomery.java
Normal file
@@ -0,0 +1,262 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.core.common.helper.CommonUtils;
|
||||
import nmd.primal.forgecraft.blocks.BloomeryBase;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
|
||||
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
|
||||
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
||||
import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/22/17.
|
||||
*/
|
||||
public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
|
||||
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(3, ItemStack.EMPTY);
|
||||
private int iteration = 0;
|
||||
private int heat;
|
||||
private int cookCounter;
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
World world = this.getWorld();
|
||||
if(!world.isRemote){
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true) {
|
||||
if (this.getHeat() < 100) {
|
||||
this.setHeat(100);
|
||||
}
|
||||
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 (this.getSlotStack(0) == ItemStack.EMPTY) {
|
||||
world.setBlockState(this.getPos(), state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
this.markDirty();
|
||||
world.notifyBlockUpdate(pos, state, state, 2);
|
||||
}
|
||||
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
||||
|
||||
}
|
||||
slotZeroManager(world);
|
||||
slotOneManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void slotOneManager(){
|
||||
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(this.getSlotStack(1));
|
||||
if(recipe != null){
|
||||
//System.out.println(recipe.getIdealTime() + " : " + recipe.getHeatThreshold());
|
||||
//System.out.println(this.cookCounter + " : " + this.getHeat());
|
||||
//System.out.println("====================");
|
||||
if(this.getHeat() >= recipe.getHeatThreshold()){
|
||||
cookCounter++;
|
||||
}
|
||||
if(cookCounter >= recipe.getIdealTime() ){
|
||||
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
|
||||
this.setSlotStack(1, recipe.getOutput());
|
||||
//this.cookCounter = 0;
|
||||
//System.out.print(" :Success: " + this.getSlotStack(1));
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
if(cookCounter > recipe.getIdealTime() + (recipe.getIdealTime() * recipe.getTimeVariance())){
|
||||
if(this.getSlotStack(1).getItem() == recipe.getOutput().getItem()) {
|
||||
this.setSlotStack(1, recipe.getOutputFailed());
|
||||
this.cookCounter = 0;
|
||||
//System.out.print(" :Failure Time: " + this.getSlotStack(1));
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
if(this.getHeat() > recipe.getHeatThreshold() + (recipe.getHeatThreshold() * recipe.getHeatVariance())){
|
||||
if(this.getSlotStack(1).getItem() == recipe.getInput().getItem()) {
|
||||
this.setSlotStack(1, recipe.getOutputFailed());
|
||||
this.cookCounter = 0;
|
||||
//System.out.print(" :Failure Heat: " + this.getSlotStack(1));
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
if (this.getSlotStack(1).isEmpty()){
|
||||
this.cookCounter=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void slotZeroManager(World world){
|
||||
if(this.getSlotStack(0) != ItemStack.EMPTY) {
|
||||
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 5);
|
||||
if(decrInt == 0) {
|
||||
decrInt = 1;
|
||||
}
|
||||
Integer size = this.getSlotStack(0).getCount();
|
||||
Integer burnModifier = 0;
|
||||
if(size / 16 <= 1){
|
||||
burnModifier = 1;
|
||||
}
|
||||
if(size / 16 > 1 && size / 16 <= 2){
|
||||
burnModifier = 2;
|
||||
}
|
||||
if(size / 16 > 2 && size / 16 <= 3){
|
||||
burnModifier = 3;
|
||||
}
|
||||
if(size / 16 > 3 && size / 16 <= 4){
|
||||
burnModifier = 4;
|
||||
}
|
||||
if (world.rand.nextInt(decrInt) == 0) {
|
||||
if (world.rand.nextInt(burnModifier) == 0) {
|
||||
System.out.println("Fuel Burn" + this.getSlotStack(0));
|
||||
this.decrStackSize(0, 1);
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
}
|
||||
}
|
||||
if (this.getSlotStack(0).getCount() == 1){
|
||||
this.decrStackSize(0, 1);
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
}
|
||||
if(CommonUtils.randomCheck(1000)) {
|
||||
makeSmoke(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getHeat(){
|
||||
return this.heat;
|
||||
}
|
||||
|
||||
public void setHeat(int newHeat){
|
||||
this.heat = newHeat;
|
||||
}
|
||||
|
||||
public int getCookCounter() {return this.cookCounter; }
|
||||
|
||||
@Override
|
||||
public int getSlotLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
if(!stack.isEmpty()) {
|
||||
if(h > 0) {
|
||||
this.setHeat(h - 25);
|
||||
}
|
||||
if(h < 10 ){
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
}
|
||||
}
|
||||
if(stack.isEmpty()){
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_FAIR){
|
||||
if(this.getHeat() > 1610){
|
||||
this.setHeat(1600);
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == Items.COAL && this.getSlotStack(0).getMetadata() == 1){
|
||||
if(this.getHeat() > 1210){
|
||||
this.setHeat(1200);
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_GOOD){
|
||||
if(this.getHeat() > 2110){
|
||||
this.setHeat(2100);
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_HIGH){
|
||||
if(this.getHeat() > 3510){
|
||||
this.setHeat(3500);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(state.getValue(PrimalStates.ACTIVE) == false){
|
||||
if(h > 50){
|
||||
this.setHeat(h - 50);
|
||||
}
|
||||
if(h < 0){
|
||||
this.setHeat(0);
|
||||
}
|
||||
}
|
||||
if(world.getBlockState(pos).getBlock() instanceof BloomeryBase){
|
||||
BloomeryBase tempBlock = (BloomeryBase) world.getBlockState(pos).getBlock();
|
||||
if(this.getHeat() > tempBlock.getMaxHeat()){
|
||||
world.setBlockState(pos, Blocks.FIRE.getDefaultState(), 2);
|
||||
//world.markTileEntityForRemoval(this);
|
||||
}
|
||||
}
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public ItemStack removeStackFromSlot(int index) {
|
||||
ItemStack stack = this.getSlotStack(index);
|
||||
this.setSlotStack(index, ItemStack.EMPTY);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
if(index == 0){
|
||||
if(stack.getItem() == Items.COAL){
|
||||
if(stack.getMetadata() == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(stack.getItem() == PrimalItems.CHARCOAL_GOOD
|
||||
|| stack.getItem() == PrimalItems.CHARCOAL_HIGH
|
||||
|| stack.getItem() == PrimalItems.CHARCOAL_FAIR){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(index == 1){
|
||||
if (stack.getItem() == ModItems.softcrucible) {
|
||||
return true;
|
||||
}
|
||||
if(Block.getBlockFromItem(stack.getItem()) instanceof Crucible ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// NBT
|
||||
// ***************************************************************************** //
|
||||
@Override
|
||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readNBT(nbt);
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.cookCounter = nbt.getInteger("cook");
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setInteger("heat", this.heat);
|
||||
nbt.setInteger("cook", this.cookCounter);
|
||||
super.writeNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 4/9/17.
|
||||
*/
|
||||
public class TileBreaker extends TileBaseSlot {
|
||||
|
||||
private float charge = 0.0f;
|
||||
|
||||
public float getCharge() {
|
||||
return charge;
|
||||
}
|
||||
|
||||
public void setCharge(float a) {
|
||||
this.charge = a;
|
||||
this.updateBlock();
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
|
||||
@Override
|
||||
public int getSlotLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// NBT
|
||||
// ***************************************************************************** //
|
||||
@Override
|
||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readNBT(nbt);
|
||||
this.charge = nbt.getFloat("charge");
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setFloat("charge", this.charge);
|
||||
super.writeNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/24/17.
|
||||
*/
|
||||
public class TileCastingBlock extends TileBaseSlot {
|
||||
|
||||
|
||||
@Override
|
||||
public int getSlotLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/19/17.
|
||||
*/
|
||||
public class TileCastingForm extends TileBaseSlot {
|
||||
|
||||
double[] normalX = {2/16D, 4/16D, 6/16D, 8/16D, 10/16D};
|
||||
|
||||
public double getNormalX(Integer x) {
|
||||
return normalX[x];
|
||||
}
|
||||
|
||||
double[] normalZ = {2/16D, 4/16D, 6/16D, 8/16D, 10/16D};
|
||||
|
||||
public double getNormalZ(Integer z) {
|
||||
return normalZ[z];
|
||||
}
|
||||
|
||||
double[] reverseX = {10/16D, 8/16D, 6/16D, 4/16D, 2/16D};
|
||||
|
||||
public double getReverseX(Integer x) {
|
||||
return reverseX[x];
|
||||
}
|
||||
|
||||
double[] reverseZ = {10/16D, 8/16D, 6/16D, 4/16D, 2/16D};
|
||||
|
||||
public double getReverseZ(Integer z) {
|
||||
return reverseZ[z];
|
||||
}
|
||||
|
||||
|
||||
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
|
||||
|
||||
}
|
||||
304
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java
Normal file
304
kfc/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java
Normal file
@@ -0,0 +1,304 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.core.api.PrimalStates;
|
||||
import nmd.primal.core.common.helper.CommonUtils;
|
||||
import nmd.primal.forgecraft.blocks.Forge;
|
||||
import nmd.primal.forgecraft.crafting.ForgeCrafting;
|
||||
|
||||
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
||||
import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 11/30/16.
|
||||
*/
|
||||
public class TileForge extends TileBaseSlot implements ITickable {
|
||||
|
||||
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(7, ItemStack.EMPTY);
|
||||
//private ItemStack[] inventory = new ItemStack [0];
|
||||
//private String customName;
|
||||
private int iteration = 0;
|
||||
private int heat;
|
||||
private int cookCounter2, cookCounter3, cookCounter4, cookCounter5, cookCounter6;
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
if(!world.isRemote) {
|
||||
World world = this.getWorld();
|
||||
this.iteration++;
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
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 (world.getBlockState(this.getPos()).getValue(PrimalStates.ACTIVE)) {
|
||||
if (this.iteration == 300) {
|
||||
this.iteration = 0;
|
||||
|
||||
|
||||
if (this.getSlotStack(0) == ItemStack.EMPTY) {
|
||||
world.setBlockState(this.getPos(), state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
this.markDirty();
|
||||
world.notifyBlockUpdate(pos, state, state, 2);
|
||||
}
|
||||
|
||||
this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos);
|
||||
}
|
||||
|
||||
slotZeroManager(world);
|
||||
craftingManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void slotZeroManager(World world){
|
||||
if(this.getSlotStack(0) != ItemStack.EMPTY) {
|
||||
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 5);
|
||||
if(decrInt == 0) {
|
||||
decrInt = 1;
|
||||
}
|
||||
Integer size = this.getSlotStack(0).getCount();
|
||||
Integer burnModifier = 0;
|
||||
if(size / 16 <= 1){
|
||||
burnModifier = 1;
|
||||
}
|
||||
if(size / 16 > 1 && size / 16 <= 2){
|
||||
burnModifier = 2;
|
||||
}
|
||||
if(size / 16 > 2 && size / 16 <= 3){
|
||||
burnModifier = 3;
|
||||
}
|
||||
if(size / 16 > 3 && size / 16 <= 4){
|
||||
burnModifier = 4;
|
||||
}
|
||||
if (world.rand.nextInt(decrInt) == 0) {
|
||||
if (world.rand.nextInt(burnModifier) == 0) {
|
||||
System.out.println("Fuel Burn" + this.getSlotStack(0));
|
||||
this.decrStackSize(0, 1);
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
}
|
||||
}
|
||||
if (this.getSlotStack(0).getCount() == 1){
|
||||
this.decrStackSize(0, 1);
|
||||
this.markDirty();
|
||||
this.updateBlock();
|
||||
}
|
||||
if(CommonUtils.randomCheck(1000)) {
|
||||
makeSmoke(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){
|
||||
if(state.getValue(PrimalStates.ACTIVE) == true){
|
||||
if(!stack.isEmpty()) {
|
||||
if(h > 0) {
|
||||
this.setHeat(h - 25);
|
||||
}
|
||||
if(h < 10 ){
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
}
|
||||
}
|
||||
if(stack.isEmpty()){
|
||||
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, false), 2);
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_FAIR){
|
||||
if(this.getHeat() > 1610){
|
||||
this.setHeat(1600);
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == Items.COAL && this.getSlotStack(0).getMetadata() == 1){
|
||||
if(this.getHeat() > 1210){
|
||||
this.setHeat(1200);
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_GOOD){
|
||||
if(this.getHeat() > 2110){
|
||||
this.setHeat(2100);
|
||||
}
|
||||
}
|
||||
if(this.getSlotStack(0).getItem() == PrimalItems.CHARCOAL_HIGH){
|
||||
if(this.getHeat() > 3510){
|
||||
this.setHeat(3500);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(state.getValue(PrimalStates.ACTIVE) == false){
|
||||
if(h > 50){
|
||||
this.setHeat(h - 50);
|
||||
}
|
||||
if(h < 0){
|
||||
this.setHeat(0);
|
||||
}
|
||||
}
|
||||
if(world.getBlockState(pos).getBlock() instanceof Forge){
|
||||
Forge tempBlock = (Forge) world.getBlockState(pos).getBlock();
|
||||
if(this.getHeat() > tempBlock.getMaxHeat()){
|
||||
world.setBlockState(pos, Blocks.FIRE.getDefaultState(), 2);
|
||||
//world.markTileEntityForRemoval(this);
|
||||
}
|
||||
}
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
|
||||
private void craftingManager() {
|
||||
|
||||
for (int i = 2; i < this.getSlotListSize(); i++) {
|
||||
Item itemTest = this.getSlotStack(i).getItem();
|
||||
ForgeCrafting recipe = ForgeCrafting.getRecipe(itemTest);
|
||||
if (recipe != null) {
|
||||
|
||||
if(i == 2){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter2++;
|
||||
}
|
||||
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter2 > 0) {
|
||||
cookCounter2--;
|
||||
}
|
||||
if (cookCounter2 >= recipe.getIdealTime()) {
|
||||
if(this.getSlotStack(i).hasTagCompound()){
|
||||
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
|
||||
} else this.setSlotStack(i, recipe.getOutput());
|
||||
cookCounter2 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 3){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter3++;
|
||||
}
|
||||
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter3 > 0) {
|
||||
cookCounter3--;
|
||||
}
|
||||
if (cookCounter3 >= recipe.getIdealTime()) {
|
||||
if(this.getSlotStack(i).hasTagCompound()){
|
||||
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
|
||||
} else this.setSlotStack(i, recipe.getOutput());
|
||||
cookCounter3 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 4){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter4++;
|
||||
}
|
||||
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter4 > 0) {
|
||||
cookCounter4--;
|
||||
}
|
||||
if (cookCounter4 >= recipe.getIdealTime()) {
|
||||
if(this.getSlotStack(i).hasTagCompound()){
|
||||
if( this.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == false) {
|
||||
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
|
||||
//System.out.println(this.getSlotStack(i).getSubCompound("tags"));
|
||||
//System.out.println("its hot now");
|
||||
cookCounter4 = 0;
|
||||
}
|
||||
} else this.setSlotStack(i, recipe.getOutput());
|
||||
cookCounter4 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 5){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter5++;
|
||||
}
|
||||
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter5 > 0) {
|
||||
cookCounter5--;
|
||||
}
|
||||
if (cookCounter5 >= recipe.getIdealTime()) {
|
||||
if(this.getSlotStack(i).hasTagCompound()){
|
||||
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
|
||||
} else this.setSlotStack(i, recipe.getOutput());
|
||||
cookCounter5 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 6){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter6++;
|
||||
}
|
||||
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter6 > 0) {
|
||||
cookCounter6--;
|
||||
}
|
||||
if (cookCounter6 >= recipe.getIdealTime()) {
|
||||
if(this.getSlotStack(i).hasTagCompound()){
|
||||
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
|
||||
} else this.setSlotStack(i, recipe.getOutput());
|
||||
cookCounter6 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
System.out.println(state.getValue(IngotBall.ACTIVE) + " : " + recipe.getStartState());
|
||||
System.out.println(cookCounter + " : " + recipe.getIdealTime());
|
||||
System.out.println(this.heat + " : " + recipe.getHeatThreshold());
|
||||
System.out.println("========");
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getHeat(){
|
||||
return this.heat;
|
||||
}
|
||||
|
||||
public void setHeat(int newHeat){
|
||||
this.heat = newHeat;
|
||||
}
|
||||
@Override
|
||||
public int getSlotLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public ItemStack removeStackFromSlot(int index) {
|
||||
ItemStack stack = this.getSlotStack(index);
|
||||
this.setSlotStack(index, ItemStack.EMPTY);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
if(index == 0){
|
||||
if(stack.getItem() == Items.COAL){
|
||||
if(stack.getMetadata() == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(stack.getItem() == PrimalItems.CHARCOAL_GOOD
|
||||
|| stack.getItem() == PrimalItems.CHARCOAL_HIGH
|
||||
|| stack.getItem() == PrimalItems.CHARCOAL_FAIR){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************** //
|
||||
// NBT
|
||||
// ***************************************************************************** //
|
||||
@Override
|
||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readNBT(nbt);
|
||||
this.heat = nbt.getInteger("heat");
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setInteger("heat", this.heat);
|
||||
super.writeNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package nmd.primal.forgecraft.tiles;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import static nmd.primal.core.api.PrimalStates.ACTIVE;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/5/17.
|
||||
*/
|
||||
|
||||
|
||||
public class TilePistonBellows extends BaseTile implements ITickable{
|
||||
|
||||
private int iteration = 0;
|
||||
private int animateIteration = 0;
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
if (!world.isRemote) {
|
||||
World world = this.getWorld();
|
||||
IBlockState state = world.getBlockState(this.pos);
|
||||
if (world.getBlockState(this.getPos()).getValue(ACTIVE)) {
|
||||
iteration++;
|
||||
if(iteration <= 15){
|
||||
animateIteration++;
|
||||
//
|
||||
}
|
||||
if(iteration > 15){
|
||||
animateIteration = 15 - (iteration - 15);
|
||||
if(animateIteration < 0){
|
||||
animateIteration = 0;
|
||||
}
|
||||
//
|
||||
}
|
||||
if(iteration > 31){
|
||||
iteration = 0;
|
||||
animateIteration = 0;
|
||||
world.setBlockState(this.getPos(), state.withProperty(ACTIVE, false), 3);
|
||||
}
|
||||
|
||||
//System.out.println("Iterating");
|
||||
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getIteration(){
|
||||
return this.iteration;
|
||||
}
|
||||
public int getAnimation(){
|
||||
return this.animateIteration;
|
||||
}
|
||||
|
||||
|
||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readNBT(nbt);
|
||||
this.iteration = nbt.getInteger("iteration");
|
||||
this.animateIteration = nbt.getInteger("animate");
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setInteger("iteration", this.iteration);
|
||||
nbt.setInteger("animate", this.animateIteration);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
}
|
||||
829
kfc/src/main/java/nmd/primal/forgecraft/util/AnvilHandler.java
Normal file
829
kfc/src/main/java/nmd/primal/forgecraft/util/AnvilHandler.java
Normal file
@@ -0,0 +1,829 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.core.common.items.tools.WorkMallet;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.blocks.IngotBall;
|
||||
import nmd.primal.forgecraft.crafting.AnvilCrafting;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.items.ForgeHammer;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static nmd.primal.forgecraft.blocks.CustomContainerFacing.FACING;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/10/17.
|
||||
*/
|
||||
public interface AnvilHandler {
|
||||
|
||||
double[] normalMin = {0.0625, 0.25, 0.4375, 0.625, 0.8125};
|
||||
|
||||
default double getNormalMin(Integer x) {
|
||||
return normalMin[x];
|
||||
}
|
||||
|
||||
double[] normalMax = {0.1875, 0.375, 0.5625, 0.75, 0.9375};
|
||||
|
||||
default double getNormalMax(Integer x) {
|
||||
return normalMax[x];
|
||||
}
|
||||
|
||||
double[] reverseMin = {0.8125, 0.625, 0.4375, 0.25, 0.0625};
|
||||
|
||||
default double getReverseMin(Integer x) {
|
||||
return reverseMin[x];
|
||||
}
|
||||
|
||||
double[] reverseMax = {0.9375, 0.75, 0.5625, 0.375, 0.1875};
|
||||
|
||||
default double getReverseMax(Integer x) {
|
||||
return reverseMax[x];
|
||||
}
|
||||
|
||||
default boolean doAnvilRecipe(ItemStack pItem, String[] tempArray, World world, TileAnvil tile, BlockPos pos, EntityPlayer player) {
|
||||
AnvilCrafting recipe = AnvilCrafting.getRecipe(tempArray);
|
||||
if (recipe != null) {
|
||||
if (pItem.getItem() instanceof WorkMallet) {
|
||||
pItem.damageItem(15, player);
|
||||
}
|
||||
if (pItem.getItem() instanceof ForgeHammer) {
|
||||
pItem.damageItem(1, player);
|
||||
}
|
||||
world.playEvent(1031, pos, 0);
|
||||
|
||||
|
||||
if (ThreadLocalRandom.current().nextInt(0, 2)==0) {
|
||||
|
||||
if (recipe.getOutput().getItem() instanceof ToolPart) {
|
||||
|
||||
if (!tile.getSlotStack(12).getItem().equals(recipe.getOutput().getItem())) {
|
||||
ItemStack tempStack = recipe.getOutput();
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = new NBTTagCompound();
|
||||
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
tempStack.getSubCompound("tags").setBoolean("emerald", false);
|
||||
tempStack.getSubCompound("tags").setInteger("diamond", 0);
|
||||
tempStack.getSubCompound("tags").setInteger("redstone", 0);
|
||||
tempStack.getSubCompound("tags").setInteger("lapis", 0);
|
||||
|
||||
tempStack.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tempStack);
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(12).getItem().equals(recipe.getOutput().getItem())) {
|
||||
|
||||
NBTTagCompound tempNBT = tile.getSlotStack(12).getSubCompound("tags");
|
||||
ItemStack outputStack = recipe.getOutput();
|
||||
outputStack.setTagCompound(new NBTTagCompound());
|
||||
outputStack.getTagCompound().setTag("tags", tempNBT);
|
||||
outputStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
|
||||
if (recipe.getUpgrade() == "repair") {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
|
||||
}
|
||||
|
||||
if (outputStack.getSubCompound("tags").getInteger("modifiers") < 3) {
|
||||
|
||||
//Upgrade emerald
|
||||
if (recipe.getUpgrade() == "emerald") {
|
||||
if (outputStack.getSubCompound("tags").getInteger("lapis") == 0) {
|
||||
if (outputStack.getSubCompound("tags").getBoolean("emerald") == false) {
|
||||
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
|
||||
outputStack.getSubCompound("tags").setInteger("emerald",
|
||||
(outputStack.getSubCompound("tags").getInteger("emerald") + 1));
|
||||
outputStack.getSubCompound("tags").setInteger("modifiers",
|
||||
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Upgrade diamond
|
||||
if (recipe.getUpgrade() == "diamond") {
|
||||
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
|
||||
outputStack.getSubCompound("tags").setInteger("diamond",
|
||||
(outputStack.getSubCompound("tags").getInteger("diamond") + 1));
|
||||
outputStack.getSubCompound("tags").setInteger("modifiers",
|
||||
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
|
||||
}
|
||||
|
||||
//Upgrade redstone
|
||||
if (recipe.getUpgrade() == "redstone") {
|
||||
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
|
||||
outputStack.getSubCompound("tags").setInteger("redstone",
|
||||
(outputStack.getSubCompound("tags").getInteger("redstone") + 1));
|
||||
outputStack.getSubCompound("tags").setInteger("modifiers",
|
||||
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
|
||||
}
|
||||
|
||||
//Upgrade lapis
|
||||
if (recipe.getUpgrade() == "lapis") {
|
||||
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
|
||||
if (outputStack.getSubCompound("tags").getBoolean("emerald") == false) {
|
||||
outputStack.getSubCompound("tags").setInteger("lapis",
|
||||
(outputStack.getSubCompound("tags").getInteger("lapis") + 1));
|
||||
outputStack.getSubCompound("tags").setInteger("modifiers",
|
||||
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, recipe.getOutput());
|
||||
}
|
||||
//world.playEvent(1031, pos, 0);
|
||||
for (int i = 0; i < tile.getSlotListSize(); i++) {
|
||||
if (!tile.getSlotStack(i).isEmpty()) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
Adding and Removing Inventory With Tongs
|
||||
*****************************************************************************/
|
||||
|
||||
default boolean doAnvilInventoryManager(ItemStack pItem, World world, TileAnvil tile, BlockPos pos, float hitx, float hity, float hitz, IBlockState state, EntityPlayer player) {
|
||||
if ( (!(pItem.getItem() instanceof WorkMallet)) || (!(pItem.getItem() instanceof ForgeHammer)) ) {
|
||||
if(Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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)) {
|
||||
AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
|
||||
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)) {
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
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)) {
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
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)) {
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) {
|
||||
if (pItem.getItem().equals(ModItems.stonetongs)) {
|
||||
if ((pItem.getTagCompound().getInteger("type") == 6) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 7) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 8) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 9) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 10) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 11) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 15) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 16) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 17) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 18) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 19) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 20) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 24) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 25) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 26) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 27) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 28) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 29) ||
|
||||
(pItem.getTagCompound().getInteger("type") == 0)) {
|
||||
//System.out.println("Level 1");
|
||||
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
if (pItem.getTagCompound().getInteger("type") == 0) {
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) {
|
||||
pItem.getTagCompound().setInteger("type", 6);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) {
|
||||
pItem.getTagCompound().setInteger("type", 7);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironcleaningotballhot)) {
|
||||
pItem.getTagCompound().setInteger("type", 15);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironcleanchunkhot)) {
|
||||
pItem.getTagCompound().setInteger("type", 16);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.steelingotballhot)) {
|
||||
pItem.getTagCompound().setInteger("type", 24);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.steelchunkhot)) {
|
||||
pItem.getTagCompound().setInteger("type", 25);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(counter).getItem() instanceof ToolPart){
|
||||
ToolPart item = (ToolPart) tile.getSlotStack(counter).getItem();
|
||||
if(item.getHot(tile.getSlotStack(counter))) {
|
||||
switch (item.getID()) {
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 20:
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 29:
|
||||
case 35:
|
||||
case 36:
|
||||
case 37:
|
||||
case 38:
|
||||
pItem.getTagCompound().setInteger("type", item.getID());
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
//System.out.println("Activating");
|
||||
if (pItem.getTagCompound().getInteger("type") == 6) {
|
||||
//System.out.println("Tongs meta = 6");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 7) {
|
||||
//System.out.println("Tongs meta = 7");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
///System.out.println(counter);
|
||||
//System.out.println(tile.getSlotStack(counter));
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 8) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.pickaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 9) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.ironaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 10) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.ironshovelhead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 11) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.ironhoehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* Clean Iron *
|
||||
*********************************/
|
||||
if (pItem.getTagCompound().getInteger("type") == 15) {
|
||||
//System.out.println("Tongs meta = 6");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.ironcleaningotballhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 16) {
|
||||
//System.out.println("Tongs meta = 7");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.ironcleanchunkhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
///System.out.println(counter);
|
||||
//System.out.println(tile.getSlotStack(counter));
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 17) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.cleanironpickaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 18) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.cleanironaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 19) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.cleanironshovelhead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 20) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.cleanironhoehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* Steel *
|
||||
*********************************/
|
||||
if (pItem.getTagCompound().getInteger("type") == 24) {
|
||||
//System.out.println("Tongs meta = 6");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.steelingotballhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 25) {
|
||||
//System.out.println("Tongs meta = 7");
|
||||
tile.setSlotStack((counter), new ItemStack(ModItems.steelchunkhot, 1));
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
///System.out.println(counter);
|
||||
//System.out.println(tile.getSlotStack(counter));
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 26) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.steelpickaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 27) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.steelaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 28) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.steelshovelhead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 29) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.steelhoehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tags = pItem.getSubCompound("tags").copy();
|
||||
tempStack.getTagCompound().setTag("tags", tags);
|
||||
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
|
||||
tile.setSlotStack((counter), tempStack);
|
||||
|
||||
pItem.getTagCompound().setInteger("type", 0);
|
||||
pItem.getSubCompound("tags").setBoolean("hot", false);
|
||||
pItem.getSubCompound("tags").setBoolean("emerald", false);
|
||||
pItem.getSubCompound("tags").setInteger("diamond", 0);
|
||||
pItem.getSubCompound("tags").setInteger("redstone", 0);
|
||||
pItem.getSubCompound("tags").setInteger("lapis", 0);
|
||||
pItem.getSubCompound("tags").setInteger("modifiers", 0);
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(Items.AIR) && player.isSneaking()) {
|
||||
|
||||
if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(Items.EMERALD)) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP)) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(Items.REDSTONE)) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tile.getSlotStack(counter).getItem().equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Block.getBlockFromItem(tile.getSlotStack(counter).getItem()) instanceof IngotBall ) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
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));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironaxehead)) {
|
||||
if (tile.getSlotStack(counter).getSubCompound("tags").getBoolean("hot") == false) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironshovelhead)) {
|
||||
if (tile.getSlotStack(counter).getSubCompound("tags").getBoolean("hot") == false) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironhoehead)) {
|
||||
if (tile.getSlotStack(counter).getSubCompound("tags").getBoolean("hot") == false) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(Items.DIAMOND)) {
|
||||
//System.out.println("It Is Diamond");
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
//System.out.println("Slot is empty");
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(Items.EMERALD)) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(PrimalItems.EMERALD_KNAPP)) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(PrimalItems.DIAMOND_KNAPP)) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(Items.REDSTONE)) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem().equals(Items.DYE) && pItem.getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void doDrops(World world, BlockPos pos) {
|
||||
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) {
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
for (ItemStack stack : tile.getSlotList()) {
|
||||
if (stack != null) {
|
||||
float offset = 0.7F;
|
||||
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
|
||||
ItemStack dropStack = null;
|
||||
if (stack.getItem() instanceof BaseMultiItem) {
|
||||
BaseMultiItem item = (BaseMultiItem) stack.getItem();
|
||||
|
||||
switch (item.getID()) {
|
||||
case 6:
|
||||
dropStack = new ItemStack(ModBlocks.ironball, 1);
|
||||
break;
|
||||
case 7:
|
||||
dropStack = new ItemStack(ModBlocks.ironchunk, 1);
|
||||
break;
|
||||
case 8:
|
||||
dropStack = new ItemStack(ModItems.pickaxehead, 1);
|
||||
break;
|
||||
case 9:
|
||||
dropStack = new ItemStack(ModItems.ironaxehead, 1);
|
||||
break;
|
||||
case 10:
|
||||
dropStack = new ItemStack(ModItems.ironshovelhead, 1);
|
||||
break;
|
||||
case 11:
|
||||
dropStack = new ItemStack(ModItems.ironhoehead, 1);
|
||||
break;
|
||||
case 15:
|
||||
dropStack = new ItemStack(ModBlocks.ironcleanball, 1);
|
||||
break;
|
||||
case 16:
|
||||
dropStack = new ItemStack(ModBlocks.ironcleanchunk, 1);
|
||||
break;
|
||||
case 17:
|
||||
dropStack = new ItemStack(ModItems.cleanironpickaxehead, 1);
|
||||
break;
|
||||
case 18:
|
||||
dropStack = new ItemStack(ModItems.cleanironaxehead, 1);
|
||||
break;
|
||||
case 19:
|
||||
dropStack = new ItemStack(ModItems.cleanironshovelhead, 1);
|
||||
break;
|
||||
case 20:
|
||||
dropStack = new ItemStack(ModItems.cleanironhoehead, 1);
|
||||
break;
|
||||
case 24:
|
||||
dropStack = new ItemStack(ModBlocks.steelball, 1);
|
||||
break;
|
||||
case 25:
|
||||
dropStack = new ItemStack(ModBlocks.steelchunk, 1);
|
||||
break;
|
||||
case 26:
|
||||
dropStack = new ItemStack(ModItems.steelpickaxehead, 1);
|
||||
break;
|
||||
case 27:
|
||||
dropStack = new ItemStack(ModItems.steelaxehead, 1);
|
||||
break;
|
||||
case 28:
|
||||
dropStack = new ItemStack(ModItems.steelshovelhead, 1);
|
||||
break;
|
||||
case 29:
|
||||
dropStack = new ItemStack(ModItems.steelhoehead, 1);
|
||||
break;
|
||||
case 33:
|
||||
dropStack = new ItemStack(ModBlocks.wootzball, 1);
|
||||
break;
|
||||
case 34:
|
||||
dropStack = new ItemStack(ModBlocks.wootzchunk, 1);
|
||||
break;
|
||||
case 35:
|
||||
dropStack = new ItemStack(ModItems.wootzpickaxehead, 1);
|
||||
break;
|
||||
case 36:
|
||||
dropStack = new ItemStack(ModItems.wootzaxehead, 1);
|
||||
break;
|
||||
case 37:
|
||||
dropStack = new ItemStack(ModItems.wootzshovelhead, 1);
|
||||
break;
|
||||
case 38:
|
||||
dropStack = new ItemStack(ModItems.wootzhoehead, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
dropStack = stack;
|
||||
}
|
||||
if(dropStack.hasTagCompound()){
|
||||
if(dropStack.getItem() instanceof ToolPart){
|
||||
dropStack.getSubCompound("tags").setBoolean("hot", false);
|
||||
}
|
||||
}
|
||||
EntityItem itemDrop = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, dropStack);
|
||||
itemDrop.setDefaultPickupDelay();
|
||||
world.spawnEntity(itemDrop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
106
kfc/src/main/java/nmd/primal/forgecraft/util/BreakerHandler.java
Normal file
106
kfc/src/main/java/nmd/primal/forgecraft/util/BreakerHandler.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import nmd.primal.core.api.PrimalItems;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.tiles.TileBreaker;
|
||||
|
||||
import static nmd.primal.core.common.helper.CommonUtils.randomCheck;
|
||||
|
||||
//import nmd.primal.forgecraft.CommonUtils;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 6/11/17.
|
||||
*/
|
||||
public interface BreakerHandler {
|
||||
|
||||
default boolean hasOreName(ItemStack itemStack, String oreName)
|
||||
{
|
||||
int[] oreIds = OreDictionary.getOreIDs(itemStack);
|
||||
for(int oreId : oreIds)
|
||||
{
|
||||
String oreNameEntry = OreDictionary.getOreName(oreId);
|
||||
if(oreName.equals(oreNameEntry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
int checkid = OreDictionary.getOreID(oreDictName);
|
||||
for (int id:OreDictionary.getOreIDs(stack))
|
||||
if(id == checkid) return true;
|
||||
return false;
|
||||
*/
|
||||
|
||||
// somewhere else
|
||||
//if(hasOreName(new ItemStack(Blocks.LOG), "logWood"))
|
||||
// item is logWood
|
||||
|
||||
default void doBreaking(World world, IBlockState state, BlockPos pos, TileBreaker tile){
|
||||
for (EnumFacing face : EnumFacing.values()) {
|
||||
if(world.getBlockState(pos).getValue(CustomContainerFacing.FACING) == face) {
|
||||
if (tile.getCharge() > getThreshold(world, pos.offset(face))) {
|
||||
Block smashBlock = world.getBlockState(pos.offset(face)).getBlock();
|
||||
ItemStack smashStack = new ItemStack(smashBlock, 1);
|
||||
System.out.println(smashStack.getItem());
|
||||
if (hasOreName(smashStack, "oreIron")) {
|
||||
world.setBlockToAir(pos.offset(face));
|
||||
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
|
||||
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
|
||||
}
|
||||
if (hasOreName(smashStack, "oreCopper")) {
|
||||
world.setBlockToAir(pos.offset(face));
|
||||
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.COPPER_DUST, randomChanceReturn(9, 1, 2)));
|
||||
|
||||
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
|
||||
}
|
||||
if (hasOreName(smashStack, "oreTin")) {
|
||||
world.setBlockToAir(pos.offset(face));
|
||||
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.TIN_DUST, randomChanceReturn(9, 1, 2)));
|
||||
|
||||
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
|
||||
}
|
||||
if (hasOreName(smashStack, "oreZinc")) {
|
||||
world.setBlockToAir(pos.offset(face));
|
||||
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.ZINC_DUST, randomChanceReturn(9, 1, 2)));
|
||||
|
||||
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
|
||||
}
|
||||
if (hasOreName(smashStack, "oreGold")) {
|
||||
world.setBlockToAir(pos.offset(face));
|
||||
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.GOLD_DUST, randomChanceReturn(9, 1, 2)));
|
||||
|
||||
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
|
||||
}
|
||||
} else {
|
||||
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 10);
|
||||
}
|
||||
}
|
||||
tile.setCharge(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
default float getThreshold(World world, BlockPos pos){
|
||||
float threshold = world.getBlockState(pos).getBlockHardness(world, pos) * (world.getBlockState(pos).getBlock().getExplosionResistance(null)*5);
|
||||
if(threshold > 179){
|
||||
threshold = 178;
|
||||
}
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public static int randomChanceReturn(int bound, int output1, int output2)
|
||||
{
|
||||
return randomCheck(bound) ? output2 : output1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
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.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.crafting.CastingformCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
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)) {
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if (pItem.getItem() != ModItems.castingmud) {
|
||||
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
|
||||
ItemStack dropStack = new ItemStack(ModItems.castingmud, 1);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem() == ModItems.castingmud) {
|
||||
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
|
||||
ItemStack castStack = new ItemStack(ModItems.castingmud, 1);
|
||||
pItem.shrink(1);
|
||||
tile.setSlotStack(counter, castStack);
|
||||
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)) {
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if (pItem.getItem() != ModItems.castingmud) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.castingmud, 1);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem() == ModItems.castingmud) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack castStack = new ItemStack(ModItems.castingmud, 1);
|
||||
pItem.shrink(1);
|
||||
tile.setSlotStack(counter, castStack);
|
||||
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)) {
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if (pItem.getItem() != ModItems.castingmud) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.castingmud, 1);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem() == ModItems.castingmud) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack castStack = new ItemStack(ModItems.castingmud, 1);
|
||||
pItem.shrink(1);
|
||||
tile.setSlotStack(counter, castStack);
|
||||
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)) {
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if (pItem.getItem() != ModItems.castingmud) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack dropStack = new ItemStack(ModItems.castingmud, 1);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem() == ModItems.castingmud) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack castStack = new ItemStack(ModItems.castingmud, 1);
|
||||
pItem.shrink(1);
|
||||
tile.setSlotStack(counter, castStack);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
default void doCraftingformCrafting(String[] tempArray, World world, TileCastingForm tile, BlockPos pos){
|
||||
CastingformCrafting recipe = CastingformCrafting.getRecipe(tempArray);
|
||||
if (recipe != null) {
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, recipe.getOutput());
|
||||
}
|
||||
//world.playEvent(1031, pos, 0);
|
||||
for (int i = 0; i < tile.getSlotListSize(); i++) {
|
||||
if (!tile.getSlotStack(i).isEmpty()) {
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/19/17.
|
||||
*/
|
||||
|
||||
|
||||
public interface IMetaLookup<T extends Enum> {
|
||||
public String getID();
|
||||
public T getByOrdinal(int i);
|
||||
|
||||
public String getVariantName();
|
||||
public int getOrdinal();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/29/17.
|
||||
*/
|
||||
public interface ToolMaterials {
|
||||
|
||||
|
||||
|
||||
}
|
||||
108
kfc/src/main/java/nmd/primal/forgecraft/util/ToolNBT.java
Normal file
108
kfc/src/main/java/nmd/primal/forgecraft/util/ToolNBT.java
Normal file
@@ -0,0 +1,108 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 3/17/17.
|
||||
*/
|
||||
public interface ToolNBT {
|
||||
|
||||
default boolean getHot(ItemStack stack){
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags").getBoolean("hot");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default void setHot(ItemStack stack, Boolean bool){
|
||||
stack.getSubCompound("tags").setBoolean("hot", bool);
|
||||
}
|
||||
|
||||
default int getModifiers(ItemStack stack) {
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags").getInteger("modifiers");
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default void setModifiers(ItemStack stack, Integer mods){
|
||||
stack.getSubCompound("tags").setInteger("modifiers", mods);
|
||||
}
|
||||
|
||||
default boolean getEmerald(ItemStack stack){
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags").getBoolean("emerald");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default void setEmerald(ItemStack stack, Boolean bool){
|
||||
stack.getSubCompound("tags").setBoolean("emerald", bool);
|
||||
}
|
||||
|
||||
default int getDiamondLevel(ItemStack stack) {
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags").getInteger("diamond");
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
default void setDiamondLevel(ItemStack stack, Integer level){
|
||||
stack.getSubCompound("tags").setInteger("diamond", level);
|
||||
}
|
||||
|
||||
|
||||
default int getRedstoneLevel(ItemStack stack) {
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags").getInteger("redstone");
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default void setRedstoneLevel(ItemStack stack, Integer level){
|
||||
stack.getSubCompound("tags").setInteger("redstone", level);
|
||||
}
|
||||
|
||||
default int getLapisLevel(ItemStack stack) {
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags").getInteger("lapis");
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default void setLapisLevel(ItemStack stack, Integer level){
|
||||
stack.getSubCompound("tags").setInteger("lapis", level);
|
||||
}
|
||||
|
||||
default NBTTagCompound getTags(ItemStack stack){
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("tags");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"joints": {
|
||||
"head": { "0": [ 1.0 ], "1": [ 1.0 ], "2": [ 1.0 ], "3": [ 1.0 ] }
|
||||
},
|
||||
"clips": {
|
||||
"default": {
|
||||
"loop": false,
|
||||
"joint_clips": {},
|
||||
"events": {}
|
||||
},
|
||||
"moving": {
|
||||
"loop": false,
|
||||
"joint_clips": {
|
||||
"head": [{
|
||||
"variable": "offset_z",
|
||||
"type": "uniform",
|
||||
"interpolation": "linear",
|
||||
"samples": [ 0, 0.5, 0 ]
|
||||
}]
|
||||
},
|
||||
"events": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"parameters": {},
|
||||
"clips": {
|
||||
"default": "forgecraft:block/pump_head@default",
|
||||
"moving": [ "apply", "forgecraft:block/pump_head@moving", "#move" ]
|
||||
},
|
||||
"states": [ "default", "moving" ],
|
||||
"transitions": {
|
||||
"default": "moving",
|
||||
"moving": "default"
|
||||
},
|
||||
"start_state": "default"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"variants": {
|
||||
"active=false,facing=north": { "model": "forgecraft:blockbreaker" },
|
||||
"active=false,facing=east": { "model": "forgecraft:blockbreaker", "y": 90 },
|
||||
"active=false,facing=south": { "model": "forgecraft:blockbreaker", "y": 180 },
|
||||
"active=false,facing=west": { "model": "forgecraft:blockbreaker", "y": 270 },
|
||||
"active=true,facing=north": { "model": "forgecraft:blockbreakeractive" },
|
||||
"active=true,facing=east": { "model": "forgecraft:blockbreakeractive", "y": 90 },
|
||||
"active=true,facing=south": { "model": "forgecraft:blockbreakeractive", "y": 180 },
|
||||
"active=true,facing=west": { "model": "forgecraft:blockbreakeractive", "y": 270 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"variants": {
|
||||
"active=false,facing=north": { "model": "forgecraft:bloomery_adobe" },
|
||||
"active=false,facing=east": { "model": "forgecraft:bloomery_adobe", "y": 90 },
|
||||
"active=false,facing=south": { "model": "forgecraft:bloomery_adobe", "y": 180 },
|
||||
"active=false,facing=west": { "model": "forgecraft:bloomery_adobe", "y": 270 },
|
||||
"active=true,facing=north": { "model": "forgecraft:bloomery_adobe_lit" },
|
||||
"active=true,facing=east": { "model": "forgecraft:bloomery_adobe_lit", "y": 90 },
|
||||
"active=true,facing=south": { "model": "forgecraft:bloomery_adobe_lit", "y": 180 },
|
||||
"active=true,facing=west": { "model": "forgecraft:bloomery_adobe_lit", "y": 270 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"variants": {
|
||||
"active=false,facing=north": { "model": "forgecraft:bloomery_brick" },
|
||||
"active=false,facing=east": { "model": "forgecraft:bloomery_brick", "y": 90 },
|
||||
"active=false,facing=south": { "model": "forgecraft:bloomery_brick", "y": 180 },
|
||||
"active=false,facing=west": { "model": "forgecraft:bloomery_brick", "y": 270 },
|
||||
"active=true,facing=north": { "model": "forgecraft:bloomery_brick_lit" },
|
||||
"active=true,facing=east": { "model": "forgecraft:bloomery_brick_lit", "y": 90 },
|
||||
"active=true,facing=south": { "model": "forgecraft:bloomery_brick_lit", "y": 180 },
|
||||
"active=true,facing=west": { "model": "forgecraft:bloomery_brick_lit", "y": 270 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": {
|
||||
"model": "forgecraft:castingblock"
|
||||
},
|
||||
"facing=east": {
|
||||
"model": "forgecraft:castingblock",
|
||||
"y": 90
|
||||
},
|
||||
"facing=south": {
|
||||
"model": "forgecraft:castingblock",
|
||||
"y": 180
|
||||
},
|
||||
"facing=west": {
|
||||
"model": "forgecraft:castingblock",
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": {
|
||||
"model": "forgecraft:castingform"
|
||||
},
|
||||
"facing=east": {
|
||||
"model": "forgecraft:castingform",
|
||||
"y": 90
|
||||
},
|
||||
"facing=south": {
|
||||
"model": "forgecraft:castingform",
|
||||
"y": 180
|
||||
},
|
||||
"facing=west": {
|
||||
"model": "forgecraft:castingform",
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"forge_marker":1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"particle": "forgecraft:blocks/stone_slab",
|
||||
"texture": "forgecraft:blocks/stone_slab"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"normal": { "model": "forgecraft:crucibleshut" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"forge_marker":1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"particle": "forgecraft:blocks/stone_slab",
|
||||
"texture": "forgecraft:blocks/stone_slab"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"normal": { "model": "forgecraft:crucibleshut" }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user