New Repo
This commit is contained in:
49
src/main/java/com/kitsu/medievalcraft/ClientProxy.java
Normal file
49
src/main/java/com/kitsu/medievalcraft/ClientProxy.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.kitsu.medievalcraft;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.entity.EntityModelArrow;
|
||||
import com.kitsu.medievalcraft.entity.EntityShit;
|
||||
import com.kitsu.medievalcraft.entity.EntityTester;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.renderer.RendererRegistry;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.RenderModelArrow;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void registerRenderer() {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityShit.class, new RenderSnowball(ModItems.itemShit));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityTester.class, new RenderSnowball(ModItems.itemTester));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityModelArrow.class, new RenderModelArrow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemRenderers() {
|
||||
|
||||
RenderId.init();
|
||||
RendererRegistry.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSounds() {
|
||||
//MinecraftForge.EVENT_BUS.register(new ModSounds());//register the sound event handling class
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getClient() {
|
||||
return FMLClientHandler.instance().getClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getClientWorld() {
|
||||
return FMLClientHandler.instance().getClient().theWorld;
|
||||
}
|
||||
|
||||
}
|
||||
47
src/main/java/com/kitsu/medievalcraft/CommonProxy.java
Normal file
47
src/main/java/com/kitsu/medievalcraft/CommonProxy.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.kitsu.medievalcraft;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void registerRenderer() {
|
||||
|
||||
}
|
||||
|
||||
public void registerItemRenderers() {
|
||||
|
||||
}
|
||||
|
||||
public void registerSounds() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Object getClient() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public World getClientWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
//ModItems.init();
|
||||
//ModBlocks.init();
|
||||
//ModCrafting.init();
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent e) {
|
||||
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
137
src/main/java/com/kitsu/medievalcraft/Main.java
Normal file
137
src/main/java/com/kitsu/medievalcraft/Main.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.kitsu.medievalcraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.compat.FuelHandler;
|
||||
import com.kitsu.medievalcraft.compat.ModDict;
|
||||
import com.kitsu.medievalcraft.crafting.CraftingHandle;
|
||||
import com.kitsu.medievalcraft.crafting.ModCrafting;
|
||||
import com.kitsu.medievalcraft.entity.EntityModelArrow;
|
||||
import com.kitsu.medievalcraft.entity.EntityShit;
|
||||
import com.kitsu.medievalcraft.entity.EntityTester;
|
||||
import com.kitsu.medievalcraft.events.BucketHandle;
|
||||
import com.kitsu.medievalcraft.events.EventHandle;
|
||||
import com.kitsu.medievalcraft.gui.GuiHandler;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgHandleCuredLeatherX;
|
||||
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgHandleCuredLeatherY;
|
||||
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgHandleCuredLeatherZ;
|
||||
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherX;
|
||||
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherY;
|
||||
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherZ;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandle;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocY;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocZ;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandlelTicks;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacket;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocY;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocZ;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketlTicks;
|
||||
import com.kitsu.medievalcraft.packethandle.sandFilterRender.MsgHandleSandFilterRender;
|
||||
import com.kitsu.medievalcraft.packethandle.sandFilterRender.MsgPacketSandFilterRender;
|
||||
import com.kitsu.medievalcraft.packethandle.shelf.MsgHandleShelfCase;
|
||||
import com.kitsu.medievalcraft.packethandle.shelf.MsgPacketShelfCase;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntRegister;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION)
|
||||
public class Main {
|
||||
|
||||
public static final String MODID = "kitsumedievalcraft";
|
||||
public static final String MODNAME = "ForgeCraft";
|
||||
public static final String VERSION = "2.2.0";
|
||||
|
||||
public static SimpleNetworkWrapper sNet;
|
||||
|
||||
@Instance
|
||||
public static Main instance = new Main();
|
||||
|
||||
@SidedProxy(clientSide="com.kitsu.medievalcraft.ClientProxy", serverSide="com.kitsu.medievalcraft.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
/**
|
||||
* Run before anything else. Read your config, create blocks, items, etc, and
|
||||
* register them with the GameRegistry.
|
||||
*/
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
this.proxy.preInit(e);
|
||||
|
||||
sNet = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
|
||||
sNet.registerMessage(MsgHandle.class, MsgPacket.class, 1, Side.CLIENT);
|
||||
sNet.registerMessage(MsgHandlelTicks.class, MsgPacketlTicks.class, 2, Side.CLIENT);
|
||||
sNet.registerMessage(MsgHandleLocY.class, MsgPacketLocY.class, 3, Side.CLIENT);
|
||||
sNet.registerMessage(MsgHandleLocZ.class, MsgPacketLocZ.class, 4, Side.CLIENT);
|
||||
sNet.registerMessage(MsgHandleSandFilterRender.class, MsgPacketSandFilterRender.class, 5, Side.CLIENT);
|
||||
sNet.registerMessage(MsgHandleCuredLeatherX.class, MsgPacketCuredLeatherX.class, 6, Side.SERVER);
|
||||
sNet.registerMessage(MsgHandleCuredLeatherY.class, MsgPacketCuredLeatherY.class, 7, Side.SERVER);
|
||||
sNet.registerMessage(MsgHandleCuredLeatherZ.class, MsgPacketCuredLeatherZ.class, 8, Side.SERVER);
|
||||
sNet.registerMessage(MsgHandleShelfCase.class, MsgPacketShelfCase.class, 9, Side.SERVER);
|
||||
CustomTab.MedievalTab();
|
||||
ModBlocks.init();
|
||||
ModItems.init();
|
||||
ModCrafting.init();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Do your mod setup. Build whatever data structures you care about. Register recipes.
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
|
||||
this.proxy.init(e);
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new CraftingHandle());
|
||||
FMLCommonHandler.instance().bus().register(new EventHandle());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(BucketHandle.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandle());
|
||||
MinecraftForge.EVENT_BUS.register(new CraftingHandle());
|
||||
|
||||
BucketHandle.INSTANCE.buckets.put(ModBlocks.blockFilteredWater, ModItems.filteredBucket);
|
||||
BucketHandle.INSTANCE.buckets.put(ModBlocks.blockTannin, ModItems.tanninBucket);
|
||||
BucketHandle.INSTANCE.buckets.put(ModBlocks.blockSlackedLime, ModItems.slackBucket);
|
||||
|
||||
EntityRegistry.registerModEntity(EntityShit.class, "itemShit", 1, this, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityModelArrow.class, "itemModelArrow", 2, this, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityTester.class, "itemTester", 3, this, 64, 10, true);
|
||||
|
||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
||||
|
||||
TileEntRegister.init();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle interaction with other mods, complete your setup based on this.
|
||||
*/
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
this.proxy.postInit(e);
|
||||
this.proxy.registerRenderer();
|
||||
this.proxy.registerItemRenderers();
|
||||
this.proxy.registerSounds();
|
||||
ModDict.RegisterOres();
|
||||
System.out.println("U want some Body Massage?");
|
||||
//RenderingRegistry.registerEntityRenderingHandler(EntityShit.class, new RenderSnowball(ModItems.itemShit));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
245
src/main/java/com/kitsu/medievalcraft/block/ModBlocks.java
Normal file
245
src/main/java/com/kitsu/medievalcraft/block/ModBlocks.java
Normal file
@@ -0,0 +1,245 @@
|
||||
package com.kitsu.medievalcraft.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleIronIngot;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleIronOre;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleLapis;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleRedstone;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleWootz;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.BoilingWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.EmptyCookedCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.EmptySoftCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.FilledWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.SlackWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.TanWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.decorative.EggWashedBrick;
|
||||
import com.kitsu.medievalcraft.block.decorative.EggWashedWall;
|
||||
import com.kitsu.medievalcraft.block.decorative.LimestoneRaw;
|
||||
import com.kitsu.medievalcraft.block.fluid.BlockFilteredWater;
|
||||
import com.kitsu.medievalcraft.block.fluid.BlockSlackedLime;
|
||||
import com.kitsu.medievalcraft.block.fluid.BlockSmoke;
|
||||
import com.kitsu.medievalcraft.block.fluid.BlockTannin;
|
||||
import com.kitsu.medievalcraft.block.ingots.DamascusIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.IronPlate;
|
||||
import com.kitsu.medievalcraft.block.ingots.LapisIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.RedstoneIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.RefinedIron;
|
||||
import com.kitsu.medievalcraft.block.machines.Firebox;
|
||||
import com.kitsu.medievalcraft.block.machines.ForgeAnvil;
|
||||
import com.kitsu.medievalcraft.block.machines.SolidFilter;
|
||||
import com.kitsu.medievalcraft.block.machines.TestForge;
|
||||
import com.kitsu.medievalcraft.block.machines.WaterFilter;
|
||||
import com.kitsu.medievalcraft.block.machines.formTable;
|
||||
import com.kitsu.medievalcraft.block.wood.ShelfFour;
|
||||
import com.kitsu.medievalcraft.block.wood.SmallBarrel;
|
||||
import com.kitsu.medievalcraft.block.wood.SmallBarrelLid;
|
||||
import com.kitsu.medievalcraft.block.wood.clean.CleanAcacia;
|
||||
import com.kitsu.medievalcraft.block.wood.clean.CleanBirch;
|
||||
import com.kitsu.medievalcraft.block.wood.clean.CleanDarkOak;
|
||||
import com.kitsu.medievalcraft.block.wood.clean.CleanJungle;
|
||||
import com.kitsu.medievalcraft.block.wood.clean.CleanOak;
|
||||
import com.kitsu.medievalcraft.block.wood.clean.CleanSpruce;
|
||||
import com.kitsu.medievalcraft.block.wood.quartersplit.AcaciaSplitLog;
|
||||
import com.kitsu.medievalcraft.block.wood.quartersplit.BirchSplitLog;
|
||||
import com.kitsu.medievalcraft.block.wood.quartersplit.DarkSplitLog;
|
||||
import com.kitsu.medievalcraft.block.wood.quartersplit.JungleSplitLog;
|
||||
import com.kitsu.medievalcraft.block.wood.quartersplit.OakSplitLog;
|
||||
import com.kitsu.medievalcraft.block.wood.quartersplit.SpruceSplitLog;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModBlocks {
|
||||
|
||||
|
||||
//NEW INGOTS
|
||||
public static Block refinedIron;
|
||||
public static Block damascus;
|
||||
public static Block ironPlate;
|
||||
public static Block redstoneIngot;
|
||||
public static Block lapisIngot;
|
||||
|
||||
//NEW CRUCIBLES
|
||||
public static Block testBlock;
|
||||
public static Block crucibleIronOre;
|
||||
public static Block crucibleIronIngot;
|
||||
public static Block crucibleWootz;
|
||||
public static Block crucibleLapis;
|
||||
public static Block crucibleRedstone;
|
||||
|
||||
//AESTHETIC
|
||||
public static Block shitblock;
|
||||
public static Block eggWashedWall;
|
||||
public static Block eggWashedBrick;
|
||||
public static Block wootzOre;
|
||||
public static Block limestoneRaw;
|
||||
|
||||
//LIQUIDS
|
||||
public static Block blockSmoke;
|
||||
public static Block blockFilteredWater;
|
||||
public static Fluid fluidFiltered;
|
||||
public static Block blockTannin;
|
||||
public static Fluid fluidTan;
|
||||
public static Block blockSlackedLime;
|
||||
public static Fluid fluidSlackedLime;
|
||||
|
||||
//WOODEN BLOCKS
|
||||
public static Block cleanOak;
|
||||
public static Block cleanAcacia;
|
||||
public static Block cleanJungle;
|
||||
public static Block cleanSpruce;
|
||||
public static Block cleanBirch;
|
||||
public static Block cleanDarkOak;
|
||||
//SPLIT LOGS
|
||||
public static Block acaciaSplitLog;
|
||||
public static Block birchSplitLog;
|
||||
public static Block darkSplitLog;
|
||||
public static Block jungleSplitLog;
|
||||
public static Block oakSplitLog;
|
||||
public static Block spruceSplitLog;
|
||||
public static Block smallBarrelLid;
|
||||
public static Block smallBarrel;
|
||||
|
||||
//MACHINES
|
||||
public static Block formtable;
|
||||
public static Block newForge;
|
||||
public static Block testForge;
|
||||
public static Block forgeAnvil;
|
||||
public static Block waterFilter;
|
||||
public static Block shelfFour;
|
||||
public static Block firebox;
|
||||
public static Block solidFilter;
|
||||
|
||||
//GEMS
|
||||
public static Block myDiamond, myEmerald;
|
||||
//IRON INGOTS
|
||||
//public static Block myIronIngot, hotIronBlock;
|
||||
//IRON PLATES
|
||||
//public static Block ironPlate, hotIronPlate;
|
||||
//DAMASCUS INGOTS
|
||||
//public static Block damascusIngot, hotDamascusIngot;
|
||||
//LAPIS INGOTS
|
||||
//public static Block lapisIngot, hotLapisIngot;
|
||||
//REDSTONE INGOTS
|
||||
//public static Block redstoneIngot, hotRedstoneIngot;
|
||||
|
||||
//Empty Crucible Soft --> Cooked
|
||||
public static Block emptySoftCrucible;
|
||||
public static Block emptyCookedCrucible;
|
||||
public static Block filledWaterCrucible;
|
||||
public static Block boilingWaterCrucible;
|
||||
public static Block tanWaterCrucible;
|
||||
public static Block slackWaterCrucible;
|
||||
|
||||
|
||||
public static final void init() {
|
||||
|
||||
GameRegistry.registerBlock(testBlock = new TestBlock("testBlock", Material.rock), "testBlock");
|
||||
Fluid fluidSmoke = new Fluid("blocksmoke").setDensity(-1000).setTemperature(310).setGaseous(true).setBlock(blockSmoke).setViscosity(1200);
|
||||
FluidRegistry.registerFluid(fluidSmoke);
|
||||
blockSmoke = new BlockSmoke(fluidSmoke, Material.water).setBlockName("blockSmoke");
|
||||
GameRegistry.registerBlock(blockSmoke, Main.MODID + "_" + blockSmoke.getUnlocalizedName().substring(5));
|
||||
fluidSmoke.setUnlocalizedName(blockSmoke.getUnlocalizedName());
|
||||
|
||||
fluidFiltered = new Fluid("blockFilteredWater").setDensity(1000).setTemperature(295).setGaseous(false).setBlock(blockFilteredWater).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(fluidFiltered);
|
||||
blockFilteredWater = new BlockFilteredWater(fluidFiltered, Material.water).setBlockName("blockFilteredWater");
|
||||
GameRegistry.registerBlock(blockFilteredWater, Main.MODID + "_" + blockFilteredWater.getUnlocalizedName().substring(5));
|
||||
fluidFiltered.setUnlocalizedName(blockFilteredWater.getUnlocalizedName());
|
||||
|
||||
fluidTan = new Fluid("blockTannin").setDensity(1000).setTemperature(295).setGaseous(false).setBlock(blockTannin).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(fluidTan);
|
||||
blockTannin = new BlockTannin(fluidTan, Material.water).setBlockName("blockTannin");
|
||||
GameRegistry.registerBlock(blockTannin, Main.MODID + "_" + blockTannin.getUnlocalizedName().substring(5));
|
||||
fluidTan.setUnlocalizedName(blockTannin.getUnlocalizedName());
|
||||
|
||||
fluidSlackedLime = new Fluid("blockSlackedLime").setGaseous(false).setBlock(blockSlackedLime).setViscosity(2000).setDensity(1500).setTemperature(400);
|
||||
FluidRegistry.registerFluid(fluidSlackedLime);
|
||||
blockSlackedLime = new BlockSlackedLime(fluidSlackedLime, Material.water).setBlockName("blockSlackedLime");
|
||||
GameRegistry.registerBlock(blockSlackedLime, Main.MODID + "_" + blockSlackedLime.getUnlocalizedName().substring(5));
|
||||
fluidSlackedLime.setUnlocalizedName(blockSlackedLime.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerBlock(limestoneRaw = new LimestoneRaw("limestoneRaw", Material.rock), "limestoneRaw");
|
||||
GameRegistry.registerBlock(shitblock = new shitBlock("shitBlock", Material.clay), "shitBlock");
|
||||
GameRegistry.registerBlock(eggWashedWall = new EggWashedWall("eggWashedWall", Material.rock), "eggWashedWall");
|
||||
GameRegistry.registerBlock(eggWashedBrick = new EggWashedBrick("eggWashedBrick", Material.rock), "eggWashedBrick");
|
||||
GameRegistry.registerBlock(wootzOre = new WootzOre("wootzOre", Material.rock), "wootzOre");
|
||||
|
||||
GameRegistry.registerBlock(formtable = new formTable("formTable", Material.wood), "formTable");
|
||||
GameRegistry.registerBlock(testForge = new TestForge("TestForge", Material.iron), "TestForge");
|
||||
GameRegistry.registerBlock(forgeAnvil = new ForgeAnvil("forgeAnvil", Material.iron), "forgeAnvil");
|
||||
GameRegistry.registerBlock(waterFilter = new WaterFilter("waterFilter", Material.iron), "waterFilter");
|
||||
//GameRegistry.registerBlock(sandFilter = new SandFilter("sandFilter", Material.wood), "sandFilter");
|
||||
//GameRegistry.registerBlock(sandFilterEmpty = new SandFilterEmpty("sandFilterEmpty", Material.wood), "sandFilterEmpty");
|
||||
GameRegistry.registerBlock(solidFilter = new SolidFilter("solidFilter", Material.wood), "solidFilter");
|
||||
GameRegistry.registerBlock(shelfFour = new ShelfFour("shelfFour", Material.wood), "shelfFour");
|
||||
GameRegistry.registerBlock(firebox = new Firebox("firebox", Material.rock), "firebox");
|
||||
|
||||
|
||||
/*GameRegistry.registerBlock(myIronIngot = new MyIronIngot("myIronIngot", Material.iron), "myIronIngot");
|
||||
GameRegistry.registerBlock(damascusIngot = new DamascusIngot("damascusIngot", Material.iron), "damascusIngot");
|
||||
GameRegistry.registerBlock(hotDamascusIngot = new HotDamascusIngot("hotDamascusIngot", Material.iron), "hotDamascusIngot");
|
||||
GameRegistry.registerBlock(hotIronBlock = new HotIronBlock("hotIronBlock", Material.iron), "hotIronBlock");
|
||||
GameRegistry.registerBlock(ironPlate = new IronPlate("ironPlate", Material.iron), "ironPlate");
|
||||
GameRegistry.registerBlock(hotIronPlate = new HotIronPlate("hotIronPlate", Material.iron), "hotIronPlate");
|
||||
GameRegistry.registerBlock(myDiamond = new Diamond("myDiamond", Material.glass), "myDiamond");
|
||||
GameRegistry.registerBlock(myEmerald = new Emerald("myEmerald", Material.glass), "myEmerald");
|
||||
GameRegistry.registerBlock(redstoneIngot = new RedstoneIngot("redstoneIngot", Material.rock), "redstoneIngot");
|
||||
GameRegistry.registerBlock(hotRedstoneIngot = new HotRedstoneIngot("hotRedstoneIngot", Material.rock), "hotRedstoneIngot");
|
||||
GameRegistry.registerBlock(lapisIngot = new LapisIngot("lapisIngot", Material.rock), "lapisIngot");
|
||||
GameRegistry.registerBlock(hotLapisIngot = new HotLapisIngot("hotLapisIngot", Material.rock), "hotLapisIngot");*/
|
||||
|
||||
//CLEAN WOOD
|
||||
/*
|
||||
public static Block acaciaSplitLog;
|
||||
public static Block birchSplitLog;
|
||||
public static Block darkSplitLog;
|
||||
public static Block jungleSplitLog;
|
||||
public static Block oakSplitLog;
|
||||
public static Block spruceSplitLog;
|
||||
* */
|
||||
GameRegistry.registerBlock(cleanOak = new CleanOak("cleanOak", Material.wood), "cleanOak");
|
||||
GameRegistry.registerBlock(cleanAcacia = new CleanAcacia("cleanAcacia", Material.wood), "cleanAcacia");
|
||||
GameRegistry.registerBlock(cleanJungle = new CleanJungle("cleanJungle", Material.wood), "cleanJungle");
|
||||
GameRegistry.registerBlock(cleanDarkOak = new CleanDarkOak("cleanDarkOak", Material.wood), "cleanDarkOak");
|
||||
GameRegistry.registerBlock(cleanBirch = new CleanBirch("cleanBirch", Material.wood), "cleanBirch");
|
||||
GameRegistry.registerBlock(cleanSpruce = new CleanSpruce("cleanSpruce", Material.wood), "cleanSpruce");
|
||||
|
||||
GameRegistry.registerBlock(acaciaSplitLog = new AcaciaSplitLog("acaciaSplitLog", Material.wood), "acaciaSplitLog");
|
||||
GameRegistry.registerBlock(birchSplitLog = new BirchSplitLog("birchSplitLog", Material.wood), "birchSplitLog");
|
||||
GameRegistry.registerBlock(darkSplitLog = new DarkSplitLog("darkSplitLog", Material.wood), "darkSplitLog");
|
||||
GameRegistry.registerBlock(jungleSplitLog = new JungleSplitLog("jungleSplitLog", Material.wood), "jungleSplitLog");
|
||||
GameRegistry.registerBlock(oakSplitLog = new OakSplitLog("oakSplitLog", Material.wood), "oakSplitLog");
|
||||
GameRegistry.registerBlock(spruceSplitLog = new SpruceSplitLog("spruceSplitLog", Material.wood), "spruceSplitLog");
|
||||
|
||||
GameRegistry.registerBlock(smallBarrelLid = new SmallBarrelLid("smallBarrelLid", Material.wood), "smallBarrelLid");
|
||||
GameRegistry.registerBlock(smallBarrel = new SmallBarrel("smallBarrel", Material.wood), "smallBarrel");
|
||||
|
||||
//Empty Crucible
|
||||
GameRegistry.registerBlock(emptySoftCrucible = new EmptySoftCrucible("emptySoftCrucible", Material.clay), "emptySoftCrucible");
|
||||
GameRegistry.registerBlock(emptyCookedCrucible = new EmptyCookedCrucible("emptyCookedCrucible", Material.rock), "emptyCookedCrucible");
|
||||
GameRegistry.registerBlock(filledWaterCrucible = new FilledWaterCrucible("filledWaterCrucible", Material.rock), "filledWaterCrucible");
|
||||
GameRegistry.registerBlock(boilingWaterCrucible = new BoilingWaterCrucible("boilingWaterCrucible", Material.rock), "boilingWaterCrucible");
|
||||
GameRegistry.registerBlock(tanWaterCrucible = new TanWaterCrucible("tanWaterCrucible", Material.rock), "tanWaterCrucible");
|
||||
GameRegistry.registerBlock(slackWaterCrucible = new SlackWaterCrucible("slackWaterCrucible", Material.rock), "slackWaterCrucible");
|
||||
|
||||
//CRUCIBLE REGISTRY
|
||||
GameRegistry.registerBlock(crucibleIronOre = new CrucibleIronOre(Material.rock, "crucibleIronOre"), "crucibleIronOre");
|
||||
GameRegistry.registerBlock(crucibleIronIngot = new CrucibleIronIngot(Material.rock, "crucibleIronIngot"), "crucibleIronIngot");
|
||||
GameRegistry.registerBlock(crucibleWootz = new CrucibleWootz(Material.rock, "crucibleWootz"), "crucibleWootz");
|
||||
GameRegistry.registerBlock(crucibleLapis = new CrucibleLapis(Material.rock, "crucibleLapis"), "crucibleLapis");
|
||||
GameRegistry.registerBlock(crucibleRedstone = new CrucibleRedstone(Material.rock, "crucibleRedstone"), "crucibleRedstone");
|
||||
|
||||
//INGOT REGISTRY
|
||||
GameRegistry.registerBlock(refinedIron = new RefinedIron("refinedIron", Material.rock), "refinedIron");
|
||||
GameRegistry.registerBlock(damascus = new DamascusIngot("damascus", Material.rock), "damascus");
|
||||
GameRegistry.registerBlock(ironPlate = new IronPlate("ironPlate", Material.iron), "ironPlate");
|
||||
GameRegistry.registerBlock(redstoneIngot = new RedstoneIngot("redstoneIngot", Material.rock), "redstoneIngot");
|
||||
GameRegistry.registerBlock(lapisIngot = new LapisIngot("lapisIngot", Material.rock), "lapisIngot");
|
||||
|
||||
}
|
||||
}
|
||||
61
src/main/java/com/kitsu/medievalcraft/block/TestBlock.java
Normal file
61
src/main/java/com/kitsu/medievalcraft/block/TestBlock.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.kitsu.medievalcraft.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntityTestBlock;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class TestBlock extends BlockContainer {
|
||||
|
||||
public TestBlock (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
//this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
//this.setHardness(1.0F);
|
||||
//this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
//this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
// 0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileCrucibleIronOre();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.testBlockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
53
src/main/java/com/kitsu/medievalcraft/block/WootzOre.java
Normal file
53
src/main/java/com/kitsu/medievalcraft/block/WootzOre.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.kitsu.medievalcraft.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class WootzOre extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public WootzOre(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(6.0F);
|
||||
this.setHarvestLevel("pickaxe", 1, 0);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "wootzOre");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "wootzOre");
|
||||
//top
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "wootzOre");
|
||||
//bot
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "wootzOre");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBot : (side != metadata ? this.blockIcon : this.iconSide));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.kitsu.medievalcraft.block.crucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class CrucibleBase extends BlockContainer {
|
||||
|
||||
protected CrucibleBase(Material mat, String unlocalizedName) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.kitsu.medievalcraft.block.crucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
|
||||
public class CrucibleIronIngot extends CrucibleBase{
|
||||
|
||||
public CrucibleIronIngot(Material mat, String unlocalizedName) {
|
||||
super(mat, unlocalizedName);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileCrucibleIronOre();
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.coolCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
if(!world.isRemote){
|
||||
TileCrucibleIronOre tile = (TileCrucibleIronOre) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile.cooked==false && tile.hot==false){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta){
|
||||
if(!world.isRemote){
|
||||
if(meta == 0){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Items.iron_ingot, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.sand, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Items.coal, 1, 1)));
|
||||
}
|
||||
if(meta == 1){
|
||||
|
||||
}
|
||||
if(meta == 2){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.refinedIron, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.glass, 1, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.kitsu.medievalcraft.block.crucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CrucibleIronOre extends CrucibleBase{
|
||||
|
||||
public CrucibleIronOre(Material mat, String unlocalizedName) {
|
||||
super(mat, unlocalizedName);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileCrucibleIronOre();
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.coolCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
if(!world.isRemote){
|
||||
TileCrucibleIronOre tile = (TileCrucibleIronOre) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile.cooked==false && tile.hot==false){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta){
|
||||
if(!world.isRemote){
|
||||
if(meta == 0){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.iron_ore, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.sand, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Items.coal, 1, 1)));
|
||||
}
|
||||
if(meta == 1){
|
||||
|
||||
}
|
||||
if(meta == 2){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.refinedIron, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.glass, 1, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
if (random.nextInt(7) == 0) {
|
||||
world.spawnParticle("largesmoke", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 1) {
|
||||
world.spawnParticle("cloud", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 2) {
|
||||
world.spawnParticle("largesmoke", x + 0.75D, y + 0.6D, z + 0.6D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 3) {
|
||||
world.spawnParticle("cloud", x + 0.45D, y + 0.6D, z + 0.75D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.kitsu.medievalcraft.block.crucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleLapis;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CrucibleLapis extends CrucibleBase{
|
||||
|
||||
public CrucibleLapis(Material mat, String unlocalizedName) {
|
||||
super(mat, unlocalizedName);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileCrucibleLapis();
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.coolCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
if(!world.isRemote){
|
||||
TileCrucibleLapis tile = (TileCrucibleLapis) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile.cooked==false && tile.hot==false){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta){
|
||||
if(!world.isRemote){
|
||||
if(meta == 0){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.lapis_block, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.sand, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Items.coal, 1, 1)));
|
||||
}
|
||||
if(meta == 1){
|
||||
|
||||
}
|
||||
if(meta == 2){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.refinedIron, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.glass, 1, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
if (random.nextInt(7) == 0) {
|
||||
world.spawnParticle("largesmoke", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 1) {
|
||||
world.spawnParticle("cloud", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 2) {
|
||||
world.spawnParticle("largesmoke", x + 0.75D, y + 0.6D, z + 0.6D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 3) {
|
||||
world.spawnParticle("cloud", x + 0.45D, y + 0.6D, z + 0.75D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.kitsu.medievalcraft.block.crucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleRedstone;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CrucibleRedstone extends CrucibleBase{
|
||||
|
||||
public CrucibleRedstone(Material mat, String unlocalizedName) {
|
||||
super(mat, unlocalizedName);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileCrucibleRedstone();
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.coolCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
if(!world.isRemote){
|
||||
TileCrucibleRedstone tile = (TileCrucibleRedstone) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile.cooked==false && tile.hot==false){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta){
|
||||
if(!world.isRemote){
|
||||
if(meta == 0){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.redstone_block, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.sand, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Items.coal, 1, 1)));
|
||||
}
|
||||
if(meta == 1){
|
||||
|
||||
}
|
||||
if(meta == 2){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
//world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.redstoneIngot, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.glass, 1, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
if (random.nextInt(7) == 0) {
|
||||
world.spawnParticle("largesmoke", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 1) {
|
||||
world.spawnParticle("cloud", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 2) {
|
||||
world.spawnParticle("largesmoke", x + 0.75D, y + 0.6D, z + 0.6D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 3) {
|
||||
world.spawnParticle("cloud", x + 0.45D, y + 0.6D, z + 0.75D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.kitsu.medievalcraft.block.crucible;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleWootz;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CrucibleWootz extends CrucibleBase{
|
||||
|
||||
public CrucibleWootz(Material mat, String unlocalizedName) {
|
||||
super(mat, unlocalizedName);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileCrucibleWootz();
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.coolCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
if(!world.isRemote){
|
||||
TileCrucibleWootz tile = (TileCrucibleWootz) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile.cooked==false && tile.hot==false){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(this);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta){
|
||||
if(!world.isRemote){
|
||||
if(meta == 0){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.wootzOre, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.sand, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Items.coal, 1, 1)));
|
||||
}
|
||||
if(meta == 1){
|
||||
|
||||
}
|
||||
if(meta == 2){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
|
||||
//world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.damascusIngot, 1, 0)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.glass, 1, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
if (random.nextInt(7) == 0) {
|
||||
world.spawnParticle("largesmoke", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 1) {
|
||||
world.spawnParticle("cloud", x + 0.3D, y + 0.6D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 2) {
|
||||
world.spawnParticle("largesmoke", x + 0.75D, y + 0.6D, z + 0.6D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(7) == 3) {
|
||||
world.spawnParticle("cloud", x + 0.45D, y + 0.6D, z + 0.75D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.kitsu.medievalcraft.block.crucible.empty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityBoilingWaterCrucible;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BoilingWaterCrucible extends BlockContainer {
|
||||
|
||||
public BoilingWaterCrucible (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
if(!world.isRemote){
|
||||
TileEntityBoilingWaterCrucible boilingEnt = (TileEntityBoilingWaterCrucible) world.getTileEntity(x, y, z);
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==ModItems.itemBark){
|
||||
if(player.inventory.getStackInSlot(a).stackSize >= 16){
|
||||
if((boilingEnt.dotan==false)&&(boilingEnt.dolime!=true)){
|
||||
player.inventory.decrStackSize(a, 10+world.rand.nextInt(6));
|
||||
boilingEnt.dotan=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a).getItem()==ModItems.limestoneDust){
|
||||
if(player.inventory.getStackInSlot(a).stackSize >= 16){
|
||||
if((boilingEnt.dolime==false)&&(boilingEnt.dotan!=true)){
|
||||
player.inventory.decrStackSize(a, 8+world.rand.nextInt(8));
|
||||
boilingEnt.dolime=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityBoilingWaterCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.filledWaterCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if (random.nextInt(3) == 0) {
|
||||
world.spawnParticle("cloud", (x + 0.5D) + (random.nextGaussian()/25), (y + 0.85D), (z + 0.5D) + (random.nextGaussian()/25), (random.nextGaussian()/100), 0.07D, (random.nextGaussian()/100));
|
||||
//world.spawnParticle("droplet", (x + 0.5D) + (random.nextGaussian()/50), (y + 0.5D), (z + 0.5D) + (random.nextGaussian()/50), 0.0D, 0.1D, 0.0D);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.kitsu.medievalcraft.block.crucible.empty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityEmptyCookedCrucible;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class EmptyCookedCrucible extends BlockContainer {
|
||||
|
||||
public EmptyCookedCrucible (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
//this.setHardness(1.0F);
|
||||
//this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Items.water_bucket){
|
||||
ItemStack bucket = new ItemStack(Items.bucket);
|
||||
player.inventory.setInventorySlotContents(a, bucket);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, ModBlocks.filledWaterCrucible, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(ModBlocks.emptyCookedCrucible)){
|
||||
ItemStack jar = new ItemStack(ModBlocks.emptyCookedCrucible);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(ModBlocks.emptyCookedCrucible);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityEmptyCookedCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.emptyCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.kitsu.medievalcraft.block.crucible.empty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntitySoftEmptyCrucible;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class EmptySoftCrucible extends BlockContainer {
|
||||
|
||||
public EmptySoftCrucible (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
//this.setHardness(1.0F);
|
||||
//this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntitySoftEmptyCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptySoftCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptySoftCrucible);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.emptyCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.kitsu.medievalcraft.block.crucible.empty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityFilledWaterCrucible;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class FilledWaterCrucible extends BlockContainer {
|
||||
|
||||
public FilledWaterCrucible (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
int a = player.inventory.currentItem;
|
||||
//System.out.println(player.inventory.getStackInSlot(a));
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Items.bucket){
|
||||
player.inventory.decrStackSize(a, 1);
|
||||
ItemStack bucket = new ItemStack(Items.water_bucket);
|
||||
int b = player.inventory.getFirstEmptyStack();
|
||||
player.inventory.setInventorySlotContents(b, bucket);
|
||||
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, ModBlocks.emptyCookedCrucible, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityFilledWaterCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.filledWaterCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.kitsu.medievalcraft.block.crucible.empty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntitySlackWaterCrucible;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class SlackWaterCrucible extends BlockContainer {
|
||||
|
||||
public SlackWaterCrucible (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
//this.setHardness(1.0F);
|
||||
//this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Items.bucket){
|
||||
ItemStack slack = new ItemStack(ModItems.slackBucket);
|
||||
player.inventory.consumeInventoryItem(player.inventory.getStackInSlot(a).getItem());
|
||||
int b = player.inventory.getFirstEmptyStack();
|
||||
player.inventory.setInventorySlotContents(b, slack);
|
||||
world.setBlock(x, y, z, ModBlocks.emptyCookedCrucible, 0, 2);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntitySlackWaterCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.filledWaterCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.kitsu.medievalcraft.block.crucible.empty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityTanWaterCrucible;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class TanWaterCrucible extends BlockContainer {
|
||||
|
||||
public TanWaterCrucible (String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
//this.setHardness(1.0F);
|
||||
//this.setResistance(1.0F);
|
||||
//this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.2F, 0.0F, 0.25F,
|
||||
0.8F, 0.66F, 0.8F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Items.bucket){
|
||||
ItemStack tan = new ItemStack(ModItems.tanninBucket, 1);
|
||||
player.inventory.consumeInventoryItem(player.inventory.getStackInSlot(a).getItem());
|
||||
player.inventory.addItemStackToInventory(tan);
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModItems.woodPulp, 2 + world.rand.nextInt(6)));
|
||||
world.setBlock(x, y, z, ModBlocks.emptyCookedCrucible, 0, 2);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityTanWaterCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.emptyCookedCrucible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.filledWaterCrucibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.kitsu.medievalcraft.block.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EggWashedBrick extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public EggWashedBrick(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(6.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "eggwashbrickside");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "eggwashbrickside");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "eggwashbricktop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "eggwashbricktop");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBot : (side != metadata ? this.blockIcon : this.iconSide));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.kitsu.medievalcraft.block.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EggWashedWall extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public EggWashedWall(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(6.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "eggwashside");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "eggwashside");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "eggwashtop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "eggwashtop");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBot : (side != metadata ? this.blockIcon : this.iconSide));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.kitsu.medievalcraft.block.decorative;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LimestoneRaw extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public LimestoneRaw(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(4.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "limestoneRawSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "limestoneRawSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "limestoneRawTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "limestoneRawTop");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBot : (side != metadata ? this.blockIcon : this.iconSide));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.kitsu.medievalcraft.block.fluid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFilteredWater extends BlockFluidClassic {
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon stillIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon flowingIcon;
|
||||
|
||||
public BlockFilteredWater(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setBlockTextureName(Main.MODID + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (side == 0 || side == 1)? stillIcon : flowingIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
stillIcon = register.registerIcon(Main.MODID + ":fluidFilteredStill");
|
||||
flowingIcon = register.registerIcon(Main.MODID + ":fluidFilteredFlowing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.kitsu.medievalcraft.block.fluid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSlackedLime extends BlockFluidClassic {
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon stillIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon flowingIcon;
|
||||
|
||||
public BlockSlackedLime(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setBlockTextureName(Main.MODID + ":" + this.getUnlocalizedName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (side == 0 || side == 1)? stillIcon : flowingIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
stillIcon = register.registerIcon(Main.MODID + ":fluidSlackStill");
|
||||
flowingIcon = register.registerIcon(Main.MODID + ":fluidSlackFlowing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.kitsu.medievalcraft.block.fluid;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidFinite;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSmoke extends BlockFluidFinite{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon stillIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon flowingIcon;
|
||||
|
||||
public BlockSmoke(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setBlockTextureName(Main.MODID + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (side == 0 || side == 1)? stillIcon : flowingIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
stillIcon = register.registerIcon(Main.MODID + ":fluidStill");
|
||||
flowingIcon = register.registerIcon(Main.MODID + ":fluidFlowing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
|
||||
if (random.nextInt(6) == 0) {
|
||||
world.spawnParticle("cloud", x + 0.5D, y + 0.2D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("largesmoke", x + 0.5D, y + 0.2D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(6) == 1) {
|
||||
world.spawnParticle("cloud", x + 0.5D, y + 0.8D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("largesmoke", x + 0.5D, y + 0.8D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(6) == 2) {
|
||||
world.spawnParticle("cloud", x + 0.2D, y + 0.5D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("largesmoke", x + 0.2D, y + 0.5D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(6) == 3) {
|
||||
world.spawnParticle("cloud", x + 0.8D, y + 0.5D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("largesmoke", x + 0.8D, y + 0.5D, z + 0.5D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(6) == 4) {
|
||||
world.spawnParticle("cloud", x + 0.5D, y + 0.5D, z + 0.2D, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("largesmoke", x + 0.5D, y + 0.5D, z + 0.2D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(6) == 5) {
|
||||
world.spawnParticle("cloud", x + 0.5D, y + 0.5D, z + 0.8D, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("largesmoke", x + 0.5D, y + 0.5D, z + 0.8D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.kitsu.medievalcraft.block.fluid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockTannin extends BlockFluidClassic {
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon stillIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon flowingIcon;
|
||||
|
||||
public BlockTannin(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setBlockTextureName(Main.MODID + ":" + this.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (side == 0 || side == 1)? stillIcon : flowingIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
stillIcon = register.registerIcon(Main.MODID + ":fluidTanStill");
|
||||
flowingIcon = register.registerIcon(Main.MODID + ":fluidTanFlowing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
|
||||
return super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileDamascus;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileMyIronIngot;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class DamascusIngot extends IngotBase {
|
||||
|
||||
public DamascusIngot(String unlocalizedName, Material material) {
|
||||
super(unlocalizedName, material);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileDamascus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.myironingotID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyDiamond;
|
||||
|
||||
public class Diamond extends BlockContainer {
|
||||
|
||||
public Diamond(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
//this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeGlass);
|
||||
//this.setLightLevel(2.0F);
|
||||
//xmin, ymin, zmin,
|
||||
this.setBlockBounds(0.38F, 0.0F, 0.38F,
|
||||
//xmax, ymax, zmax
|
||||
0.62F, 0.2F, 0.62F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
int a = player.inventory.currentItem;
|
||||
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Items.diamond){
|
||||
ItemStack jar = new ItemStack(Items.diamond);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(Items.diamond);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
return Items.diamond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityMyDiamond();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.myDiamondID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyEmerald;
|
||||
|
||||
public class Emerald extends BlockContainer {
|
||||
|
||||
public Emerald(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
//this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeGlass);
|
||||
//this.setLightLevel(2.0F);
|
||||
//xmin, ymin, zmin,
|
||||
this.setBlockBounds(0.35F, 0.0F, 0.38F,
|
||||
//xmax, ymax, zmax
|
||||
0.65F, 0.15F, 0.62F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
|
||||
int a = player.inventory.currentItem;
|
||||
|
||||
if(player.inventory.getStackInSlot(a)!=null){
|
||||
if(player.inventory.getStackInSlot(a).getItem()==Items.emerald){
|
||||
ItemStack jar = new ItemStack(Items.emerald);
|
||||
player.inventory.addItemStackToInventory(jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getStackInSlot(a)==null){
|
||||
ItemStack jar = new ItemStack(Items.emerald);
|
||||
player.inventory.setInventorySlotContents(a, jar);
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
return Items.emerald;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityMyEmerald();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.myEmeraldID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public abstract class IngotBase extends BlockContainer {
|
||||
|
||||
public IngotBase(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random p_149745_1_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void makeParts(World world, int x, int y, int z){
|
||||
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileIronPlate;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileMyIronIngot;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class IronPlate extends IngotBase {
|
||||
|
||||
public IronPlate(String unlocalizedName, Material material) {
|
||||
super(unlocalizedName, material);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.3F, 0.0F, 0.3F,
|
||||
0.7F, 0.12F, 0.7F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileIronPlate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.ironPlateID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileLapisIngot;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class LapisIngot extends IngotBase {
|
||||
|
||||
public LapisIngot(String unlocalizedName, Material material) {
|
||||
super(unlocalizedName, material);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileLapisIngot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.myironingotID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileMyIronIngot;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileRedstoneIngot;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class RedstoneIngot extends IngotBase {
|
||||
|
||||
public RedstoneIngot(String unlocalizedName, Material material) {
|
||||
super(unlocalizedName, material);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileRedstoneIngot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.myironingotID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.kitsu.medievalcraft.block.ingots;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileMyIronIngot;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class RefinedIron extends IngotBase {
|
||||
|
||||
public RefinedIron(String unlocalizedName, Material material) {
|
||||
super(unlocalizedName, material);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setStepSound(soundTypeMetal);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileMyIronIngot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.myironingotID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Firebox extends BlockContainer{
|
||||
|
||||
private final Random random = new Random();
|
||||
/*
|
||||
*
|
||||
*
|
||||
* [Chimney]
|
||||
* [ Forge ]
|
||||
* [Firebox]
|
||||
*
|
||||
*
|
||||
* */
|
||||
public Firebox(String unlocalizedName, Material material) {
|
||||
super(material.rock);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setHarvestLevel("pickaxe", 1, 0);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
//this.isFlammable(world, x, y, z, face);
|
||||
//(xmin, ymin, zmin,
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
1.0F, 0.98F, 1.0F);
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) {
|
||||
if (this == ModBlocks.firebox && side == UP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(x+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F;
|
||||
f2 = (float)(z+0.25) + (rand.nextFloat()/2);
|
||||
world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
|
||||
|
||||
//System.out.println("");
|
||||
if(!world.isRemote){
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))||
|
||||
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
|
||||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
|
||||
){
|
||||
tileEnt.isOn=true;
|
||||
if(world.getBlock(x, y, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
|
||||
}
|
||||
|
||||
System.out.println(tileEnt.isOn);
|
||||
}
|
||||
}
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
if (tileEnt.getStackInSlot(0)!=null){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
||||
tileEnt.setInventorySlotContents(0, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//tileEnt.markDirty();
|
||||
|
||||
}
|
||||
|
||||
tileEnt.markForUpdate();
|
||||
tileEnt.markDirty();
|
||||
//System.out.println(player.inventory.getCurrentItem());
|
||||
return true;
|
||||
}
|
||||
|
||||
/*public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
|
||||
if(!world.isRemote){
|
||||
if(player.inventory.getCurrentItem()!= null){
|
||||
if(player.inventory.getCurrentItem().equals(ModItems.fireBow)||player.inventory.getCurrentItem().equals(Items.flint_and_steel)){
|
||||
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
|
||||
tileEnt.isOn = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEnt != null) {
|
||||
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = tileEnt.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
|
||||
if (j > itemstack.stackSize) {
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
|
||||
}
|
||||
|
||||
float f3 = 0.025F;
|
||||
entityitem.motionX = (float) this.random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
|
||||
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityFirebox();
|
||||
}
|
||||
public static int getItemBurnTime(ItemStack p_145952_0_)
|
||||
{
|
||||
if (p_145952_0_ == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Item item = p_145952_0_.getItem();
|
||||
|
||||
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
|
||||
{
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
|
||||
if (block == Blocks.wooden_slab)
|
||||
{
|
||||
return 150;
|
||||
}
|
||||
|
||||
if (block.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).getToolMaterialName().equals("WOOD")) return 200;
|
||||
if (item == Items.stick) return 100;
|
||||
if (item == Items.coal) return 1600;
|
||||
if (item == Items.lava_bucket) return 20000;
|
||||
if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
|
||||
if (item == Items.blaze_rod) return 2400;
|
||||
return GameRegistry.getFuelValue(p_145952_0_);
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.fireboxID;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
public static boolean isItemFuel(ItemStack stack)
|
||||
{
|
||||
return getItemBurnTime(stack) > 0;
|
||||
}
|
||||
}
|
||||
208
src/main/java/com/kitsu/medievalcraft/block/machines/Forge.java
Normal file
208
src/main/java/com/kitsu/medievalcraft/block/machines/Forge.java
Normal file
@@ -0,0 +1,208 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
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.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Forge extends BlockContainer{
|
||||
|
||||
private final Random random = new Random();
|
||||
/*
|
||||
*
|
||||
*
|
||||
* [Chimney]
|
||||
* [ Forge ]
|
||||
* [Firebox]
|
||||
*
|
||||
*
|
||||
* */
|
||||
public Forge(String unlocalizedName, Material material) {
|
||||
super(material.rock);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setHarvestLevel("pickaxe", 1, 0);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
//this.isFlammable(world, x, y, z, face);
|
||||
//(xmin, ymin, zmin,
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
1.0F, 0.5F, 1.0F);
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(x+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F;
|
||||
f2 = (float)(z+0.25) + (rand.nextFloat()/2);
|
||||
world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
|
||||
|
||||
//System.out.println("");
|
||||
if(!world.isRemote){
|
||||
/* if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
if (tileEnt.getStackInSlot(0)!=null){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
||||
tileEnt.setInventorySlotContents(0, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//tileEnt.markDirty();
|
||||
*/
|
||||
}
|
||||
|
||||
tileEnt.markForUpdate();
|
||||
tileEnt.markDirty();
|
||||
//System.out.println(player.inventory.getCurrentItem());
|
||||
return true;
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEnt != null) {
|
||||
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = tileEnt.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
|
||||
if (j > itemstack.stackSize) {
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
|
||||
}
|
||||
|
||||
float f3 = 0.025F;
|
||||
entityitem.motionX = (float) this.random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
|
||||
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileForge();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.forgeID;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ForgeAnvil extends BlockContainer {
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public ForgeAnvil(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(6.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBot : (side != metadata ? this.blockIcon : this.iconSide));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityAnvilForge();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,EntityPlayer player, int metadata, float what, float these, float are) {
|
||||
FMLNetworkHandler.openGui(player, Main.instance, 2, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.forgeAnvil);
|
||||
}
|
||||
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.forgeAnvil);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEnt != null) {
|
||||
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = tileEnt.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
|
||||
if (j > itemstack.stackSize) {
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
|
||||
}
|
||||
|
||||
float f3 = 0.025F;
|
||||
entityitem.motionX = (float) this.random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
|
||||
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.anvilForgeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
|
||||
int dir = MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3;
|
||||
world.setBlockMetadataWithNotify(x, y, z, dir, 0);
|
||||
//System.out.println(dir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
|
||||
public class SolidFilter extends BlockContainer {
|
||||
|
||||
private final Random random = new Random();
|
||||
//private NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
public SolidFilter(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setHarvestLevel("pickaxe", 1, 0);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.1F, 0.01F, 0.1F,
|
||||
0.9F, 1.0F, 0.9F);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
TileEntitySolidFilter tileSand = (TileEntitySolidFilter) world.getTileEntity(x, y, z);
|
||||
if (!player.isSneaking()) {
|
||||
FMLNetworkHandler.openGui(player, Main.instance, 4, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
if(player.isSneaking()){
|
||||
if(tileSand.getStackInSlot(0)!=null){
|
||||
int s = player.inventory.currentItem;
|
||||
if((player.inventory.getStackInSlot(s)==null)){
|
||||
if((world.getBlock(x, y+1, z).equals(Blocks.sand))||(world.getBlock(x, y+1, z).equals(Blocks.gravel))){
|
||||
tileSand.hits++;
|
||||
player.worldObj.playSoundAtEntity(player, "step.sand", 0.5F, 0.5F);
|
||||
tileSand.getStackInSlot(0).setItemDamage(tileSand.getStackInSlot(0).getItemDamage()+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileEntitySolidFilter tileEnt = (TileEntitySolidFilter) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEnt != null) {
|
||||
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = tileEnt.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
|
||||
if (j > itemstack.stackSize) {
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
|
||||
}
|
||||
|
||||
float f3 = 0.025F;
|
||||
entityitem.motionX = (float) this.random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
|
||||
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntitySolidFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.solidFilterID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
|
||||
//System.out.println(Minecraft.getMinecraft().objectMouseOver.blockX);
|
||||
//System.out.println(Minecraft.getMinecraft().objectMouseOver.blockY);
|
||||
//System.out.println(Minecraft.getMinecraft().objectMouseOver.blockZ);
|
||||
//System.out.println(x + ":" + y + ":" + z);
|
||||
//int newX = Minecraft.getMinecraft().objectMouseOver.blockX;
|
||||
//int newY = Minecraft.getMinecraft().objectMouseOver.blockY;
|
||||
//int newZ = Minecraft.getMinecraft().objectMouseOver.blockZ;
|
||||
TileEntitySandFilter tileSand = (TileEntitySandFilter) world.getTileEntity(x, y, z);
|
||||
if(!world.isRemote){
|
||||
//--------REMOVES THE FILTER FROM THE SLOT IF THE PLAYER IS SNEAKING------------------//
|
||||
if(tileSand.getStackInSlot(0)!=null){
|
||||
int a = player.inventory.currentItem;
|
||||
if((player.inventory.getStackInSlot(a)==null)&&(player.isSneaking())){
|
||||
player.inventory.setInventorySlotContents(a, tileSand.getStackInSlot(0));
|
||||
tileSand.setInventorySlotContents(0, null);
|
||||
world.setBlock(x, y, z, ModBlocks.sandFilterEmpty, 0, 2);
|
||||
}
|
||||
}
|
||||
if(tileSand.getStackInSlot(0)!=null){
|
||||
int a = player.inventory.currentItem;
|
||||
if((player.inventory.getStackInSlot(a)==null)&&(!player.isSneaking())){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.sand)){
|
||||
int h = tileSand.tag.getInteger("FILTERHITS");
|
||||
tileSand.tag.setInteger("FILTERHITS", h+1);
|
||||
player.worldObj.playSoundAtEntity(player, "step.sand", 0.5F, 0.5F);
|
||||
tileSand.getStackInSlot(0).setItemDamage(tileSand.getStackInSlot(0).getItemDamage()+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityTestForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TestForge extends BlockContainer {
|
||||
|
||||
//private static double s= 0.25;
|
||||
//private static double a=0.75;
|
||||
private final Random random = new Random();
|
||||
public static boolean makeIngot;
|
||||
public static int ticks;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public TestForge(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(6.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "forgeside");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "forgeside");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "forgebot");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "forgetop");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBot : (side != metadata ? this.blockIcon : this.iconSide));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityTestForge();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,EntityPlayer player, int metadata, float what, float these, float are) {
|
||||
FMLNetworkHandler.openGui(player, Main.instance, 2, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Item getItemDropped(int par1, Random random, int par3) {
|
||||
return Item.getItemFromBlock(ModBlocks.testForge);
|
||||
}
|
||||
|
||||
public Item getItem(World world, int par2, int par3, int par4) {
|
||||
return Item.getItemFromBlock(ModBlocks.testForge);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
TileEntityTestForge tileEnt = (TileEntityTestForge) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileEnt.isRunning == true){
|
||||
|
||||
}
|
||||
/*Block test = world.getBlock(x, y+1, z);
|
||||
if (test == TestForgeCrafting.blockToCheck.get(0) || test == TestForgeCrafting.blockToCheck.get(1) || test == TestForgeCrafting.blockToCheck.get(2)
|
||||
|| test == TestForgeCrafting.blockToCheck.get(3) || test == TestForgeCrafting.blockToCheck.get(4)) {
|
||||
if (world.canBlockSeeTheSky(x, y+2, z)){
|
||||
|
||||
for(int i = 1; i <11; i++){
|
||||
//world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
world.spawnParticle("cloud", x + a, y+i+1, z + s, 0, 0.1F, 0);
|
||||
world.spawnParticle("largesmoke", x + a, y+i+1, z + s, 0, 0.1F, 0);
|
||||
world.spawnParticle("cloud", x + s, y+i+1, z + a, 0, 0.1F, 0);
|
||||
world.spawnParticle("largesmoke", x + s, y+i+1, z + a, 0, 0.1F, 0);
|
||||
world.spawnParticle("cloud", x + a, y+i+1, z + a, 0, 0.1F, 0);
|
||||
world.spawnParticle("largesmoke", x + a, y+i+1, z + a, 0, 0.1F, 0);
|
||||
world.spawnParticle("cloud", x + s, y+i+1, z + s, 0, 0.1F, 0);
|
||||
world.spawnParticle("largesmoke", x + s, y+i+1, z + s, 0, 0.1F, 0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileEntityTestForge tileEntTestForge = (TileEntityTestForge) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntTestForge != null) {
|
||||
for (int i = 0; i < tileEntTestForge.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = tileEntTestForge.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
|
||||
if (j > itemstack.stackSize) {
|
||||
j = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j;
|
||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
|
||||
}
|
||||
|
||||
float f3 = 0.025F;
|
||||
entityitem.motionX = (float) this.random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
|
||||
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityWaterFilter;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class WaterFilter extends BlockContainer {
|
||||
|
||||
public WaterFilter(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(5.0F);
|
||||
this.setHarvestLevel("pickaxe", 1, 0);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
//this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
//0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntityWaterFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.waterFilterID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if((world.getBlock(x, y+1, z).equals(Blocks.water)) && world.getBlock(x, y-1, z).equals(Blocks.air)){
|
||||
if (random.nextInt(8) == 0) {
|
||||
world.spawnParticle("bubble", x + 0.3D, y + 1.1D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(8) == 1) {
|
||||
world.spawnParticle("bubble", x + 0.3D, y + 1.1D, z + 0.34D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(8) == 2) {
|
||||
world.spawnParticle("bubble", x + 0.75D, y + 1.1D, z + 0.6D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (random.nextInt(8) == 3) {
|
||||
world.spawnParticle("bubble", x + 0.45D, y + 1.1D, z + 0.75D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.gui.GuiHandler;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class formTable extends Block {
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon formTableTop;
|
||||
/*
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon formTableSide; */
|
||||
|
||||
public formTable(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
|
||||
this.setBlockName(unlocalizedName);
|
||||
//this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.5F);
|
||||
this.setResistance(2.0F);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int metadata) {
|
||||
|
||||
return side == 1 ? this.formTableTop : this.blockIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister) {
|
||||
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "formTableSide");
|
||||
this.formTableTop = iconRegister.registerIcon(Main.MODID + ":" + "formTableTop");
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Main.instance, GuiHandler.guiIDformTable, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
59
src/main/java/com/kitsu/medievalcraft/block/shitBlock.java
Normal file
59
src/main/java/com/kitsu/medievalcraft/block/shitBlock.java
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
package com.kitsu.medievalcraft.block;
|
||||
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProviderEnd;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class shitBlock extends Block {
|
||||
|
||||
protected shitBlock(String unlocalizedName, Material material) {
|
||||
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(2.0F);
|
||||
this.setResistance(6.0F);
|
||||
this.setHarvestLevel("shovel", 0);
|
||||
this.setStepSound(soundTypeSnow);
|
||||
this.setTickRandomly(true);
|
||||
|
||||
}
|
||||
|
||||
public void updateTick(World world, int x, int y, int z, Random random){
|
||||
//System.out.println("Block Tick");
|
||||
if(random.nextInt(100)==0){
|
||||
//System.out.println("Random Method Fired");
|
||||
//world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.func_147480_a(x, y, z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
if (this == ModBlocks.shitblock && side == UP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ((world.provider instanceof WorldProviderEnd) && this == Blocks.bedrock && side == UP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1154
src/main/java/com/kitsu/medievalcraft/block/wood/ShelfFour.java
Normal file
1154
src/main/java/com/kitsu/medievalcraft/block/wood/ShelfFour.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,249 @@
|
||||
package com.kitsu.medievalcraft.block.wood;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntitySmallBarrel;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
public class SmallBarrel extends BlockContainer {
|
||||
|
||||
public SmallBarrel(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeWood);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
this.setBlockBounds(0.125F, 0.0F, 0.125F,
|
||||
0.775F, 0.8F, 0.775F);
|
||||
}
|
||||
//MAKE CASES AND HAVE THEM RUN ON THE CLIENT AND SERVER TO UPDATE THE PLAYERS INVENTORY I GUESS SOME SHIT LIKE THAT
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
|
||||
TileEntitySmallBarrel tile = (TileEntitySmallBarrel) world.getTileEntity(x, y, z);
|
||||
tile.res="kitsumedievalcraft:models/UntitledBarrel.png";
|
||||
}
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
TileEntitySmallBarrel tile = (TileEntitySmallBarrel) world.getTileEntity(x, y, z);
|
||||
//if(!world.isRemote){
|
||||
/*if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==ModItems.itemSmallBarrelLid){
|
||||
if(tile.lid==false){
|
||||
player.swingItem();
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
tile.lid=true;
|
||||
if(tile.quanta==0){
|
||||
tile.type="empty";
|
||||
}
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==ModItems.soakedLeather){
|
||||
if((tile.scuddedloaded==false)&&(tile.soakedloaded==false)){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
tile.soakedloaded=true;
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==ModItems.scuddedLeather){
|
||||
if((tile.scuddedloaded==false)&&(tile.soakedloaded==false)){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
tile.scuddedloaded=true;
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==ModItems.tanninBucket){
|
||||
//if(tile.lid==false){
|
||||
if((tile.type.equals("empty"))||(tile.type.equals("tannin"))){
|
||||
tile.type = "tannin";
|
||||
if(tile.quanta < 2){
|
||||
ItemStack bucket = new ItemStack(Items.bucket, 1);
|
||||
tile.quanta = tile.quanta+1;
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
player.inventory.addItemStackToInventory(bucket);
|
||||
if(tile.quanta==1){
|
||||
tile.res = "kitsumedievalcraft:models/UntitledBarrelTan1.png";
|
||||
}
|
||||
if(tile.quanta==2){
|
||||
tile.res = "kitsumedievalcraft:models/UntitledBarrelTan2.png";
|
||||
}
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==ModItems.slackBucket){
|
||||
//if(tile.lid==false){
|
||||
if((tile.type.equals("empty"))||(tile.type.equals("slack"))){
|
||||
tile.type = "slack";
|
||||
if(tile.quanta < 2){
|
||||
ItemStack bucket = new ItemStack(Items.bucket, 1);
|
||||
tile.quanta = tile.quanta+1;
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
player.inventory.addItemStackToInventory(bucket);
|
||||
if(tile.quanta==1){
|
||||
tile.res = "kitsumedievalcraft:models/UntitledBarrelSlack1.png";
|
||||
}
|
||||
if(tile.quanta==2){
|
||||
tile.res = "kitsumedievalcraft:models/UntitledBarrelSlack2.png";
|
||||
}
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==Items.bucket){
|
||||
//if(tile.lid==false){
|
||||
if(tile.quanta>0){
|
||||
if(tile.type.equals("tannin")){
|
||||
tile.quanta--;
|
||||
ItemStack bucket = new ItemStack(ModItems.tanninBucket);
|
||||
player.inventory.addItemStackToInventory(bucket);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
if(tile.quanta==0){
|
||||
tile.type="empty";
|
||||
tile.res="kitsumedievalcraft:models/UntitledBarrel.png";
|
||||
}
|
||||
if(tile.quanta==1){
|
||||
tile.res="kitsumedievalcraft:models/UntitledBarrelTan1.png";
|
||||
}
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
if(tile.type.equals("slack")){
|
||||
tile.quanta--;
|
||||
ItemStack bucket = new ItemStack(ModItems.slackBucket);
|
||||
player.inventory.addItemStackToInventory(bucket);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
if(tile.quanta==0){
|
||||
tile.type ="empty";
|
||||
tile.res="kitsumedievalcraft:models/UntitledBarrel.png";
|
||||
}
|
||||
if(tile.quanta==1){
|
||||
tile.res="kitsumedievalcraft:models/UntitledBarrelSlack1.png";
|
||||
}
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem()==null){
|
||||
/*if(tile.lid==true){
|
||||
ItemStack lid = new ItemStack(ModItems.itemSmallBarrelLid, 1);
|
||||
//player.swingItem();
|
||||
//int p = player.inventory.getFirstEmptyStack();
|
||||
tile.lid=false;
|
||||
player.inventory.addItemStackToInventory(lid);
|
||||
//player.inventory.setInventorySlotContents(p, lid);
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}*/
|
||||
//if(tile.lid==false){
|
||||
if(tile.scuddedready==true){
|
||||
ItemStack tanned = new ItemStack(ModItems.tannedLeather, 1);
|
||||
player.inventory.addItemStackToInventory(tanned);
|
||||
tile.scuddedready=false;
|
||||
tile.scuddedloaded=false;
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
//if(tile.lid==false){
|
||||
if(tile.soakedready==true){
|
||||
ItemStack slacked = new ItemStack(ModItems.slackedLeather, 1);
|
||||
player.inventory.addItemStackToInventory(slacked);
|
||||
tile.soakedready=false;
|
||||
tile.soakedloaded=false;
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
//if(tile.lid==false){
|
||||
if((tile.soakedready==false)&&(tile.scuddedready==false)){
|
||||
world.setBlockToAir(x, y, z);
|
||||
ItemStack barrel = new ItemStack(ModBlocks.smallBarrel, 1);
|
||||
player.inventory.addItemStackToInventory(barrel);
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
}
|
||||
tile.markForUpdate();
|
||||
tile.markDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntitySmallBarrel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.smallBarrelID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.kitsu.medievalcraft.block.wood;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntitySmallLid;
|
||||
|
||||
public class SmallBarrelLid extends BlockContainer {
|
||||
|
||||
public SmallBarrelLid(String unlocalizedName, Material material) {
|
||||
super(material);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
//this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(1.0F);
|
||||
this.setResistance(1.0F);
|
||||
this.setHarvestLevel(null, 0);
|
||||
this.setStepSound(soundTypeWood);
|
||||
//xmin, ymin, zmin,
|
||||
//xmax, ymax, zmax
|
||||
//this.setBlockBounds(0.17F, 0.0F, 0.315F,
|
||||
// 0.8F, 0.15F, 0.725F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_){
|
||||
if(!world.isRemote){
|
||||
TileEntitySmallLid tileLid = (TileEntitySmallLid) world.getTileEntity(x, y, z);
|
||||
if(tileLid.ring<2){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.itemSmallBarrelLid, 1, 0)));
|
||||
//System.out.println(world.getTileEntity(x, y, z));
|
||||
//System.out.println(tileLid.logs);
|
||||
if(tileLid.logs>0){
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.halfSplitBoard, tileLid.logs, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(!world.isRemote){
|
||||
TileEntitySmallLid tileLid = (TileEntitySmallLid) world.getTileEntity(x, y, z);
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if((player.getCurrentEquippedItem().getItem().equals(ModItems.halfSplitBoard))){
|
||||
if(tileLid.logs<8){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
tileLid.logs = tileLid.logs +1;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if((player.getCurrentEquippedItem().getItem().equals(ModItems.saplingRing))){
|
||||
|
||||
if(tileLid.logs==8){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
tileLid.ring = tileLid.ring +1;
|
||||
if(tileLid.ring==2){
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileEntitySmallLid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.smallLidID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.kitsu.medievalcraft.block.wood.clean;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CleanAcacia extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public CleanAcacia(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(4)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.acaciaSplitLog, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = p_149660_9_ & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (p_149660_5_)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanAcaciaSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "cleanAcaciaSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "cleanAcaciaTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "cleanAcaciaTop");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.kitsu.medievalcraft.block.wood.clean;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CleanBirch extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public CleanBirch(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(4)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.birchSplitLog, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = p_149660_9_ & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (p_149660_5_)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanBirchSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "cleanBirchSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "cleanBirchTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "cleanBirchTop");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.kitsu.medievalcraft.block.wood.clean;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CleanDarkOak extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public CleanDarkOak(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(4)==0){
|
||||
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.darkSplitLog, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = p_149660_9_ & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (p_149660_5_)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanDarkOakSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "cleanDarkOakSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "cleanDarkOakTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "cleanDarkOakTop");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.kitsu.medievalcraft.block.wood.clean;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CleanJungle extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public CleanJungle(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(4)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.jungleSplitLog, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = p_149660_9_ & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (p_149660_5_)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanJungleSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "cleanJungleSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "cleanJungleTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "cleanJungleTop");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.kitsu.medievalcraft.block.wood.clean;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CleanOak extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public CleanOak(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(4)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.oakSplitLog, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = p_149660_9_ & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (p_149660_5_)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanOakSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "cleanOakSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "cleanOakTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "cleanOakTop");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.kitsu.medievalcraft.block.wood.clean;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CleanSpruce extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public CleanSpruce(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(4)==0){
|
||||
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.spruceSplitLog, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = p_149660_9_ & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (p_149660_5_)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanSpruceSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "cleanSpruceSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "cleanSpruceTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "cleanSpruceTop");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.kitsu.medievalcraft.block.wood.quartersplit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class AcaciaSplitLog extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public AcaciaSplitLog(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanAcaciaSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "acaciaSplitLogSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "acaciaSplitLogTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "acaciaSplitLogTop");
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(2)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.splitBoard, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitx, float hity, float hitz, int meta)
|
||||
{
|
||||
//System.out.println(side);
|
||||
int j1 = meta & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
b0=0;
|
||||
break;
|
||||
case 1:
|
||||
b0=0;
|
||||
break;
|
||||
case 2:
|
||||
b0=8;
|
||||
break;
|
||||
case 3:
|
||||
b0=8;
|
||||
break;
|
||||
case 4:
|
||||
b0=4;
|
||||
case 5:
|
||||
b0=4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
||||
*/
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired rectangular prism to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
}
|
||||
|
||||
public void func_149797_b(int p_149797_1_)
|
||||
{
|
||||
|
||||
if (p_149797_1_ == 0)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 4)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 8)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 1.0F);
|
||||
//this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.kitsu.medievalcraft.block.wood.quartersplit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BirchSplitLog extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blockIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public BirchSplitLog(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "cleanBirchSide");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "birchSplitLogSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "birchSplitLogTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "birchSplitLogTop");
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.swingItem();
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
if(world.rand.nextInt(2)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.splitBoard, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitx, float hity, float hitz, int meta)
|
||||
{
|
||||
//System.out.println(side);
|
||||
int j1 = meta & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
b0=0;
|
||||
break;
|
||||
case 1:
|
||||
b0=0;
|
||||
break;
|
||||
case 2:
|
||||
b0=8;
|
||||
break;
|
||||
case 3:
|
||||
b0=8;
|
||||
break;
|
||||
case 4:
|
||||
b0=4;
|
||||
case 5:
|
||||
b0=4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
||||
*/
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired rectangular prism to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
}
|
||||
|
||||
public void func_149797_b(int p_149797_1_)
|
||||
{
|
||||
|
||||
if (p_149797_1_ == 0)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 4)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 8)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 1.0F);
|
||||
//this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
//this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.kitsu.medievalcraft.block.wood.quartersplit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class DarkSplitLog extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public DarkSplitLog(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "darkSplitLogIcon");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "darkSplitLogSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "darkSplitLogTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "darkSplitLogTop");
|
||||
}
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.swingItem();
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
if(world.rand.nextInt(2)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.splitBoard, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitx, float hity, float hitz, int meta)
|
||||
{
|
||||
//System.out.println(side);
|
||||
int j1 = meta & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
b0=0;
|
||||
break;
|
||||
case 1:
|
||||
b0=0;
|
||||
break;
|
||||
case 2:
|
||||
b0=8;
|
||||
break;
|
||||
case 3:
|
||||
b0=8;
|
||||
break;
|
||||
case 4:
|
||||
b0=4;
|
||||
case 5:
|
||||
b0=4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
||||
*/
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired rectangular prism to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
}
|
||||
|
||||
public void func_149797_b(int p_149797_1_)
|
||||
{
|
||||
|
||||
if (p_149797_1_ == 0)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 4)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 8)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 1.0F);
|
||||
//this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
//this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.kitsu.medievalcraft.block.wood.quartersplit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class JungleSplitLog extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public JungleSplitLog(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "jungleSplitLogIcon");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "jungleSplitLogSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "jungleSplitLogTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "jungleSplitLogTop");
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.swingItem();
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
if(world.rand.nextInt(2)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.splitBoard, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitx, float hity, float hitz, int meta)
|
||||
{
|
||||
//System.out.println(side);
|
||||
int j1 = meta & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
b0=0;
|
||||
break;
|
||||
case 1:
|
||||
b0=0;
|
||||
break;
|
||||
case 2:
|
||||
b0=8;
|
||||
break;
|
||||
case 3:
|
||||
b0=8;
|
||||
break;
|
||||
case 4:
|
||||
b0=4;
|
||||
case 5:
|
||||
b0=4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
||||
*/
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired rectangular prism to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
}
|
||||
|
||||
public void func_149797_b(int p_149797_1_)
|
||||
{
|
||||
|
||||
if (p_149797_1_ == 0)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 4)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 8)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 1.0F);
|
||||
//this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.kitsu.medievalcraft.block.wood.quartersplit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OakSplitLog extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public OakSplitLog(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "oakSplitLogIcon");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "oakSplitLogSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "oakSplitLogTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "oakSplitLogTop");
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.swingItem();
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
if(world.rand.nextInt(2)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.splitBoard, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitx, float hity, float hitz, int meta)
|
||||
{
|
||||
//System.out.println(side);
|
||||
int j1 = meta & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
b0=0;
|
||||
break;
|
||||
case 1:
|
||||
b0=0;
|
||||
break;
|
||||
case 2:
|
||||
b0=8;
|
||||
break;
|
||||
case 3:
|
||||
b0=8;
|
||||
break;
|
||||
case 4:
|
||||
b0=4;
|
||||
case 5:
|
||||
b0=4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
||||
*/
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired rectangular prism to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
}
|
||||
|
||||
public void func_149797_b(int p_149797_1_)
|
||||
{
|
||||
|
||||
if (p_149797_1_ == 0)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 4)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 8)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 1.0F);
|
||||
//this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.kitsu.medievalcraft.block.wood.quartersplit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SpruceSplitLog extends BlockRotatedPillar {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBot;
|
||||
|
||||
public SpruceSplitLog(String unlocalizedName, Material mat) {
|
||||
super(mat);
|
||||
this.setBlockName(unlocalizedName);
|
||||
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.0F);
|
||||
this.setResistance(3.0F);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + "spruceSplitLogIcon");
|
||||
this.iconSide = iconRegister.registerIcon(Main.MODID + ":" + "spruceSplitLogSide");
|
||||
this.iconBot = iconRegister.registerIcon(Main.MODID + ":" + "spruceSplitLogTop");
|
||||
this.iconTop = iconRegister.registerIcon(Main.MODID + ":" + "spruceSplitLogTop");
|
||||
}
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.getCurrentEquippedItem().getItem() instanceof ItemAxe){
|
||||
player.swingItem();
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":splitlog", 1.0F, 1.0F);
|
||||
if(world.rand.nextInt(2)==0){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.splitBoard, 4, 0)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitx, float hity, float hitz, int meta)
|
||||
{
|
||||
//System.out.println(side);
|
||||
int j1 = meta & 3;
|
||||
byte b0 = 0;
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
b0=0;
|
||||
break;
|
||||
case 1:
|
||||
b0=0;
|
||||
break;
|
||||
case 2:
|
||||
b0=8;
|
||||
break;
|
||||
case 3:
|
||||
b0=8;
|
||||
break;
|
||||
case 4:
|
||||
b0=4;
|
||||
case 5:
|
||||
b0=4;
|
||||
}
|
||||
|
||||
return j1 | b0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
||||
*/
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired rectangular prism to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
|
||||
}
|
||||
|
||||
public void func_149797_b(int p_149797_1_)
|
||||
{
|
||||
|
||||
if (p_149797_1_ == 0)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 4)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
}
|
||||
|
||||
if (p_149797_1_ == 8)
|
||||
{
|
||||
this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 1.0F);
|
||||
//this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
int k = metadata & 12;
|
||||
int l = metadata & 3;
|
||||
return k == 0 && (side == 1 || side == 0) ? this.getTopIcon(l) : (k == 4 && (side == 5 || side == 4) ? this.getTopIcon(l) : (k == 8 && (side == 2 || side == 3) ? this.getTopIcon(l) : this.getSideIcon(l)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getSideIcon(int p_150163_1_)
|
||||
{
|
||||
return this.iconSide;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon getTopIcon(int p_150161_1_)
|
||||
{
|
||||
return this.iconTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.kitsu.medievalcraft.compat;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
|
||||
public class FuelHandler implements IFuelHandler
|
||||
{
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel)
|
||||
{
|
||||
ItemStack stack = fuel;
|
||||
//MagnumOpus.logger.info("fuel handler: " + fuel);
|
||||
|
||||
/** Mod Real Fuel Items **/
|
||||
if ( stack.isItemEqual(new ItemStack(ModItems.itemShit)) ) { return 600; }
|
||||
else if ( stack.isItemEqual(new ItemStack(ModBlocks.shitblock)) ) { return 3200; }
|
||||
|
||||
|
||||
/** that is all **/
|
||||
else { return 0; }
|
||||
|
||||
}
|
||||
}
|
||||
44
src/main/java/com/kitsu/medievalcraft/compat/ModDict.java
Normal file
44
src/main/java/com/kitsu/medievalcraft/compat/ModDict.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.kitsu.medievalcraft.compat;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
public class ModDict {
|
||||
|
||||
public static void RegisterOres () {
|
||||
|
||||
//OreDictionary.registerOre("itemLeather", Items.leather);
|
||||
|
||||
OreDictionary.registerOre("strapLeather", new ItemStack(ModItems.leatherStrap, 1, 0));
|
||||
OreDictionary.registerOre("ringIron", new ItemStack(ModItems.ironRing, 1, 0));
|
||||
OreDictionary.registerOre("ingotIron", new ItemStack(ModBlocks.refinedIron, 1, 0));
|
||||
OreDictionary.registerOre("ingotSteel", new ItemStack(ModBlocks.damascus, 1, 0));
|
||||
OreDictionary.registerOre("materialHardenedLeather", new ItemStack(ModItems.finishedLeather, 1, 0));
|
||||
OreDictionary.registerOre("bladeTool", new ItemStack(ModItems.workBlade, 1, 0));
|
||||
OreDictionary.registerOre("foodSalt", new ItemStack(ModItems.salt, 1, 0));
|
||||
OreDictionary.registerOre("pulpWood", new ItemStack(ModItems.woodPulp, 1, 0));
|
||||
OreDictionary.registerOre("knappedFlint", new ItemStack(ModItems.flintKnapped, 1, 0));
|
||||
|
||||
//OreDictionary.registerOre("cordage", new ItemStack(ModItems.leatherString, 1, 0));
|
||||
//OreDictionary.registerOre("itemLeather", ModItems.cutLeather);
|
||||
//OreDictionary.replacements.put(new ItemStack(Item.leather), "itemLeather");
|
||||
|
||||
|
||||
//OreDictionary.registerOre("strapLeather", new ItemStack(ModItems.leatherStrap));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* OreDictionary.registerOre("foodSalt", new ItemStack(ModItems.saltRock, 1, 0));
|
||||
OreDictionary.registerOre("foodSalt", new ItemStack(ModItems.saltFire, 1, 0));
|
||||
OreDictionary.registerOre("foodSalt", new ItemStack(ModItems.saltVoid, 1, 0));
|
||||
OreDictionary.registerOre("foodSalt", new ItemStack(ModItems.saltNetjry, 1, 0));
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour;
|
||||
|
||||
public class ContainerFirebox extends Container {
|
||||
|
||||
protected TileEntityFirebox tileEnt;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tileEnt.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public ContainerFirebox (InventoryPlayer inventoryPlayer, TileEntityFirebox te){
|
||||
tileEnt = te;
|
||||
|
||||
//the Slot constructor takes the IInventory and the slot number in that it binds to
|
||||
//and the x-y coordinates it resides on-screen
|
||||
/* for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
|
||||
8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
if (slotObject != null && slotObject.getHasStack()) {
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 9) {
|
||||
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack((ItemStack)null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
/*if (stackInSlot.stackSize == stack.stackSize) {
|
||||
return null;
|
||||
}*/
|
||||
//slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
|
||||
|
||||
public class ContainerForgeAnvil extends Container {
|
||||
|
||||
protected TileEntityAnvilForge tileEnt;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tileEnt.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public ContainerForgeAnvil (InventoryPlayer inventoryPlayer, TileEntityAnvilForge te){
|
||||
tileEnt = te;
|
||||
|
||||
//the Slot constructor takes the IInventory and the slot number in that it binds to
|
||||
//and the x-y coordinates it resides on-screen
|
||||
/*for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
|
||||
8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
if (slotObject != null && slotObject.getHasStack()) {
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 9) {
|
||||
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack((ItemStack)null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
/*if (stackInSlot.stackSize == stack.stackSize) {
|
||||
return null;
|
||||
}*/
|
||||
//slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.crafting.FormTableCraftManager;
|
||||
|
||||
public class ContainerFormTable extends Container {
|
||||
|
||||
public InventoryCrafting craftMatrix;
|
||||
public IInventory craftResult;
|
||||
private World worldObj;
|
||||
private int posX;
|
||||
private int posY;
|
||||
private int posZ;
|
||||
|
||||
public ContainerFormTable (InventoryPlayer invplayer, World world, int x, int y, int z) {
|
||||
craftMatrix = new InventoryCrafting (this, 5, 5);
|
||||
craftResult = new InventoryCraftResult();
|
||||
worldObj = world;
|
||||
posX = x;
|
||||
posY = y;
|
||||
posZ = z;
|
||||
|
||||
this.addSlotToContainer(new SlotCrafting(invplayer.player, craftMatrix, craftResult, 0, 141, 43));
|
||||
|
||||
for(int i=0; i<5; i++) {
|
||||
for (int k=0; k<5; k++) {
|
||||
this.addSlotToContainer (new Slot(craftMatrix, k+i*5, 8+k*18, 7+i*18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<3; i++) {
|
||||
for (int k=0; k<9; k++) {
|
||||
this.addSlotToContainer (new Slot(invplayer, k+i*9+9, 8+k*18, 106+i*18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<9; i++) {
|
||||
this.addSlotToContainer (new Slot(invplayer, i, 8+i*18, 164));
|
||||
}
|
||||
|
||||
onCraftMatrixChanged(craftMatrix);
|
||||
}
|
||||
|
||||
public void onCraftMatrixChanged (IInventory iinventory) {
|
||||
craftResult.setInventorySlotContents(0,FormTableCraftManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
|
||||
if (worldObj.getBlock(posX, posY, posZ) != ModBlocks.formtable) {
|
||||
return false;
|
||||
}
|
||||
return player.getDistanceSq(posX + 0.5D, posY + 0.5D, posZ + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the container is closed.
|
||||
*/
|
||||
public void onContainerClosed(EntityPlayer player)
|
||||
{
|
||||
super.onContainerClosed(player);
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
for (int i = 0; i < 25; ++i)
|
||||
{
|
||||
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice(itemstack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(p_82846_2_);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (p_82846_2_ == 0)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 10, 46, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if (p_82846_2_ >= 10 && p_82846_2_ < 37)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 37, 46, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (p_82846_2_ >= 37 && p_82846_2_ < 46)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 10, 37, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 10, 46, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(p_82846_1_, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour;
|
||||
|
||||
public class ContainerShelfFour extends Container {
|
||||
|
||||
protected TileEntityShelfFour tileEnt;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tileEnt.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public ContainerShelfFour (InventoryPlayer inventoryPlayer, TileEntityShelfFour te){
|
||||
tileEnt = te;
|
||||
|
||||
//the Slot constructor takes the IInventory and the slot number in that it binds to
|
||||
//and the x-y coordinates it resides on-screen
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}
|
||||
// addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
|
||||
8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
if (slotObject != null && slotObject.getHasStack()) {
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 9) {
|
||||
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack((ItemStack)null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
/*if (stackInSlot.stackSize == stack.stackSize) {
|
||||
return null;
|
||||
}*/
|
||||
//slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter;
|
||||
|
||||
public class ContainerSolidFilter extends Container {
|
||||
|
||||
protected TileEntitySolidFilter tileEnt;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tileEnt.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public ContainerSolidFilter (InventoryPlayer inventoryPlayer, TileEntitySolidFilter te){
|
||||
tileEnt = te;
|
||||
|
||||
//the Slot constructor takes the IInventory and the slot number in that it binds to
|
||||
//and the x-y coordinates it resides on-screen
|
||||
/*for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
|
||||
8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
if (slotObject != null && slotObject.getHasStack()) {
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 9) {
|
||||
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack((ItemStack)null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
/*if (stackInSlot.stackSize == stack.stackSize) {
|
||||
return null;
|
||||
}*/
|
||||
//slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityTestForge;
|
||||
|
||||
public class ContainerTestForge extends Container {
|
||||
|
||||
protected TileEntityTestForge tileEnt;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tileEnt.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public ContainerTestForge (InventoryPlayer inventoryPlayer, TileEntityTestForge te){
|
||||
tileEnt = te;
|
||||
|
||||
//the Slot constructor takes the IInventory and the slot number in that it binds to
|
||||
//and the x-y coordinates it resides on-screen
|
||||
/*for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
|
||||
8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
if (slotObject != null && slotObject.getHasStack()) {
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 9) {
|
||||
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack((ItemStack)null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
/*if (stackInSlot.stackSize == stack.stackSize) {
|
||||
return null;
|
||||
}*/
|
||||
//slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
|
||||
public class CraftingHandle {
|
||||
|
||||
public static int craftflag;
|
||||
//ItemStack j;
|
||||
//ItemStack R;
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemCrafting(PlayerEvent.ItemCraftedEvent event) {
|
||||
|
||||
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);
|
||||
ItemStack j = event.craftMatrix.getStackInSlot(i); // Gets the item
|
||||
//ItemStack L = event.craftMatrix.getStackInSlot(i - 1);
|
||||
//ItemStack R = event.craftMatrix.getStackInSlot(i+3);
|
||||
|
||||
//FORGE HAMMER
|
||||
if (j.getItem() != null && j.getItem() == ModItems.forgeHammer) {
|
||||
|
||||
ItemStack k = new ItemStack(ModItems.forgeHammer, 2, (j.getItemDamage() + 1));
|
||||
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
event.player.worldObj.playSoundAtEntity(event.player, "random.anvil_use", 0.8F, 1.0F );
|
||||
|
||||
//IRONSAW
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironSaw) {
|
||||
ItemStack k = new ItemStack(ModItems.ironSaw, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.player.worldObj.playSoundAtEntity(event.player, Main.MODID + ":sawwood", 0.1F, 2.0F);
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
//FLINTSAW
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.flintSaw) {
|
||||
ItemStack k = new ItemStack(ModItems.flintSaw, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.player.worldObj.playSoundAtEntity(event.player, Main.MODID + ":sawwood", 0.1F, 3.0F);
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//WORKBLADE
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.workBlade) {
|
||||
ItemStack k = new ItemStack(ModItems.workBlade, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON AXE FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironAxeForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironAxeForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON BATTLE AXE FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironBattleAxeForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironBattleAxeForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON DAGGER FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironDaggerForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironDaggerForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON HALBERD FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironHandleForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironHandleForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON HOE FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironHoeForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironHoeForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON LONGSWORD FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironLongswordForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironLongswordForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON MACE HEAD FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironMaceHeadForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironMaceHeadForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON PICKAXE FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironPickaxeForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironPickaxeForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON RING FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironRingForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironRingForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON SAWBLADE FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironSawBladeForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironSawBladeForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON SHARP TIP FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironSharpTipForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironSharpTipForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON SHORT SWORD FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironShortSwordForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironShortSwordForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON SPADE FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironSpadForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironSpadForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//IRON SPEAR TIP FORM
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.ironSpearTipForm) {
|
||||
ItemStack k = new ItemStack(ModItems.ironSpearTipForm, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
|
||||
//LEATHER SHEARS
|
||||
} if (j.getItem() != null && j.getItem() == ModItems.leatherShears) {
|
||||
ItemStack k = new ItemStack(ModItems.leatherShears, 2, (j.getItemDamage() + 1));
|
||||
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||
k.stackSize--;
|
||||
}
|
||||
event.craftMatrix.setInventorySlotContents(i, k);
|
||||
event.player.worldObj.playSoundAtEntity(event.player, "mob.sheep.shear", 0.8F, 1.0F );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
public class ForgeAnvilCrafting {
|
||||
|
||||
public static final Hashtable<Integer, Item> itemToCheck = new Hashtable <Integer, Item>(){{
|
||||
|
||||
put(0, ModItems.ironPickaxeForm);
|
||||
put(1, ModItems.ironSpadForm);
|
||||
put(2, ModItems.ironHoeForm);
|
||||
put(3, ModItems.ironAxeForm);
|
||||
put(4, ModItems.ironLongswordForm);
|
||||
put(5, ModItems.ironShortSwordForm);
|
||||
put(6, ModItems.ironDaggerForm);
|
||||
put(7, ModItems.ironSpearTipForm);
|
||||
put(8, ModItems.ironMaceHeadForm);
|
||||
put(9, ModItems.ironBattleAxeForm);
|
||||
put(10, ModItems.ironSawBladeForm);
|
||||
put(11, ModItems.ironSharpTipForm);
|
||||
put(12, ModItems.ironRingForm);
|
||||
put(13, ModItems.ironHandleForm);
|
||||
|
||||
}};
|
||||
|
||||
public static final Hashtable<Integer, Item> itemToCheckClay = new Hashtable <Integer, Item>(){{
|
||||
|
||||
put(0, ModItems.cookedpickaxeClayForm);
|
||||
put(1, ModItems.cookedspadeHeadClayForm);
|
||||
put(2, ModItems.cookedhoeHeadClayForm);
|
||||
put(3, ModItems.cookedaxeHeadClayForm);
|
||||
put(4, ModItems.cookedlongswordClayForm);
|
||||
put(5, ModItems.cookedshortswordClayForm);
|
||||
put(6, ModItems.cookeddaggerClayForm);
|
||||
put(7, ModItems.cookedspeartipClayForm);
|
||||
put(8, ModItems.cookedmaceheadClayForm);
|
||||
put(9, ModItems.cookedbattleaxeClayForm);
|
||||
put(10, ModItems.cookedsawbladeClayForm);
|
||||
put(11, ModItems.cookedsharptipClayForm);
|
||||
put(12, ModItems.cookedringClayForm);
|
||||
|
||||
}};
|
||||
|
||||
public static final Hashtable<Integer, ItemStack> itemToGive = new Hashtable <Integer, ItemStack>(){{
|
||||
|
||||
put(0, new ItemStack (ModItems.ironpickaxeHead, 1, 0));
|
||||
put(1, new ItemStack (ModItems.ironspadeHead, 1, 0));
|
||||
put(2, new ItemStack (ModItems.ironhoeHead, 1, 0));
|
||||
put(3, new ItemStack (ModItems.ironaxeHead, 1, 0));
|
||||
put(4, new ItemStack (ModItems.ironlongswordBlade, 1, 0));
|
||||
put(5, new ItemStack (ModItems.ironshortswordBlade,2,0));
|
||||
put(6, new ItemStack (ModItems.irondaggerBlade, 3,0));
|
||||
put(7, new ItemStack (ModItems.ironspearTip, 1, 0));
|
||||
put(8, new ItemStack (ModItems.ironmaceHead, 1, 0));
|
||||
|
||||
put(9, new ItemStack (ModItems.ironbattleaxeHead, 1, 0));
|
||||
put(10, new ItemStack (ModItems.ironsawBlade, 1, 0));
|
||||
put(11, new ItemStack (ModItems.ironsharpTip,9,0));
|
||||
put(12, new ItemStack (ModItems.ironRing,9,0));
|
||||
put(13, new ItemStack (ModItems.ironweaponHandle, 2, 0));
|
||||
|
||||
}};
|
||||
|
||||
public static final Hashtable<Integer, String> toolToRepair = new Hashtable <Integer, String>(){{
|
||||
|
||||
put(0, "Forged Iron Pickaxe");
|
||||
put(1, "Forged Shovel");
|
||||
put(2, "Forged Lumber Axe");
|
||||
put(3, "Leather Shears");
|
||||
put(4, "Iron Saw");
|
||||
put(5, "Iron Shield");
|
||||
put(6, "Heavy Mace");
|
||||
put(7, "Longsword");
|
||||
put(8, "Forge Hammer");
|
||||
put(9, "Crafting Blade");
|
||||
put(10, "Gladius");
|
||||
|
||||
}};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
public class FormTableCraftManager {
|
||||
|
||||
private static final FormTableCraftManager instance = new FormTableCraftManager();
|
||||
private List recipes = new ArrayList();
|
||||
//private static final String __OBFID = "CL_00000090";
|
||||
|
||||
public static final FormTableCraftManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private FormTableCraftManager () {
|
||||
|
||||
recipes = new ArrayList();
|
||||
////////RECIPES////////////////////////////////////////////////////////
|
||||
//EXAMPLE RECIPE
|
||||
//this.addRecipe(new ItemStack(ModItems.longSword, 1), new Object[]{"S", "S", "S", "S", "S", 'S', Items.stick});
|
||||
//this.addRecipe(new ItemStack(ModItems.xxx, 1), new Object[]{"", "", "", "", "", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.pickaxeClayForm, 1), new Object[]{ "ccccc", "cc cc", "c c", " c ", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.spadeHeadClayForm, 1), new Object[]{ "ccccc", "cc cc", "c c", "c c", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.hoeHeadClayForm, 1), new Object[]{ "ccccc", "c c", "c ccc", "ccccc", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.axeHeadClayForm, 1), new Object[]{ "ccccc", "c ccc", " c", "c ccc", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.longswordClayForm, 1), new Object[]{ "cccc ", "ccc c", "cc cc", "c ccc", " cccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.shortswordClayForm, 1), new Object[]{"cc cc", "cc cc", "cc cc", "c c", "cc cc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.daggerClayForm, 1), new Object[]{ "ccccc", "cc cc", "cc cc", "cc cc", "ccccc", 'c', Items.clay_ball});
|
||||
//this.addRecipe(new ItemStack(ModItems.halberdClayForm, 1), new Object[]{ "ccccc", "c ccc", " ", " cc", "c ccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.speartipClayForm, 1), new Object[]{ "ccccc", "cc cc", "cc cc", "c c", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.maceheadClayForm, 1), new Object[]{ "cc cc", "c c", " ", "c c", "cc cc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.sharptipClayForm, 1), new Object[]{ "ccccc", "cc cc", "c c", "ccccc", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.battleaxeClayForm, 1), new Object[]{ "c c c", " ", " ", " ", "c c c", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.ringClayForm, 1), new Object[]{ "ccccc", "cc cc", "c c", "cc cc", "ccccc", 'c', Items.clay_ball});
|
||||
//this.addRecipe(new ItemStack(ModItems.plateClayForm, 1), new Object[]{ "ccccc", "c c", "c c", "c c", "ccccc", 'c', Items.clay_ball});
|
||||
this.addRecipe(new ItemStack(ModItems.sawbladeClayForm, 1), new Object[]{ "ccccc", "ccccc", " ", "c ", "ccccc", 'c', Items.clay_ball});
|
||||
|
||||
Collections.sort(this.recipes, new FormTableRecipeSorter(this));
|
||||
}
|
||||
|
||||
public FormTableShapedRecipes addRecipe(ItemStack p_92103_1_, Object ... p_92103_2_)
|
||||
{
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
if (p_92103_2_[i] instanceof String[])
|
||||
{
|
||||
@SuppressWarnings("cast")
|
||||
String[] astring = (String[])((String[])p_92103_2_[i++]);
|
||||
|
||||
for (int l = 0; l < astring.length; ++l)
|
||||
{
|
||||
String s1 = astring[l];
|
||||
++k;
|
||||
j = s1.length();
|
||||
s = s + s1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (p_92103_2_[i] instanceof String)
|
||||
{
|
||||
String s2 = (String)p_92103_2_[i++];
|
||||
++k;
|
||||
j = s2.length();
|
||||
s = s + s2;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap hashmap;
|
||||
|
||||
for (hashmap = new HashMap(); i < p_92103_2_.length; i += 2)
|
||||
{
|
||||
Character character = (Character)p_92103_2_[i];
|
||||
ItemStack itemstack1 = null;
|
||||
|
||||
if (p_92103_2_[i + 1] instanceof Item)
|
||||
{
|
||||
itemstack1 = new ItemStack((Item)p_92103_2_[i + 1]);
|
||||
}
|
||||
else if (p_92103_2_[i + 1] instanceof Block)
|
||||
{
|
||||
itemstack1 = new ItemStack((Block)p_92103_2_[i + 1], 1, 32767);
|
||||
}
|
||||
else if (p_92103_2_[i + 1] instanceof ItemStack)
|
||||
{
|
||||
itemstack1 = (ItemStack)p_92103_2_[i + 1];
|
||||
}
|
||||
|
||||
hashmap.put(character, itemstack1);
|
||||
}
|
||||
|
||||
ItemStack[] aitemstack = new ItemStack[j * k];
|
||||
|
||||
for (int i1 = 0; i1 < j * k; ++i1)
|
||||
{
|
||||
char c0 = s.charAt(i1);
|
||||
|
||||
if (hashmap.containsKey(Character.valueOf(c0)))
|
||||
{
|
||||
aitemstack[i1] = ((ItemStack)hashmap.get(Character.valueOf(c0))).copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
aitemstack[i1] = null;
|
||||
}
|
||||
}
|
||||
|
||||
FormTableShapedRecipes shapedrecipes = new FormTableShapedRecipes(j, k, aitemstack, p_92103_1_);
|
||||
this.recipes.add(shapedrecipes);
|
||||
return shapedrecipes;
|
||||
}
|
||||
|
||||
public void addShapelessRecipe(ItemStack p_77596_1_, Object ... p_77596_2_)
|
||||
{
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Object[] aobject = p_77596_2_;
|
||||
int i = p_77596_2_.length;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
Object object1 = aobject[j];
|
||||
|
||||
if (object1 instanceof ItemStack)
|
||||
{
|
||||
arraylist.add(((ItemStack)object1).copy());
|
||||
}
|
||||
else if (object1 instanceof Item)
|
||||
{
|
||||
arraylist.add(new ItemStack((Item)object1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(object1 instanceof Block))
|
||||
{
|
||||
throw new RuntimeException("Invalid shapeless recipy!");
|
||||
}
|
||||
|
||||
arraylist.add(new ItemStack((Block)object1));
|
||||
}
|
||||
}
|
||||
|
||||
this.recipes.add(new ShapelessRecipes(p_77596_1_, arraylist));
|
||||
}
|
||||
|
||||
|
||||
public ItemStack findMatchingRecipe(InventoryCrafting p_82787_1_, World p_82787_2_)
|
||||
{
|
||||
int i = 0;
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < p_82787_1_.getSizeInventory(); ++j)
|
||||
{
|
||||
ItemStack itemstack2 = p_82787_1_.getStackInSlot(j);
|
||||
|
||||
if (itemstack2 != null)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
itemstack = itemstack2;
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
itemstack1 = itemstack2;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable())
|
||||
{
|
||||
Item item = itemstack.getItem();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay();
|
||||
int l = j1 + k + item.getMaxDamage() * 5 / 100;
|
||||
int i1 = item.getMaxDamage() - l;
|
||||
|
||||
if (i1 < 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
|
||||
return new ItemStack(itemstack.getItem(), 1, i1);
|
||||
}
|
||||
for (j = 0; j < this.recipes.size(); ++j)
|
||||
{
|
||||
IRecipe irecipe = (IRecipe)this.recipes.get(j);
|
||||
|
||||
if (irecipe.matches(p_82787_1_, p_82787_2_))
|
||||
{
|
||||
return irecipe.getCraftingResult(p_82787_1_);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the List<> of all recipes
|
||||
*/
|
||||
public List getRecipeList()
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public class FormTableRecipeSorter implements Comparator {
|
||||
|
||||
final FormTableCraftManager formTable;
|
||||
|
||||
public FormTableRecipeSorter(FormTableCraftManager ftcraftmanage) {
|
||||
this.formTable = ftcraftmanage;
|
||||
}
|
||||
|
||||
public int compareRecipes(IRecipe irecipe1, IRecipe irecipe2) {
|
||||
return irecipe1 instanceof FormTableShapelessRecipes && irecipe2 instanceof FormTableShapedRecipes ? 1 : (irecipe2 instanceof FormTableShapelessRecipes && irecipe1 instanceof FormTableShapedRecipes ? -1 : (irecipe2.getRecipeSize() > irecipe1.getRecipeSize() ? -1 : (irecipe2.getRecipeSize() > irecipe1.getRecipeSize() ? 1 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
return this.compareRecipes((IRecipe)o1, (IRecipe)o2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FormTableShapedRecipes implements IRecipe
|
||||
{
|
||||
/** How many horizontal slots this recipe is wide. */
|
||||
public final int recipeWidth;
|
||||
/** How many vertical slots this recipe uses. */
|
||||
public final int recipeHeight;
|
||||
/** Is a array of ItemStack that composes the recipe. */
|
||||
public final ItemStack[] recipeItems;
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private ItemStack recipeOutput;
|
||||
private boolean field_92101_f;
|
||||
//private static final String __OBFID = "CL_00000093";
|
||||
|
||||
public FormTableShapedRecipes(int p_i1917_1_, int p_i1917_2_, ItemStack[] p_i1917_3_, ItemStack p_i1917_4_)
|
||||
{
|
||||
this.recipeWidth = p_i1917_1_;
|
||||
this.recipeHeight = p_i1917_2_;
|
||||
this.recipeItems = p_i1917_3_;
|
||||
this.recipeOutput = p_i1917_4_;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_)
|
||||
{
|
||||
for (int i = 0; i <= 5 - this.recipeWidth; ++i)
|
||||
{
|
||||
for (int j = 0; j <= 5 - this.recipeHeight; ++j)
|
||||
{
|
||||
if (this.checkMatch(p_77569_1_, i, j, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.checkMatch(p_77569_1_, i, j, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the region of a crafting inventory is match for the recipe.
|
||||
*/
|
||||
private boolean checkMatch(InventoryCrafting p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
|
||||
{
|
||||
for (int k = 0; k < 5; ++k)
|
||||
{
|
||||
for (int l = 0; l < 5; ++l)
|
||||
{
|
||||
int i1 = k - p_77573_2_;
|
||||
int j1 = l - p_77573_3_;
|
||||
ItemStack itemstack = null;
|
||||
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < this.recipeWidth && j1 < this.recipeHeight)
|
||||
{
|
||||
if (p_77573_4_)
|
||||
{
|
||||
itemstack = this.recipeItems[this.recipeWidth - i1 - 1 + j1 * this.recipeWidth];
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = this.recipeItems[i1 + j1 * this.recipeWidth];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack itemstack1 = p_77573_1_.getStackInRowAndColumn(k, l);
|
||||
|
||||
if (itemstack1 != null || itemstack != null)
|
||||
{
|
||||
if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemstack.getItem() != itemstack1.getItem())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack1.getItemDamage())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_)
|
||||
{
|
||||
ItemStack itemstack = this.getRecipeOutput().copy();
|
||||
|
||||
if (this.field_92101_f)
|
||||
{
|
||||
for (int i = 0; i < p_77572_1_.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack1 = p_77572_1_.getStackInSlot(i);
|
||||
|
||||
if (itemstack1 != null && itemstack1.hasTagCompound())
|
||||
{
|
||||
itemstack.setTagCompound((NBTTagCompound)itemstack1.stackTagCompound.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeWidth * this.recipeHeight;
|
||||
}
|
||||
|
||||
public FormTableShapedRecipes func_92100_c()
|
||||
{
|
||||
this.field_92101_f = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FormTableShapelessRecipes implements IRecipe{
|
||||
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private final ItemStack recipeOutput;
|
||||
/** Is a List of ItemStack that composes the recipe. */
|
||||
public final List recipeItems;
|
||||
//private static final String __OBFID = "CL_00000094";
|
||||
|
||||
public FormTableShapelessRecipes(ItemStack p_i1918_1_, List p_i1918_2_)
|
||||
{
|
||||
this.recipeOutput = p_i1918_1_;
|
||||
this.recipeItems = p_i1918_2_;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_)
|
||||
{
|
||||
ArrayList arraylist = new ArrayList(this.recipeItems);
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
for (int j = 0; j < 5; ++j)
|
||||
{
|
||||
ItemStack itemstack = p_77569_1_.getStackInRowAndColumn(j, i);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
boolean flag = false;
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemstack1 = (ItemStack)iterator.next();
|
||||
|
||||
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == 32767 || itemstack.getItemDamage() == itemstack1.getItemDamage()))
|
||||
{
|
||||
flag = true;
|
||||
arraylist.remove(itemstack1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return arraylist.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_)
|
||||
{
|
||||
return this.recipeOutput.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.recipeItems.size();
|
||||
}
|
||||
}
|
||||
1893
src/main/java/com/kitsu/medievalcraft/crafting/ModCrafting.java
Normal file
1893
src/main/java/com/kitsu/medievalcraft/crafting/ModCrafting.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
package com.kitsu.medievalcraft.crafting;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
public class TestForgeCrafting {
|
||||
|
||||
public static final Hashtable<Integer, Block> blockToCheck = new Hashtable <Integer, Block>(){{
|
||||
|
||||
/*put(0, ModBlocks.myIronIngot);
|
||||
put(1, ModBlocks.filledCrucibleIron);
|
||||
put(2, ModBlocks.emptySoftCrucible);
|
||||
put(3, ModBlocks.ironPlate);
|
||||
put(4, ModBlocks.filledCrucibleIronIngot);
|
||||
put(5, ModBlocks.filledCrucibleDamascus);
|
||||
put(6, ModBlocks.damascusIngot);
|
||||
put(7, ModBlocks.filledLapisCrucible);
|
||||
put(8, ModBlocks.lapisIngot);
|
||||
put(9, ModBlocks.redstoneIngot);
|
||||
put(10, ModBlocks.filledRedstoneCrucible);*/
|
||||
|
||||
}};
|
||||
|
||||
public static final Hashtable<Integer, Integer> cookTable= new Hashtable <Integer, Integer>(){{
|
||||
|
||||
/*put(0, 300);
|
||||
put(1, 1000);
|
||||
put(2, 200);
|
||||
put(3, 250);
|
||||
put(4, 750);
|
||||
put(5, 1200);
|
||||
put(6, 400);
|
||||
put(7, 900);
|
||||
put(8, 400);
|
||||
put(9, 400);
|
||||
put(10, 900);*/
|
||||
}};
|
||||
|
||||
public static final Hashtable<Integer, Block> blockToCook = new Hashtable <Integer, Block>(){{
|
||||
|
||||
/*put(0, ModBlocks.hotIronBlock);
|
||||
put(1, ModBlocks.hotCrucibleIron);
|
||||
put(2, ModBlocks.emptyCookedCrucible);
|
||||
put(3, ModBlocks.hotIronPlate);
|
||||
put(4, ModBlocks.hotCrucibleIron);
|
||||
put(5, ModBlocks.hotCrucibleDamascus);
|
||||
put(6, ModBlocks.hotDamascusIngot);
|
||||
put(7, ModBlocks.hotLapisCrucible);
|
||||
put(8, ModBlocks.hotLapisIngot);
|
||||
put(9, ModBlocks.hotRedstoneIngot);
|
||||
put(10, ModBlocks.hotRedstoneCrucible);*/
|
||||
|
||||
}};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,582 @@
|
||||
package com.kitsu.medievalcraft.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.S2BPacketChangeGameState;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityModelArrow extends EntityArrow implements IProjectile {
|
||||
private int field_145791_d = -1;
|
||||
private int field_145792_e = -1;
|
||||
private int field_145789_f = -1;
|
||||
private Block field_145790_g;
|
||||
private int inData;
|
||||
private boolean inGround;
|
||||
/** 1 if the player can pick up the arrow */
|
||||
public int canBePickedUp;
|
||||
/** Seems to be some sort of timer for animating an arrow. */
|
||||
public int arrowShake;
|
||||
/** The owner of this arrow. */
|
||||
public Entity shootingEntity;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private double damage = 3.0D;
|
||||
/** The amount of knockback an arrow applies when it hits a mob. */
|
||||
private int knockbackStrength;
|
||||
|
||||
public EntityModelArrow(World world)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntityModelArrow(World world, double x, double y, double z)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(x, y, z);
|
||||
this.yOffset = 0.0F;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public EntityModelArrow(World world, EntityLivingBase player, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = player;
|
||||
|
||||
if (player instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.posY = player.posY + (double)player.getEyeHeight() + 0.10000000149011612D;
|
||||
double d0 = p_i1755_3_.posX - player.posX;
|
||||
double d1 = p_i1755_3_.boundingBox.minY + (double)(p_i1755_3_.height / 3.0F) - this.posY;
|
||||
double d2 = p_i1755_3_.posZ - player.posZ;
|
||||
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
|
||||
|
||||
if (d3 >= 1.0E-7D)
|
||||
{
|
||||
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
|
||||
double d4 = d0 / d3;
|
||||
double d5 = d2 / d3;
|
||||
this.setLocationAndAngles(player.posX + d4, this.posY, player.posZ + d5, f2, f3);
|
||||
this.yOffset = 0.0F;
|
||||
float f4 = (float)d3 * 0.2F;
|
||||
this.setThrowableHeading(d0, d1 + (double)f4, d2, p_i1755_4_, p_i1755_5_);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public EntityModelArrow(World world, EntityLivingBase player, float p_i1756_3_)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = player;
|
||||
|
||||
if (player instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setLocationAndAngles(player.posX, player.posY + (double)player.getEyeHeight(), player.posZ, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
this.posX += (player.getLookVec().xCoord);
|
||||
//this.posY -= 0.10000000149011612D;
|
||||
this.posZ += (player.getLookVec().zCoord);
|
||||
//this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
this.posY += player.getLookVec().yCoord;
|
||||
if(player.getLookVec().yCoord < 0){
|
||||
this.posY += player.getLookVec().yCoord * 2;
|
||||
}
|
||||
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
|
||||
//this.setSize(0.5F, 0.5F);
|
||||
//this.setLocationAndAngles(player.posX, player.posY + (double)player.getEyeHeight(), player.posZ, player.rotationYaw, player.rotationPitch);
|
||||
//this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
//this.posY -= 0.10000000149011612D;
|
||||
//this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
//this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_)
|
||||
{
|
||||
float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_);
|
||||
p_70186_1_ /= (double)f2;
|
||||
p_70186_3_ /= (double)f2;
|
||||
p_70186_5_ /= (double)f2;
|
||||
p_70186_1_ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
p_70186_3_ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
p_70186_5_ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
p_70186_1_ *= (double)p_70186_7_;
|
||||
p_70186_3_ *= (double)p_70186_7_;
|
||||
p_70186_5_ *= (double)p_70186_7_;
|
||||
this.motionX = p_70186_1_;
|
||||
this.motionY = p_70186_3_;
|
||||
this.motionZ = p_70186_5_;
|
||||
float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, (double)f3) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_)
|
||||
{
|
||||
this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
|
||||
this.setRotation(p_70056_7_, p_70056_8_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
|
||||
{
|
||||
this.motionX = p_70016_1_ ;
|
||||
this.motionY = p_70016_3_ ;
|
||||
this.motionZ = p_70016_5_ ;
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, (double)f) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch;
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
//this.getEntityData().setInteger("blockX", this.field_145791_d);
|
||||
|
||||
if (block.getMaterial() != Material.air)
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.arrowShake > 0)
|
||||
{
|
||||
--this.arrowShake;
|
||||
}
|
||||
|
||||
if (this.inGround)
|
||||
{
|
||||
int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block == this.field_145790_g && j == this.inData)
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
if (this.ticksInGround == -1)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.ticksInAir;
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
|
||||
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
int i;
|
||||
float f1;
|
||||
|
||||
for (i = 0; i < list.size(); ++i)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(i);
|
||||
|
||||
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
|
||||
{
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
|
||||
|
||||
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
|
||||
{
|
||||
movingobjectposition = null;
|
||||
}
|
||||
}
|
||||
|
||||
float f2;
|
||||
float f4;
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
int k = MathHelper.ceiling_double_int((double)f2 * this.damage);
|
||||
|
||||
DamageSource damagesource = null;
|
||||
|
||||
if (this.shootingEntity == null)
|
||||
{
|
||||
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
damagesource = DamageSource.causeThrownDamage(this, this.shootingEntity);
|
||||
}
|
||||
|
||||
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
movingobjectposition.entityHit.setFire(5);
|
||||
}
|
||||
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k))
|
||||
{
|
||||
if (movingobjectposition.entityHit instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);
|
||||
}
|
||||
|
||||
if (this.knockbackStrength > 0)
|
||||
{
|
||||
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if (f4 > 0.0F)
|
||||
{
|
||||
movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase)
|
||||
{
|
||||
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
|
||||
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
|
||||
}
|
||||
}
|
||||
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.motionX *= -0.10000000149011612D;
|
||||
this.motionY *= -0.10000000149011612D;
|
||||
this.motionZ *= -0.10000000149011612D;
|
||||
this.rotationYaw += 180.0F;
|
||||
this.prevRotationYaw += 180.0F;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
this.field_145791_d = movingobjectposition.blockX;
|
||||
this.field_145792_e = movingobjectposition.blockY;
|
||||
this.field_145789_f = movingobjectposition.blockZ;
|
||||
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));
|
||||
this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));
|
||||
this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
|
||||
|
||||
if (this.field_145790_g.getMaterial() != Material.air)
|
||||
{
|
||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
|
||||
{
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
|
||||
{
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
|
||||
{
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float f3 = 0.99F;
|
||||
f1 = 0.05F;
|
||||
|
||||
if (this.isInWater())
|
||||
{
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
f4 = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f3 = 0.8F;
|
||||
}
|
||||
|
||||
if (this.isWet())
|
||||
{
|
||||
this.extinguish();
|
||||
}
|
||||
|
||||
this.motionX *= (double)f3;
|
||||
this.motionY *= (double)f3;
|
||||
this.motionZ *= (double)f3;
|
||||
this.motionY -= (double)f1;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.func_145775_I();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
|
||||
{
|
||||
p_70014_1_.setShort("xTile", (short)this.field_145791_d);
|
||||
p_70014_1_.setShort("yTile", (short)this.field_145792_e);
|
||||
p_70014_1_.setShort("zTile", (short)this.field_145789_f);
|
||||
p_70014_1_.setShort("life", (short)this.ticksInGround);
|
||||
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g));
|
||||
p_70014_1_.setByte("inData", (byte)this.inData);
|
||||
p_70014_1_.setByte("shake", (byte)this.arrowShake);
|
||||
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
p_70014_1_.setByte("pickup", (byte)this.canBePickedUp);
|
||||
p_70014_1_.setDouble("damage", this.damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
|
||||
{
|
||||
this.field_145791_d = p_70037_1_.getShort("xTile");
|
||||
this.field_145792_e = p_70037_1_.getShort("yTile");
|
||||
this.field_145789_f = p_70037_1_.getShort("zTile");
|
||||
this.ticksInGround = p_70037_1_.getShort("life");
|
||||
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
||||
this.inData = p_70037_1_.getByte("inData") & 255;
|
||||
this.arrowShake = p_70037_1_.getByte("shake") & 255;
|
||||
this.inGround = p_70037_1_.getByte("inGround") == 1;
|
||||
|
||||
if (p_70037_1_.hasKey("damage", 99))
|
||||
{
|
||||
this.damage = p_70037_1_.getDouble("damage");
|
||||
}
|
||||
|
||||
if (p_70037_1_.hasKey("pickup", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getByte("pickup");
|
||||
}
|
||||
else if (p_70037_1_.hasKey("player", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by a player entity when they collide with an entity
|
||||
*/
|
||||
public void onCollideWithPlayer(EntityPlayer p_70100_1_)
|
||||
{
|
||||
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
|
||||
{
|
||||
boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && p_70100_1_.capabilities.isCreativeMode;
|
||||
|
||||
if (this.canBePickedUp == 1 && !p_70100_1_.inventory.addItemStackToInventory(new ItemStack(ModItems.itemModelArrow, 1)))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
p_70100_1_.onItemPickup(this, 1);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||
* prevent them from trampling crops
|
||||
*/
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public void setDamage(double p_70239_1_)
|
||||
{
|
||||
this.damage = p_70239_1_;
|
||||
}
|
||||
|
||||
public double getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of knockback the arrow applies when it hits a mob.
|
||||
*/
|
||||
public void setKnockbackStrength(int p_70240_1_)
|
||||
{
|
||||
this.knockbackStrength = p_70240_1_;
|
||||
}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
public boolean canAttackWithItem()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/kitsu/medievalcraft/entity/EntityShit.java
Normal file
60
src/main/java/com/kitsu/medievalcraft/entity/EntityShit.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.kitsu.medievalcraft.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityShit extends EntityThrowable {
|
||||
|
||||
public EntityShit(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityShit(World world, EntityLivingBase entity)
|
||||
{
|
||||
super(world, entity);
|
||||
}
|
||||
|
||||
//@SideOnly(Side.CLIENT)
|
||||
public EntityShit(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition object) {
|
||||
|
||||
if (object.entityHit != null) {
|
||||
|
||||
float impactDamage = 1.0F;
|
||||
|
||||
object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), impactDamage);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.setDead();
|
||||
//this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(ModItems.itemShit)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.kitsu.medievalcraft.entity;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemHeavyMace;
|
||||
|
||||
public class EntityTester extends EntityThrowable {
|
||||
|
||||
private Vec3 vectest;
|
||||
private Vec3 vecplayer;
|
||||
|
||||
|
||||
public EntityTester(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityTester(World world, EntityLivingBase entity)
|
||||
{
|
||||
super(world, entity);
|
||||
}
|
||||
|
||||
//@SideOnly(Side.CLIENT)
|
||||
public EntityTester(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition object) {
|
||||
|
||||
if(Minecraft.getMinecraft().theWorld.difficultySetting.getDifficultyId() == 3){
|
||||
if(object.entityHit != null){
|
||||
if((ItemHeavyMace.attack == true)){
|
||||
vecplayer = ItemHeavyMace.vecp;
|
||||
vectest = vectest.createVectorHelper(object.entityHit.posX, object.entityHit.posY, object.entityHit.posZ);
|
||||
if((vecplayer.distanceTo(vectest) < 6)){
|
||||
ItemHeavyMace.damage = true;
|
||||
object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 8);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!this.worldObj.isRemote){
|
||||
this.setDead();
|
||||
//this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(ModItems.itemShit)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.kitsu.medievalcraft.events;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
|
||||
public class BucketHandle {
|
||||
public static BucketHandle INSTANCE = new BucketHandle();
|
||||
public Map<Block, Item> buckets = new HashMap<Block, Item>();
|
||||
|
||||
private BucketHandle() {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent event) {
|
||||
|
||||
ItemStack result = fillCustomBucket(event.world, event.target);
|
||||
|
||||
if (result == null)
|
||||
return;
|
||||
|
||||
event.result = result;
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
|
||||
private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) {
|
||||
|
||||
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
Item bucket = buckets.get(block);
|
||||
if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) {
|
||||
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
|
||||
return new ItemStack(bucket);
|
||||
} //else
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
630
src/main/java/com/kitsu/medievalcraft/events/EventHandle.java
Normal file
630
src/main/java/com/kitsu/medievalcraft/events/EventHandle.java
Normal file
@@ -0,0 +1,630 @@
|
||||
package com.kitsu.medievalcraft.events;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
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.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.BiomeDictionary.Type;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.ForgeHammer;
|
||||
import com.kitsu.medievalcraft.util.ShieldSwitchTable;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EventHandle {
|
||||
|
||||
//private int wKey, sKey;
|
||||
//public static int longbowD;
|
||||
public int longbowTicks;
|
||||
//public static boolean longbowUse;
|
||||
public static boolean mobcheck, weaponUse;
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void zombieJoinsEvent(EntityJoinWorldEvent event){
|
||||
if(event.entity instanceof EntityRazorBack){
|
||||
event.entity.po
|
||||
System.out.println(event.entity.posX + ":" + event.entity.posy + ":" + event.entity.posZ);
|
||||
}
|
||||
}*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void ironOreJungleEvent (HarvestDropsEvent event){
|
||||
if(BiomeDictionary.isBiomeOfType(event.world.getBiomeGenForCoords(event.x, event.z), Type.JUNGLE)){
|
||||
if(event.block.equals(Blocks.iron_ore)){
|
||||
event.drops.clear();
|
||||
ItemStack testStack = new ItemStack(ModBlocks.wootzOre);
|
||||
event.drops.add(testStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void longbowUseEvent (PlayerUseItemEvent.Tick event) {
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
if(player.worldObj.isRemote == true){
|
||||
|
||||
if(player.getItemInUse().getItem().equals(ModItems.longbow)){
|
||||
longbowTicks = player.getItemInUseDuration();
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
|
||||
if((longbowTicks > 0) && (longbowTicks <=10)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 1);
|
||||
}
|
||||
if((longbowTicks > 10) && (longbowTicks <=20)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 2);
|
||||
}
|
||||
if((longbowTicks > 20) && (longbowTicks <=30)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 3);
|
||||
}
|
||||
if((longbowTicks > 30) && (longbowTicks <=40)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 4);
|
||||
}
|
||||
if((longbowTicks > 40) && (longbowTicks <=50)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 5);
|
||||
}
|
||||
if((longbowTicks > 50) && (longbowTicks <=60)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 6);
|
||||
}
|
||||
if((longbowTicks > 60) && (longbowTicks <=70)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 7);
|
||||
}
|
||||
if((longbowTicks > 70) && (longbowTicks <=80)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 8);
|
||||
}
|
||||
if((longbowTicks > 80) && (longbowTicks <=90)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 9);
|
||||
}
|
||||
if(longbowTicks == 99){
|
||||
player.playSound((Main.MODID + ":tautBow"), 0.8F, 1.0F);
|
||||
//player.worldObj.playSoundAtEntity(player, (Main.MODID + ":tautBow"), 0.8F, 1.0F);
|
||||
}
|
||||
if((longbowTicks > 90) && (longbowTicks <=100)){
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 10);
|
||||
}
|
||||
|
||||
if((longbowTicks > 100)){
|
||||
longbowTicks = 100;
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("D", 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getMouseEvent(MouseEvent event){
|
||||
if((event.button == 0) && (event.buttonstate == true)){
|
||||
ForgeHammer.forgeHammerLeftClick = true;
|
||||
}
|
||||
if(event.buttonstate == false){
|
||||
ForgeHammer.forgeHammerLeftClick = false;
|
||||
}
|
||||
//System.out.println("Button: " + event.button);
|
||||
//System.out.println("ButtonState: " + event.buttonstate);
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void splitLogEvent(PlayerInteractEvent event){
|
||||
if(event.entityPlayer instanceof EntityPlayer){
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
if((event.useBlock.equals(ModBlocks.cleanAcacia))
|
||||
||(event.useBlock.equals(ModBlocks.cleanBirch))
|
||||
||(event.useBlock.equals(ModBlocks.cleanDarkOak))
|
||||
||(event.useBlock.equals(ModBlocks.cleanJungle))
|
||||
||(event.useBlock.equals(ModBlocks.cleanOak))
|
||||
||(event.useBlock.equals(ModBlocks.cleanSpruce))){
|
||||
System.out.println("Player Used Wood");
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
System.out.println(player.inventory.getCurrentItem().getClass());
|
||||
if(player.getItemInUse().getItem() instanceof ItemAxe){
|
||||
player.swingItem();
|
||||
if(!event.world.isRemote){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.splitLog, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void emptyHandBarkEvent(PlayerInteractEvent event) {
|
||||
if(!event.entity.worldObj.isRemote){
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
//Block isEmpty = event.world.getBlock(event.x, event.y + 1, event.z);
|
||||
ItemStack itemStack = new ItemStack(ModItems.itemBark);
|
||||
if((player.inventory.getCurrentItem() == null)) {
|
||||
if((event.action == event.action.RIGHT_CLICK_BLOCK ) && ((test == Blocks.log)||test == Blocks.log2) ) { //&& (test == ModBlocks.testForge) && (isEmpty == Blocks.air)
|
||||
if(test == Blocks.log){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.15F, 0.85F);
|
||||
int woodMeta = event.world.getBlockMetadata(event.x,event.y, event.z);
|
||||
if(woodMeta == 0 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanOak, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 4 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanOak, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 8 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanOak, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 1 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanSpruce, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 5 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanSpruce, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 9 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanSpruce, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 2 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanBirch, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 6 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanBirch, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 10 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanBirch, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 3 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanJungle, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 7 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanJungle, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 11 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanJungle, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
}
|
||||
if(test == Blocks.log2){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.2F, 0.8F);
|
||||
int woodMeta = event.world.getBlockMetadata(event.x, event.y, event.z);
|
||||
if(woodMeta == 0 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanAcacia, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 4 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanAcacia, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 8 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanAcacia, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 1 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanDarkOak, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 5 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanDarkOak, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 9 && event.world.rand.nextInt(9)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanDarkOak, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 1 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void flintKnappedEvent(PlayerInteractEvent event) {
|
||||
if(!event.entity.worldObj.isRemote){
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
ItemStack flint = new ItemStack(Items.flint);
|
||||
ItemStack flintKnapped = new ItemStack(ModItems.flintKnapped, 1 + event.world.rand.nextInt(3), 0);
|
||||
//if(player.isSneaking()){
|
||||
if((player.inventory.getCurrentItem() != null)) {
|
||||
if((player.inventory.getCurrentItem().getItem().equals(Items.flint)) && (test==Blocks.stone)){
|
||||
|
||||
if(player.isSwingInProgress == false){
|
||||
player.worldObj.playSoundAtEntity(player, "mob.chicken.step", 1.0f, 1.0f);
|
||||
player.swingItem();
|
||||
if((event.world.rand.nextInt(4)==0)){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
if((event.world.rand.nextInt(2)==0)){
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y+1, event.z, flintKnapped));
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void flintHandBarkEvent(PlayerInteractEvent event) {
|
||||
if(!event.entity.worldObj.isRemote){
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
//Block isEmpty = event.world.getBlock(event.x, event.y + 1, event.z);
|
||||
ItemStack itemStack = new ItemStack(ModItems.itemBark);
|
||||
ItemStack flint = new ItemStack(ModItems.flintKnapped);
|
||||
//if(player.isSneaking()){
|
||||
if((player.inventory.getCurrentItem() != null)) {
|
||||
if((player.inventory.getCurrentItem().getUnlocalizedName().contains("flintKnapped"))){
|
||||
if((event.action == event.action.RIGHT_CLICK_BLOCK ) && ((test == Blocks.log)||test == Blocks.log2)) {
|
||||
if(test == Blocks.log){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.15F, 0.85F);
|
||||
int woodMeta = event.world.getBlockMetadata(event.x,event.y, event.z);
|
||||
if(woodMeta == 0 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanOak, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 4 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanOak, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 8 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanOak, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 1 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanSpruce, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 5 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanSpruce, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 9 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanSpruce, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 2 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanBirch, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 6 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanBirch, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 10 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanBirch, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 3 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanJungle, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 7 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanJungle, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 11 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y,event.z, ModBlocks.cleanJungle, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
}
|
||||
if(test == Blocks.log2){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.2F, 0.8F);
|
||||
int woodMeta = event.world.getBlockMetadata(event.x, event.y, event.z);
|
||||
if(woodMeta == 0 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanAcacia, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 4 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanAcacia, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 8 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanAcacia, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 1 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanDarkOak, 0, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 5 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanDarkOak, 4, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
if(woodMeta == 9 && event.world.rand.nextInt(6)==0){
|
||||
event.world.setBlock(event.x, event.y, event.z, ModBlocks.cleanDarkOak, 8, 2);
|
||||
event.world.spawnEntityInWorld(new EntityItem(event.world, event.x, event.y, event.z, new ItemStack(ModItems.itemBark, 2 + event.world.rand.nextInt(2), 0)));
|
||||
}
|
||||
}
|
||||
if(event.world.rand.nextInt(50)==0){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void myDiamondPlayerInteractEvent(PlayerInteractEvent event) {
|
||||
if(!event.entity.worldObj.isRemote){
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
//Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
//Block isEmpty = event.world.getBlock(event.x, event.y + 1, event.z);
|
||||
ItemStack itemStack = new ItemStack(Items.diamond);
|
||||
if(player.isSneaking()){
|
||||
if((player.inventory.getCurrentItem() != null)) {
|
||||
if((player.inventory.getCurrentItem().isItemEqual(itemStack))){
|
||||
if((event.action == event.action.RIGHT_CLICK_BLOCK ) ) { //&& (test == ModBlocks.testForge) && (isEmpty == Blocks.air)
|
||||
|
||||
if(event.world.getBlock(event.x, event.y + 1, event.z).equals(Blocks.air)){
|
||||
event.world.setBlock(event.x, event.y + 1, event.z, ModBlocks.myDiamond, 0, 2);
|
||||
player.inventory.consumeInventoryItem(Items.diamond);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void myEmeraldPlayerInteractEvent(PlayerInteractEvent event) {
|
||||
if(!event.entity.worldObj.isRemote){
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
//Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
//Block isEmpty = event.world.getBlock(event.x, event.y + 1, event.z);
|
||||
ItemStack itemStack = new ItemStack(Items.emerald);
|
||||
if(player.isSneaking()){
|
||||
if((player.inventory.getCurrentItem() != null)) {
|
||||
if((player.inventory.getCurrentItem().isItemEqual(itemStack)) && (player.inventory.getStackInSlot(player.inventory.currentItem).stackSize >= 2)){
|
||||
if((event.action == event.action.RIGHT_CLICK_BLOCK ) ) { //&& (test == ModBlocks.testForge) && (isEmpty == Blocks.air)
|
||||
if(event.world.getBlock(event.x, event.y + 1, event.z).equals(Blocks.air)){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
event.world.setBlock(event.x, event.y + 1, event.z, ModBlocks.myEmerald, 0, 2);
|
||||
player.inventory.consumeInventoryItem(Items.emerald);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdateEventShit(LivingUpdateEvent event) {
|
||||
//eventLongbowTicks = ItemLongbow.longbowTicks;
|
||||
//System.out.println(eventLongbowTicks);
|
||||
//MAKE COWS SHIT
|
||||
//Differentiates Client and Server
|
||||
if (!event.entity.worldObj.isRemote) {
|
||||
//Default to 100000
|
||||
if ( rand.nextInt(1500) == 0 ) {
|
||||
//Checks to see if the LivingUpdate is being applied to cow, if so:
|
||||
if (event.entity instanceof EntityCow) {
|
||||
event.entityLiving.dropItem(ModItems.itemShit, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onLivingUpdateLongSword (LivingUpdateEvent event) {
|
||||
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
|
||||
if (player.isUsingItem() == true) {
|
||||
useItem = player.inventory.getCurrentItem();
|
||||
j = useItem.getItemDamage();
|
||||
|
||||
if(useItem.isItemEqual(new ItemStack(ModItems.longSword, OreDictionary.WILDCARD_VALUE, j))) {
|
||||
|
||||
player.inventory.changeCurrentItem(1);
|
||||
|
||||
if (player.inventory.getCurrentItem() != null) {
|
||||
switchedItem = player.inventory.getCurrentItem();
|
||||
i = switchedItem.getItemDamage();
|
||||
|
||||
if ((switchedItem.isItemEqual(new ItemStack(ModItems.woodenShield, OreDictionary.WILDCARD_VALUE, i))) || (switchedItem.isItemEqual(new ItemStack(ModItems.ironShield, OreDictionary.WILDCARD_VALUE, i)))){
|
||||
|
||||
} else player.inventory.changeCurrentItem(-1);
|
||||
|
||||
} else player.inventory.changeCurrentItem(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/*@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onPlayerUpdateMaceWoodenShield (LivingUpdateEvent event) {
|
||||
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
|
||||
if (player.isUsingItem() == true) {
|
||||
useItem2 = player.inventory.getCurrentItem();
|
||||
j = useItem2.getItemDamage();
|
||||
|
||||
if(useItem2.isItemEqual(new ItemStack(ModItems.heavyMace, OreDictionary.WILDCARD_VALUE, j))) {
|
||||
|
||||
player.inventory.changeCurrentItem(1);
|
||||
|
||||
if (player.inventory.getCurrentItem() != null) {
|
||||
switchedItem2 = player.inventory.getCurrentItem();
|
||||
i = switchedItem2.getItemDamage();
|
||||
|
||||
if ((switchedItem2.isItemEqual(new ItemStack(ModItems.woodenShield, OreDictionary.WILDCARD_VALUE, i))) || (switchedItem2.isItemEqual(new ItemStack(ModItems.ironShield, OreDictionary.WILDCARD_VALUE, i)))){
|
||||
|
||||
} else player.inventory.changeCurrentItem(-1);
|
||||
|
||||
} else player.inventory.changeCurrentItem(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void SwordToShieldSwitch (LivingUpdateEvent event) {
|
||||
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
|
||||
if(player.isUsingItem() == true){
|
||||
if((checkWeapon(player.getItemInUse().getItem())) == true){
|
||||
if(weaponUse == true){
|
||||
if(player.inventory.currentItem != 0){
|
||||
int a = player.inventory.currentItem;
|
||||
if(player.inventory.getStackInSlot(a-1) != null){
|
||||
if((checkShield(player.inventory.getStackInSlot(a-1).getItem())) == true){
|
||||
player.inventory.changeCurrentItem(+1);
|
||||
weaponUse = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkWeapon(Item testItem){
|
||||
for(int i = 0; i < ShieldSwitchTable.weapons.size(); i++){
|
||||
if(testItem == ShieldSwitchTable.weapons.get(i)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private Boolean checkShield(Item testItem){
|
||||
for(int i = 0; i < ShieldSwitchTable.shields.size(); i++){
|
||||
if(testItem == ShieldSwitchTable.shields.get(i)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerHurtShield (LivingHurtEvent event) {
|
||||
|
||||
if (event.entity instanceof EntityPlayer && event.ammount > 0) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
Entity mobEntity = event.source.getEntity();
|
||||
String mobString = event.source.getDamageType();
|
||||
//System.out.println(mobEntity);
|
||||
//System.out.println(mobString);
|
||||
|
||||
if(player.isUsingItem()==true){
|
||||
|
||||
if (player.inventory.getCurrentItem().getItem().equals(checkShield(player.inventory.getCurrentItem().getItem()))) {
|
||||
if ((mobString.equals("explosion")) || (mobString.equals("thrown")) || (mobString.equals("arrow") || (mobString.equals("player")) || (mobString.equals("mob")) || (mobString.equals("fireball")))) {
|
||||
|
||||
Vec3 vec3 = player.getLook(1.0F).normalize();
|
||||
Vec3 vec31 = Vec3.createVectorHelper(mobEntity.posX - player.posX, mobEntity.boundingBox.minY + mobEntity.height / 2.0F - (player.posY + player.getEyeHeight()), mobEntity.posZ - player.posZ);
|
||||
double d0 = vec31.lengthVector();
|
||||
vec31 = vec31.normalize();
|
||||
double d1 = vec3.dotProduct(vec31);
|
||||
double d2 = 1.0D - 0.025D / d0;
|
||||
|
||||
if (d1 + 0.3 > d2) {
|
||||
|
||||
if(player.inventory.getCurrentItem().getItem().equals(ModItems.woodenShield)){
|
||||
if(event.ammount > 1.5F){
|
||||
event.ammount = event.ammount-2F;
|
||||
} else event.ammount = 0;
|
||||
player.getCurrentEquippedItem().damageItem(2, player);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":woodshieldbash", 1.0F, 1.0F);
|
||||
//event.entityLiving.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 0, true));
|
||||
if (mobString.equals("explosion") && rand.nextInt(5) == 1) {
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem().getItem().equals(ModItems.ironShield)){
|
||||
if(event.ammount > 4F){
|
||||
event.ammount = event.ammount-4F;
|
||||
} else event.ammount = 0;
|
||||
player.getCurrentEquippedItem().damageItem(4, player);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":ironShieldBash", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
38
src/main/java/com/kitsu/medievalcraft/gui/GuiForgeAnvil.java
Normal file
38
src/main/java/com/kitsu/medievalcraft/gui/GuiForgeAnvil.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.kitsu.medievalcraft.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.contain.ContainerForgeAnvil;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
|
||||
public class GuiForgeAnvil extends GuiContainer {
|
||||
private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/forgeovengui.png");
|
||||
|
||||
public GuiForgeAnvil(InventoryPlayer inventoryPlayer, TileEntityAnvilForge tileEntity) {
|
||||
super(new ContainerForgeAnvil(inventoryPlayer, tileEntity));
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
//String name = "Forge";
|
||||
|
||||
//this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
//this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
}
|
||||
48
src/main/java/com/kitsu/medievalcraft/gui/GuiFormTable.java
Normal file
48
src/main/java/com/kitsu/medievalcraft/gui/GuiFormTable.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.kitsu.medievalcraft.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.contain.ContainerFormTable;
|
||||
|
||||
public class GuiFormTable extends GuiContainer {
|
||||
|
||||
private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/formtablegui.png");
|
||||
|
||||
public GuiFormTable(InventoryPlayer playerinv, World world, int x, int y, int z) {
|
||||
|
||||
super(new ContainerFormTable(playerinv, world, x, y, z));
|
||||
this.xSize = 200;
|
||||
this.ySize = 200;
|
||||
|
||||
}
|
||||
|
||||
public void onGuiClosed(){
|
||||
super.onGuiClosed();
|
||||
}
|
||||
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
//Name xstart ystart color
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("Form Table"), 100, 5, 0xFFFFFF);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
68
src/main/java/com/kitsu/medievalcraft/gui/GuiHandler.java
Normal file
68
src/main/java/com/kitsu/medievalcraft/gui/GuiHandler.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.kitsu.medievalcraft.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.contain.ContainerForgeAnvil;
|
||||
import com.kitsu.medievalcraft.contain.ContainerFormTable;
|
||||
import com.kitsu.medievalcraft.contain.ContainerSolidFilter;
|
||||
import com.kitsu.medievalcraft.contain.ContainerTestForge;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityTestForge;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static final int guiIDformTable = 1;
|
||||
public static final int guiIDforge = 2;
|
||||
public static final int guiIDforgeAnvil = 3;
|
||||
public static final int guiIDsolidFilter = 4;
|
||||
|
||||
//returns an instance of the Container you made earlier
|
||||
@Override
|
||||
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
if (id == guiIDformTable) {
|
||||
return id == guiIDformTable && world.getBlock(x, y, z) == ModBlocks.formtable ? new ContainerFormTable(player.inventory, world, x, y, z) : null;
|
||||
}
|
||||
if (entity instanceof TileEntityTestForge) {
|
||||
return new ContainerTestForge(player.inventory, (TileEntityTestForge) entity);
|
||||
}
|
||||
if (entity instanceof TileEntityAnvilForge) {
|
||||
return new ContainerForgeAnvil(player.inventory, (TileEntityAnvilForge) entity);
|
||||
}
|
||||
if (entity instanceof TileEntitySolidFilter) {
|
||||
return new ContainerSolidFilter(player.inventory, (TileEntitySolidFilter) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//returns an instance of the Gui you made earlier
|
||||
@Override
|
||||
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
if (id == guiIDformTable) {
|
||||
return id == guiIDformTable && world.getBlock(x, y, z) == ModBlocks.formtable ? new GuiFormTable(player.inventory, world, x, y, z) : null;
|
||||
}
|
||||
if (entity instanceof TileEntityTestForge) {
|
||||
return new GuiTestForge(player.inventory, (TileEntityTestForge) entity);
|
||||
}
|
||||
if (entity instanceof TileEntityAnvilForge) {
|
||||
return new GuiForgeAnvil(player.inventory, (TileEntityAnvilForge) entity);
|
||||
}
|
||||
if (entity instanceof TileEntitySolidFilter) {
|
||||
return new GuiSolidFilter(player.inventory, (TileEntitySolidFilter) entity);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.kitsu.medievalcraft.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.contain.ContainerSolidFilter;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter;
|
||||
|
||||
public class GuiSolidFilter extends GuiContainer {
|
||||
|
||||
private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/solidfiltergui.png");
|
||||
|
||||
public GuiSolidFilter(InventoryPlayer inventoryPlayer, TileEntitySolidFilter tileEntity) {
|
||||
super(new ContainerSolidFilter(inventoryPlayer, tileEntity));
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
//String name = "Forge";
|
||||
|
||||
//this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
//this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
38
src/main/java/com/kitsu/medievalcraft/gui/GuiTestForge.java
Normal file
38
src/main/java/com/kitsu/medievalcraft/gui/GuiTestForge.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.kitsu.medievalcraft.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.contain.ContainerTestForge;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityTestForge;
|
||||
|
||||
public class GuiTestForge extends GuiContainer {
|
||||
private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/forgeovengui.png");
|
||||
|
||||
public GuiTestForge(InventoryPlayer inventoryPlayer, TileEntityTestForge tileEntity) {
|
||||
super(new ContainerTestForge(inventoryPlayer, tileEntity));
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
//String name = "Forge";
|
||||
|
||||
//this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
//this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
}
|
||||
13
src/main/java/com/kitsu/medievalcraft/item/FluidBucket.java
Normal file
13
src/main/java/com/kitsu/medievalcraft/item/FluidBucket.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.kitsu.medievalcraft.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
|
||||
public class FluidBucket extends ItemBucket {
|
||||
|
||||
public FluidBucket(Block p_i45331_1_) {
|
||||
super(p_i45331_1_);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*package com.kitsu.medievalcraft.item;
|
||||
|
||||
import com.kitsu.medievalcraft.CustomTab;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemEditableBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class ItemClayFormBook extends ItemEditableBook {
|
||||
private String name = "clayFormBook";
|
||||
|
||||
public ItemClayFormBook()
|
||||
{
|
||||
super();
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setUnlocalizedName(name);
|
||||
LanguageRegistry.addName(this, name);
|
||||
this.setTextureName(name);
|
||||
this.setMaxStackSize(1);
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
private NBTTagList putTableOfContents(NBTTagList bookTagList) {
|
||||
// Create NBT data and add to the book
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
NBTTagList bookPages = new NBTTagList();
|
||||
|
||||
bookTagList.appendTag(new NBTTagString("Test Book"));
|
||||
|
||||
return bookTagList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int unknownInt, boolean unknownBool)
|
||||
{
|
||||
NBTTagList bookTagList = new NBTTagList();
|
||||
|
||||
bookTagList = putTableOfContents(bookTagList);
|
||||
itemStack.setTagInfo("pages", bookTagList);
|
||||
itemStack.setTagInfo("author", new NBTTagString("delpi"));
|
||||
itemStack.setTagInfo("title", new NBTTagString("Cloth Uses"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player) {
|
||||
//stack = new ItemStack(ModItems.clayFormBook);
|
||||
player.displayGUIBook(stack);
|
||||
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}*/
|
||||
800
src/main/java/com/kitsu/medievalcraft/item/ModItems.java
Normal file
800
src/main/java/com/kitsu/medievalcraft/item/ModItems.java
Normal file
@@ -0,0 +1,800 @@
|
||||
package com.kitsu.medievalcraft.item;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.FireBow;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.FlintSaw;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.ForgeHammer;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.InlayHammer;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.IronSaw;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.LeatherShears;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.SlottedTongs;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.WorkBlade;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.filters.CoarseFilter;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.filters.FineFilter;
|
||||
import com.kitsu.medievalcraft.item.craftingtools.filters.MediumFilter;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronAxeForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronBattleAxeForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronDaggerForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronHandleForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronHoeForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronLongswordForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronMaceHeadForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronPickaxeForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronRingForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronSawBladeForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronSharpTipForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronShortSwordForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronSpadeForm;
|
||||
import com.kitsu.medievalcraft.item.forms.iron.IronSpearTipForm;
|
||||
import com.kitsu.medievalcraft.item.misc.ItemBark;
|
||||
import com.kitsu.medievalcraft.item.misc.ItemSmallBarrelLid;
|
||||
import com.kitsu.medievalcraft.item.misc.RawCuredLeather;
|
||||
import com.kitsu.medievalcraft.item.throwable.ItemShit;
|
||||
import com.kitsu.medievalcraft.item.throwable.ItemTester;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomHandleIronLumberAxe;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomHandleIronPick;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomHandleIronShovel;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomHandleStrongIronLumberAxe;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomHandleStrongIronPick;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomHandleStrongIronShovel;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomIronLumberAxe;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomIronPick;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomIronShovel;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomStrongIronLumberAxe;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomStrongIronPick;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomStrongIronShovel;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomWeakIronLumberAxe;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomWeakIronPick;
|
||||
import com.kitsu.medievalcraft.item.tools.CustomWeakIronShovel;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemBattleAxe;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemGladius;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemHeavyMace;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemIronShield;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemIronTippedModelArrow;
|
||||
//import com.kitsu.medievalcraft.item.weapon.ItemIronShield;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemLongSword;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemLongbow;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemModelArrow;
|
||||
import com.kitsu.medievalcraft.item.weapon.ItemWoodenShield;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
public final class ModItems {
|
||||
|
||||
public static Item slottedTongs;
|
||||
|
||||
|
||||
public static Item leatherStrap;
|
||||
public static Item wovenLeather;
|
||||
public static Item ironChunk;
|
||||
public static Item hotironChunk;
|
||||
public static Item ironRing;
|
||||
public static Item itemShit;
|
||||
public static Item itemTester;
|
||||
public static Item linkedRings;
|
||||
public static Item ironRingMesh;
|
||||
public static Item chainMailPlate;
|
||||
//public static Item hotIronIngot;
|
||||
public static Item woodenPlate;
|
||||
public static Item ironweaponHandle;
|
||||
public static Item woodentoolHandle;
|
||||
//public static Item refinedIngot;
|
||||
public static Item charcoalLeafPellet;
|
||||
public static Item unstrungLongbow;
|
||||
public static Item itemBark;
|
||||
public static Item quartzDust;
|
||||
public static Item salt;
|
||||
public static Item strippedSapling;
|
||||
public static Item saplingRing;
|
||||
public static Item limestoneDust;
|
||||
public static Item leatherString;
|
||||
public static Item flintKnapped;
|
||||
//public static Item crucibleLid;
|
||||
//public static Item emptyCrucible;
|
||||
//public static Item clayFormBook;
|
||||
//SPLIT BOARD
|
||||
public static Item halfSplitBoard;
|
||||
public static Item splitBoard;
|
||||
public static Item acaciaSplitBoard;
|
||||
public static Item birchSplitBoard;
|
||||
public static Item darkSplitBoard;
|
||||
public static Item jungleSplitBoard;
|
||||
public static Item oakSplitBoard;
|
||||
public static Item spruceSplitBoard;
|
||||
public static Item itemSmallBarrelLid;
|
||||
|
||||
//-----------------------FILTERS-----------------------//
|
||||
public static Item coarseFilter;
|
||||
public static Item mediumFilter;
|
||||
public static Item fineFilter;
|
||||
public static Item charcoalFilter;
|
||||
public static Item woodPulp;
|
||||
|
||||
//-----------------------LEATHER STUFF-----------------------//
|
||||
public static Item rawCuredLeather;
|
||||
public static Item soakedLeather;
|
||||
public static Item slackedLeather;
|
||||
public static Item scuddedLeather;
|
||||
public static Item tannedLeather;
|
||||
public static Item finishedLeather;
|
||||
public static Item cutLeather;
|
||||
|
||||
//-----------------------BUCKETS-----------------------//
|
||||
public static Item filteredBucket;
|
||||
public static Item tanninBucket;
|
||||
public static Item slackBucket;
|
||||
|
||||
//-----------------------WEAPONS AND SHIELDS-----------------------//
|
||||
public static Item heavyMace;
|
||||
public static Item longSword;
|
||||
public static Item woodenShield;
|
||||
public static Item ironShield;
|
||||
public static Item battleAxe;
|
||||
public static Item gladius;
|
||||
|
||||
//-----------------------BOWS AND ARROWS-----------------------//
|
||||
//public static Item testLongbow0;
|
||||
//public static Item testLongbow1;
|
||||
//public static Item testLongbow10;
|
||||
public static Item longbow;
|
||||
public static Item itemModelArrow;
|
||||
public static Item itemIronTippedModelArrow;
|
||||
|
||||
//-----------------------CRAFTING TOOLS-----------------------//
|
||||
public static Item leatherShears;
|
||||
public static Item flintSaw;
|
||||
public static Item ironSaw;
|
||||
public static Item forgeHammer;
|
||||
public static Item inlayHammer;
|
||||
public static Item fireBow;
|
||||
public static Item workBlade;
|
||||
|
||||
//-----------------------FINISHED TOOL COMBOS-----------------------///
|
||||
public static Item customIronPick;
|
||||
public static Item customStrongIronPick;
|
||||
public static Item customWeakIronPick;
|
||||
public static Item customHandleIronPick;
|
||||
public static Item customHandleStrongIronPick;
|
||||
|
||||
public static Item customIronShovel;
|
||||
public static Item customStrongIronShovel;
|
||||
public static Item customWeakIronShovel;
|
||||
public static Item customHandleIronShovel;
|
||||
public static Item customHandleStrongIronShovel;
|
||||
|
||||
public static Item customIronLumberAxe;
|
||||
public static Item customStrongIronLumberAxe;
|
||||
public static Item customWeakIronLumberAxe;
|
||||
public static Item customHandleIronLumberAxe;
|
||||
public static Item customHandleStrongIronLumberAxe;
|
||||
|
||||
//-----------------------CLAYFORMS-----------------------///
|
||||
public static Item pickaxeClayForm;
|
||||
public static Item spadeHeadClayForm;
|
||||
public static Item hoeHeadClayForm;
|
||||
public static Item axeHeadClayForm;
|
||||
public static Item longswordClayForm;
|
||||
public static Item shortswordClayForm;
|
||||
public static Item daggerClayForm;
|
||||
//public static Item halberdClayForm;
|
||||
public static Item speartipClayForm;
|
||||
public static Item maceheadClayForm;
|
||||
public static Item sharptipClayForm;
|
||||
public static Item battleaxeClayForm;
|
||||
public static Item ringClayForm;
|
||||
//public static Item plateClayForm;
|
||||
public static Item sawbladeClayForm;
|
||||
|
||||
//-----------------------COOKED CLAYFORMS-----------------------//
|
||||
public static Item cookedpickaxeClayForm;
|
||||
public static Item cookedspadeHeadClayForm;
|
||||
public static Item cookedhoeHeadClayForm;
|
||||
public static Item cookedaxeHeadClayForm;
|
||||
public static Item cookedlongswordClayForm;
|
||||
public static Item cookedshortswordClayForm;
|
||||
public static Item cookeddaggerClayForm;
|
||||
//public static Item cookedhalberdClayForm;
|
||||
public static Item cookedspeartipClayForm;
|
||||
public static Item cookedmaceheadClayForm;
|
||||
public static Item cookedsharptipClayForm;
|
||||
public static Item cookedbattleaxeClayForm;
|
||||
public static Item cookedringClayForm;
|
||||
public static Item cookedplateClayForm;
|
||||
public static Item cookedsawbladeClayForm;
|
||||
|
||||
//-----------------------TOOLHEADS-----------------------//
|
||||
public static Item ironpickaxeHead;
|
||||
public static Item ironspadeHead;
|
||||
public static Item ironhoeHead;
|
||||
public static Item ironaxeHead;
|
||||
public static Item ironlongswordBlade;
|
||||
public static Item ironshortswordBlade;
|
||||
public static Item irondaggerBlade;
|
||||
public static Item ironHandleForm;
|
||||
public static Item ironspearTip;
|
||||
public static Item ironsharpTip;
|
||||
public static Item ironmaceHead;
|
||||
public static Item ironbattleaxeHead;
|
||||
public static Item ironsquarePlate;
|
||||
public static Item ironsawBlade;
|
||||
|
||||
|
||||
//-----------------------IRON FORMS-----------------------//
|
||||
public static Item ironPickaxeForm;
|
||||
public static Item ironSpadForm;
|
||||
public static Item ironHoeForm;
|
||||
public static Item ironAxeForm;
|
||||
public static Item ironLongswordForm;
|
||||
public static Item ironShortSwordForm;
|
||||
public static Item ironDaggerForm;
|
||||
//public static Item ironHalberdForm;
|
||||
public static Item ironSpearTipForm;
|
||||
public static Item ironMaceHeadForm;
|
||||
public static Item ironBattleAxeForm;
|
||||
public static Item ironSharpTipForm;
|
||||
public static Item ironSawBladeForm;
|
||||
public static Item ironRingForm;
|
||||
|
||||
//-----------------------PICK PARTS-----------------------//
|
||||
public static Item silkTouchIronHead;
|
||||
public static Item unbreakingOneHead;
|
||||
public static Item unbreakingTwoHead;
|
||||
public static Item efficOneHead;
|
||||
public static Item efficTwoHead;
|
||||
public static Item fortuneOneHead;
|
||||
public static Item fortuneTwoHead;
|
||||
public static Item unbreakingOneEfficOneHead;
|
||||
public static Item unbreakingOneFortuneOneHead;
|
||||
public static Item efficOneFortuneOneHead;
|
||||
|
||||
//-----------------------SHOVEL PARTS-----------------------//
|
||||
public static Item silkTouchIronSpade;
|
||||
public static Item unbreakingOneSpade;
|
||||
public static Item unbreakingTwoSpade;
|
||||
public static Item efficOneSpade;
|
||||
public static Item efficTwoSpade;
|
||||
public static Item fortuneOneSpade;
|
||||
public static Item fortuneTwoSpade;
|
||||
public static Item unbreakingOneEfficOneSpade;
|
||||
public static Item unbreakingOneFortuneOneSpade;
|
||||
public static Item efficOneFortuneOneSpade;
|
||||
|
||||
//-----------------------LUMBERAXE PARTS-----------------------//
|
||||
public static Item silkTouchIronLumberAxe;
|
||||
public static Item unbreakingOneLumberAxe;
|
||||
public static Item unbreakingTwoLumberAxe;
|
||||
public static Item efficOneLumberAxe;
|
||||
public static Item efficTwoLumberAxe;
|
||||
public static Item fortuneOneLumberAxe;
|
||||
public static Item fortuneTwoLumberAxe;
|
||||
public static Item unbreakingOneEfficOneLumberAxe;
|
||||
public static Item unbreakingOneFortuneOneLumberAxe;
|
||||
public static Item efficOneFortuneOneLumberAxe;
|
||||
|
||||
//-----------------------ROD PARTS-----------------------//
|
||||
public static Item fortuneWoodRod;
|
||||
public static Item unbreakingWoodRod;
|
||||
public static Item fortuneIronRod;
|
||||
public static Item efficIronRod;
|
||||
|
||||
//EnumHelper.addToolMaterial(name, harvestLevel, maxUses, efficiency, damage, enchantability)
|
||||
//Max stats a tool / weapon can have
|
||||
//public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", 3, 1000, 15.0F, 4.0F, 30);
|
||||
/*Vanilla Tools
|
||||
WOOD(0, 59, 2.0F, 0, 15), STONE(1, 131, 4.0F, 1, 5), IRON(2, 250, 6.0F, 2, 14), EMERALD(3, 1561, 8.0F, 3, 10), GOLD(0, 32, 12.0F, 0, 22);*/
|
||||
|
||||
public static ToolMaterial longswordmat = EnumHelper.addToolMaterial("LONGSWORD", 1, 350, 2.0F, 2.0F, 0);
|
||||
public static ToolMaterial woodenshieldmat = EnumHelper.addToolMaterial("WOODENSHIELD", 0, 65, 2.0F, -3.5F, 0);
|
||||
public static ToolMaterial ironshieldmat = EnumHelper.addToolMaterial("IRONSHIELD", 0, 500, 2.0F, -3.5F, 0);
|
||||
public static ToolMaterial heavymacemat = EnumHelper.addToolMaterial("HEAVYMACE", 0, 350, 4.0F, -4.0F, 0);
|
||||
public static ToolMaterial customIronPickmat = EnumHelper.addToolMaterial("WOODWEAK", 2, 250, 6.0F, 0, 0);
|
||||
//public static ToolMaterial customIronPickDiamondTip = EnumHelper.addToolMaterial("DIAMONDTIP", 3, 500, 7.0F, 2, 0);
|
||||
public static ToolMaterial customWoodNormal = EnumHelper.addToolMaterial("WOODNORMAL", 2, 350, 6.25F, 0, 0);
|
||||
public static ToolMaterial customWoodStrong = EnumHelper.addToolMaterial("WOODSTRONG", 3, 500, 6.75F, 0, 0);
|
||||
public static ToolMaterial customWoodWeak = EnumHelper.addToolMaterial("WOODWEAK", 2, 300, 6.0F, 0, 0);
|
||||
public static ToolMaterial customIronToolRodStrong = EnumHelper.addToolMaterial("IRONSTRONG", 3, 350, 7.5F, 0, 0);
|
||||
public static ToolMaterial customIronToolRodNormal = EnumHelper.addToolMaterial("IRONNORMAL", 2, 300, 7.5F, 0, 0);
|
||||
public static ToolMaterial customIronToolRodWeak = EnumHelper.addToolMaterial("IRONWEAK", 2, 250, 7.5F, 0, 0);
|
||||
|
||||
public static void init() {
|
||||
|
||||
/*
|
||||
tutorialItem = new Item().setUnlocalizedName("tutorialItem").setCreativeTab(CreativeTabs.tabMisc)
|
||||
.setTextureName(Main.MODID + ":tutorialItem");
|
||||
GameRegistry.registerItem(tutorialItem, "tutorialItem");
|
||||
COPY TEMPLATE
|
||||
xxx = new Item().setUnlocalizedName("xxx").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "xxx");
|
||||
GameRegistry.registerItem(xxx, "xxx");
|
||||
|
||||
|
||||
|
||||
//longbow = new Item().setUnlocalizedName("longbow").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":longbow");
|
||||
//GameRegistry.registerItem(longbow, "longbow");
|
||||
|
||||
//hotIronPlate = new Item().setUnlocalizedName("hotIronPlate").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":hotIronPlate");
|
||||
//GameRegistry.registerItem(hotIronPlate, "hotIronPlate");
|
||||
|
||||
salt = new Item().setUnlocalizedName("salt").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":salt");
|
||||
GameRegistry.registerItem(salt, "salt");
|
||||
*/
|
||||
//acaciaSplitBoard = new Item().setUnlocalizedName("acaciaSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":acaciaSplitBoard");
|
||||
//GameRegistry.registerItem(acaciaSplitBoard, "acaciaSplitBoard");
|
||||
|
||||
//birchSplitBoard = new Item().setUnlocalizedName("birchSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":birchSplitBoard");
|
||||
//GameRegistry.registerItem(birchSplitBoard, "birchSplitBoard");
|
||||
|
||||
//darkSplitBoard = new Item().setUnlocalizedName("darkSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":darkSplitBoard");
|
||||
//GameRegistry.registerItem(darkSplitBoard, "darkSplitBoard");
|
||||
|
||||
//jungleSplitBoard = new Item().setUnlocalizedName("jungleSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":jungleSplitBoard");
|
||||
//GameRegistry.registerItem(jungleSplitBoard, "jungleSplitBoard");
|
||||
|
||||
//oakSplitBoard = new Item().setUnlocalizedName("oakSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":oakSplitBoard");
|
||||
//GameRegistry.registerItem(oakSplitBoard, "oakSplitBoard");
|
||||
|
||||
//spruceSplitBoard = new Item().setUnlocalizedName("spruceSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":spruceSplitBoard");
|
||||
//GameRegistry.registerItem(spruceSplitBoard, "spruceSplitBoard");
|
||||
|
||||
//itemSmallBarrelLid = new Item().setUnlocalizedName("itemSmallBarrelLid").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":itemSmallBarrelLid");
|
||||
//GameRegistry.registerItem(itemSmallBarrelLid, "itemSmallBarrelLid");
|
||||
|
||||
woodPulp = new Item().setUnlocalizedName("woodPulp").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":woodPulp");
|
||||
GameRegistry.registerItem(woodPulp, "woodPulp");
|
||||
|
||||
halfSplitBoard = new Item().setUnlocalizedName("halfSplitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":halfSplitBoard");
|
||||
GameRegistry.registerItem(halfSplitBoard, "halfSplitBoard");
|
||||
|
||||
splitBoard = new Item().setUnlocalizedName("splitBoard").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":splitBoard");
|
||||
GameRegistry.registerItem(splitBoard, "splitBoard");
|
||||
|
||||
finishedLeather = new Item().setUnlocalizedName("finishedLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":finishedLeather");
|
||||
GameRegistry.registerItem(finishedLeather, "finishedLeather");
|
||||
|
||||
cutLeather = new Item().setUnlocalizedName("cutLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":cutLeather");
|
||||
GameRegistry.registerItem(cutLeather, "cutLeather");
|
||||
|
||||
tannedLeather = new Item().setUnlocalizedName("tannedLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":tannedLeather");
|
||||
GameRegistry.registerItem(tannedLeather, "tannedLeather");
|
||||
|
||||
scuddedLeather = new Item().setUnlocalizedName("scuddedLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":scuddedLeather");
|
||||
GameRegistry.registerItem(scuddedLeather, "scuddedLeather");
|
||||
|
||||
slackedLeather = new Item().setUnlocalizedName("slackedLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":slackedLeather");
|
||||
GameRegistry.registerItem(slackedLeather, "slackedLeather");
|
||||
|
||||
soakedLeather = new Item().setUnlocalizedName("soakedLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":soakedLeather");
|
||||
GameRegistry.registerItem(soakedLeather, "soakedLeather");
|
||||
|
||||
//rawCuredLeather = new Item().setUnlocalizedName("rawCuredLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":rawCuredLeather");
|
||||
//GameRegistry.registerItem(rawCuredLeather, "rawCuredLeather");
|
||||
|
||||
strippedSapling = new Item().setUnlocalizedName("strippedSapling").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":strippedSapling");
|
||||
GameRegistry.registerItem(strippedSapling, "strippedSapling");
|
||||
|
||||
saplingRing = new Item().setUnlocalizedName("saplingRing").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":saplingRing");
|
||||
GameRegistry.registerItem(saplingRing, "saplingRing");
|
||||
|
||||
quartzDust = new Item().setUnlocalizedName("quartzDust").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":quartzDust");
|
||||
GameRegistry.registerItem(quartzDust, "quartzDust");
|
||||
|
||||
salt = new Item().setUnlocalizedName("salt").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":salt");
|
||||
GameRegistry.registerItem(salt, "salt");
|
||||
|
||||
limestoneDust = new Item().setUnlocalizedName("limestoneDust").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":limestoneDust");
|
||||
GameRegistry.registerItem(limestoneDust, "limestoneDust");
|
||||
|
||||
charcoalLeafPellet = new Item().setUnlocalizedName("charcoalLeafPellet").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":charcoalLeafPellet");
|
||||
GameRegistry.registerItem(charcoalLeafPellet, "charcoalLeafPellet");
|
||||
|
||||
unstrungLongbow = new Item().setUnlocalizedName("unstrungLongbow").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":unstrungLongbow");
|
||||
GameRegistry.registerItem(unstrungLongbow, "unstrungLongbow");
|
||||
|
||||
leatherString = new Item().setUnlocalizedName("leatherString").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":leatherString");
|
||||
GameRegistry.registerItem(leatherString, "leatherString");
|
||||
|
||||
//refinedIngot = new Item().setUnlocalizedName("refinedIngot").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":refinedIngot");
|
||||
//GameRegistry.registerItem(refinedIngot, "refinedIngot");
|
||||
|
||||
//coarseFilter = new Item().setUnlocalizedName("coarseFilter").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":coarseFilter").setMaxStackSize(1).setMaxDamage(300);
|
||||
//GameRegistry.registerItem(coarseFilter, "coarseFilter");
|
||||
//mediumFilter = new Item().setUnlocalizedName("mediumFilter").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":mediumFilter").setMaxStackSize(1).setMaxDamage(300);
|
||||
//GameRegistry.registerItem(mediumFilter, "mediumFilter");
|
||||
//fineFilter = new Item().setUnlocalizedName("fineFilter").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":fineFilter").setMaxStackSize(1).setMaxDamage(300);
|
||||
//GameRegistry.registerItem(fineFilter, "fineFilter");
|
||||
|
||||
leatherStrap = new Item().setUnlocalizedName("leatherStrap").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":leatherStrap");
|
||||
GameRegistry.registerItem(leatherStrap, "leatherStrap");
|
||||
|
||||
wovenLeather = new Item().setUnlocalizedName("wovenLeather").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":wovenLeather");
|
||||
GameRegistry.registerItem(wovenLeather, "wovenLeather");
|
||||
|
||||
ironChunk = new Item().setUnlocalizedName("ironChunk").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":ironChunk");
|
||||
GameRegistry.registerItem(ironChunk, "ironChunk");
|
||||
|
||||
hotironChunk = new Item().setUnlocalizedName("hotironChunk").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":hotironChunk");
|
||||
GameRegistry.registerItem(hotironChunk, "hotironChunk");
|
||||
|
||||
ironRing = new Item().setUnlocalizedName("ironRing").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":ironRing").setMaxStackSize(16);
|
||||
GameRegistry.registerItem(ironRing, "ironRing");
|
||||
|
||||
linkedRings = new Item().setUnlocalizedName("linkedRings").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":linkedRings").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(linkedRings, "linkedRings");
|
||||
|
||||
ironRingMesh = new Item().setUnlocalizedName("ironRingMesh").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":ironRingMesh");
|
||||
GameRegistry.registerItem(ironRingMesh, "ironRingMesh");
|
||||
|
||||
//hotIronIngot = new Item().setUnlocalizedName("hotIronIngot").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":hotIronIngot");
|
||||
//GameRegistry.registerItem(hotIronIngot, "hotIronIngot");
|
||||
|
||||
ironweaponHandle = new Item().setUnlocalizedName("ironweaponHandle").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":ironweaponHandle");
|
||||
GameRegistry.registerItem(ironweaponHandle, "ironweaponHandle");
|
||||
|
||||
woodenPlate = new Item().setUnlocalizedName("woodenPlate").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":woodenPlate");
|
||||
GameRegistry.registerItem(woodenPlate, "woodenPlate");
|
||||
|
||||
woodentoolHandle = new Item().setUnlocalizedName("woodentoolHandle").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":woodentoolHandle");
|
||||
GameRegistry.registerItem(woodentoolHandle, "woodentoolHandle");
|
||||
|
||||
flintKnapped = new Item().setUnlocalizedName("flintKnapped").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":flintKnapped");
|
||||
GameRegistry.registerItem(flintKnapped, "flintKnapped");
|
||||
|
||||
//-----------------------CLAY FORMS-----------------------//
|
||||
pickaxeClayForm = new Item().setUnlocalizedName("pickaxeClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "pickaxeClayForm");
|
||||
GameRegistry.registerItem(pickaxeClayForm, "pickaxeClayForm");
|
||||
|
||||
spadeHeadClayForm = new Item().setUnlocalizedName("spadeHeadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "spadeHeadClayForm");
|
||||
GameRegistry.registerItem(spadeHeadClayForm, "spadeHeadClayForm");
|
||||
|
||||
hoeHeadClayForm = new Item().setUnlocalizedName("hoeHeadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "hoeHeadClayForm");
|
||||
GameRegistry.registerItem(hoeHeadClayForm, "hoeHeadClayForm");
|
||||
|
||||
axeHeadClayForm = new Item().setUnlocalizedName("axeHeadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "axeHeadClayForm");
|
||||
GameRegistry.registerItem(axeHeadClayForm, "axeHeadClayForm");
|
||||
|
||||
longswordClayForm = new Item().setUnlocalizedName("longswordClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "longswordClayForm");
|
||||
GameRegistry.registerItem(longswordClayForm, "longswordClayForm");
|
||||
|
||||
shortswordClayForm = new Item().setUnlocalizedName("shortswordClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "shortswordClayForm");
|
||||
GameRegistry.registerItem(shortswordClayForm, "shortswordClayForm");
|
||||
|
||||
daggerClayForm = new Item().setUnlocalizedName("daggerClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "daggerClayForm");
|
||||
GameRegistry.registerItem(daggerClayForm, "daggerClayForm");
|
||||
|
||||
//halberdClayForm = new Item().setUnlocalizedName("halberdClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "halberdClayForm");
|
||||
//GameRegistry.registerItem(halberdClayForm, "halberdClayForm");
|
||||
|
||||
speartipClayForm = new Item().setUnlocalizedName("speartipClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "speartipClayForm");
|
||||
GameRegistry.registerItem(speartipClayForm, "speartipClayForm");
|
||||
|
||||
maceheadClayForm = new Item().setUnlocalizedName("maceheadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "maceheadClayForm");
|
||||
GameRegistry.registerItem(maceheadClayForm, "maceheadClayForm");
|
||||
|
||||
sharptipClayForm = new Item().setUnlocalizedName("sharptipClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "sharptipClayForm");
|
||||
GameRegistry.registerItem(sharptipClayForm, "sharptipClayForm");
|
||||
|
||||
battleaxeClayForm = new Item().setUnlocalizedName("battleaxeClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "battleaxeClayForm");
|
||||
GameRegistry.registerItem(battleaxeClayForm, "battleaxeClayForm");
|
||||
|
||||
ringClayForm = new Item().setUnlocalizedName("ringClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ringClayForm");
|
||||
GameRegistry.registerItem(ringClayForm, "ringClayForm");
|
||||
|
||||
//plateClayForm = new Item().setUnlocalizedName("plateClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "plateClayForm");
|
||||
//GameRegistry.registerItem(plateClayForm, "plateClayForm");
|
||||
|
||||
sawbladeClayForm = new Item().setUnlocalizedName("sawbladeClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "sawbladeClayForm");
|
||||
GameRegistry.registerItem(sawbladeClayForm, "sawbladeClayForm");
|
||||
|
||||
|
||||
|
||||
//-----------------------COOKED CLAY FORMS-----------------------//
|
||||
cookedpickaxeClayForm = new Item().setUnlocalizedName("cookedpickaxeClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedpickaxeClayForm");
|
||||
GameRegistry.registerItem(cookedpickaxeClayForm, "cookedpickaxeClayForm");
|
||||
|
||||
cookedspadeHeadClayForm = new Item().setUnlocalizedName("cookedspadeHeadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedspadeHeadClayForm");
|
||||
GameRegistry.registerItem(cookedspadeHeadClayForm, "cookedspadeHeadClayForm");
|
||||
|
||||
cookedhoeHeadClayForm = new Item().setUnlocalizedName("cookedhoeHeadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedhoeHeadClayForm");
|
||||
GameRegistry.registerItem(cookedhoeHeadClayForm, "cookedhoeHeadClayForm");
|
||||
|
||||
cookedaxeHeadClayForm = new Item().setUnlocalizedName("cookedaxeHeadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedaxeHeadClayForm");
|
||||
GameRegistry.registerItem(cookedaxeHeadClayForm, "cookedaxeHeadClayForm");
|
||||
|
||||
cookedlongswordClayForm = new Item().setUnlocalizedName("cookedlongswordClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedlongswordClayForm");
|
||||
GameRegistry.registerItem(cookedlongswordClayForm, "cookedlongswordClayForm");
|
||||
|
||||
cookedshortswordClayForm = new Item().setUnlocalizedName("cookedshortswordClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedshortswordClayForm");
|
||||
GameRegistry.registerItem(cookedshortswordClayForm, "cookedshortswordClayForm");
|
||||
|
||||
cookeddaggerClayForm = new Item().setUnlocalizedName("cookeddaggerClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookeddaggerClayForm");
|
||||
GameRegistry.registerItem(cookeddaggerClayForm, "cookeddaggerClayForm");
|
||||
|
||||
//cookedhalberdClayForm = new Item().setUnlocalizedName("cookedhalberdClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedhalberdClayForm");
|
||||
//GameRegistry.registerItem(cookedhalberdClayForm, "cookedhalberdClayForm");
|
||||
|
||||
cookedspeartipClayForm = new Item().setUnlocalizedName("cookedspeartipClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedspeartipClayForm");
|
||||
GameRegistry.registerItem(cookedspeartipClayForm, "cookedspeartipClayForm");
|
||||
|
||||
cookedmaceheadClayForm = new Item().setUnlocalizedName("cookedmaceheadClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedmaceheadClayForm");
|
||||
GameRegistry.registerItem(cookedmaceheadClayForm, "cookedmaceheadClayForm");
|
||||
|
||||
cookedsharptipClayForm = new Item().setUnlocalizedName("cookedsharptipClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedsharptipClayForm");
|
||||
GameRegistry.registerItem(cookedsharptipClayForm, "cookedsharptipClayForm");
|
||||
|
||||
cookedbattleaxeClayForm = new Item().setUnlocalizedName("cookedbattleaxeClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedbattleaxeClayForm");
|
||||
GameRegistry.registerItem(cookedbattleaxeClayForm, "cookedbattleaxeClayForm");
|
||||
|
||||
cookedringClayForm = new Item().setUnlocalizedName("cookedringClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedringClayForm");
|
||||
GameRegistry.registerItem(cookedringClayForm, "cookedringClayForm");
|
||||
|
||||
//cookedplateClayForm = new Item().setUnlocalizedName("cookedplateClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedplateClayForm");
|
||||
//GameRegistry.registerItem(cookedplateClayForm, "cookedplateClayForm");
|
||||
|
||||
cookedsawbladeClayForm = new Item().setUnlocalizedName("cookedsawbladeClayForm").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "cookedsawbladeClayForm");
|
||||
GameRegistry.registerItem(cookedsawbladeClayForm, "cookedsawbladeClayForm");
|
||||
|
||||
|
||||
|
||||
//-----------------------IRON PARTS-----------------------//
|
||||
ironpickaxeHead = new Item().setUnlocalizedName("ironpickaxeHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironpickaxeHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironpickaxeHead, "ironpickaxeHead");
|
||||
|
||||
ironspadeHead = new Item().setUnlocalizedName("ironspadeHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironspadeHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironspadeHead, "ironspadeHead");
|
||||
|
||||
ironhoeHead = new Item().setUnlocalizedName("ironhoeHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironhoeHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironhoeHead, "ironhoeHead");
|
||||
|
||||
ironaxeHead = new Item().setUnlocalizedName("ironaxeHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironaxeHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironaxeHead, "ironaxeHead");
|
||||
|
||||
ironlongswordBlade = new Item().setUnlocalizedName("ironlongswordBlade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironlongswordBlade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironlongswordBlade, "ironlongswordBlade");
|
||||
|
||||
ironshortswordBlade = new Item().setUnlocalizedName("ironshortswordBlade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironshortswordBlade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironshortswordBlade, "ironshortswordBlade");
|
||||
|
||||
irondaggerBlade = new Item().setUnlocalizedName("irondaggerBlade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "irondaggerBlade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(irondaggerBlade, "irondaggerBlade");
|
||||
|
||||
//ironhalberdHead = new Item().setUnlocalizedName("ironhalberdHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironhalberdHead");
|
||||
//GameRegistry.registerItem(ironhalberdHead, "ironhalberdHead");
|
||||
|
||||
ironspearTip = new Item().setUnlocalizedName("ironspearTip").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironspearTip").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironspearTip, "ironspearTip");
|
||||
|
||||
ironsharpTip = new Item().setUnlocalizedName("ironsharpTip").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironsharpTip").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironsharpTip, "ironsharpTip");
|
||||
|
||||
ironmaceHead = new Item().setUnlocalizedName("ironmaceHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironmaceHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironmaceHead, "ironmaceHead");
|
||||
|
||||
ironbattleaxeHead = new Item().setUnlocalizedName("ironbattleaxeHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironbattleaxeHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironbattleaxeHead, "ironbattleaxeHead");
|
||||
|
||||
ironsquarePlate = new Item().setUnlocalizedName("ironsquarePlate").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironsquarePlate").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironsquarePlate, "ironsquarePlate");
|
||||
|
||||
ironsawBlade = new Item().setUnlocalizedName("ironsawBlade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "ironsawBlade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(ironsawBlade, "ironsawBlade");
|
||||
|
||||
//-----------------------TOOL ROD PARTS-----------------------//
|
||||
//FORTUNE WOOD ROD
|
||||
fortuneWoodRod = new Item().setUnlocalizedName("fortuneWoodRod").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneWoodRod");
|
||||
GameRegistry.registerItem(fortuneWoodRod, "fortuneWoodRod");
|
||||
|
||||
//UNBREAKING WOOD ROD
|
||||
unbreakingWoodRod = new Item().setUnlocalizedName("unbreakingWoodRod").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingWoodRod");
|
||||
GameRegistry.registerItem(unbreakingWoodRod, "unbreakingWoodRod");
|
||||
|
||||
//FORTUNE IRON ROD
|
||||
fortuneIronRod = new Item().setUnlocalizedName("fortuneIronRod").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneIronRod");
|
||||
GameRegistry.registerItem(fortuneIronRod, "fortuneIronRod");
|
||||
|
||||
//EFFIC IRON ROD
|
||||
efficIronRod = new Item().setUnlocalizedName("efficIronRod").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficIronRod");
|
||||
GameRegistry.registerItem(efficIronRod, "efficIronRod");
|
||||
|
||||
|
||||
//-----------------------ENCHANTED PICK HEAD PARTS-----------------------//
|
||||
|
||||
silkTouchIronHead = new Item().setUnlocalizedName("silkTouchIronHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "silkTouchIronHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(silkTouchIronHead, "silkTouchIronHead");
|
||||
|
||||
unbreakingOneHead = new Item().setUnlocalizedName("unbreakingOneHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneHead, "unbreakingOneHead");
|
||||
|
||||
unbreakingTwoHead = new Item().setUnlocalizedName("unbreakingTwoHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingTwoHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingTwoHead, "unbreakingTwoHead");
|
||||
|
||||
efficOneHead = new Item().setUnlocalizedName("efficOneHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficOneHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficOneHead, "efficOneHead");
|
||||
|
||||
efficTwoHead = new Item().setUnlocalizedName("efficTwoHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficTwoHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficTwoHead, "efficTwoHead");
|
||||
|
||||
fortuneOneHead = new Item().setUnlocalizedName("fortuneOneHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneOneHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(fortuneOneHead, "fortuneOneHead");
|
||||
|
||||
fortuneTwoHead = new Item().setUnlocalizedName("fortuneTwoHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneTwoHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(fortuneTwoHead, "fortuneTwoHead");
|
||||
|
||||
unbreakingOneEfficOneHead = new Item().setUnlocalizedName("unbreakingOneEfficOneHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneEfficOneHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneEfficOneHead, "unbreakingOneEfficOneHead");
|
||||
|
||||
unbreakingOneFortuneOneHead = new Item().setUnlocalizedName("unbreakingOneFortuneOneHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneFortuneOneHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneFortuneOneHead, "unbreakingOneFortuneOneHead");
|
||||
|
||||
efficOneFortuneOneHead = new Item().setUnlocalizedName("efficOneFortuneOneHead").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficOneFortuneOneHead").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficOneFortuneOneHead, "efficOneFortuneOneHead");
|
||||
|
||||
//-----------------------ENCHANTED SPADE PARTS-----------------------//
|
||||
|
||||
silkTouchIronSpade = new Item().setUnlocalizedName("silkTouchIronSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "silkTouchIronSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(silkTouchIronSpade, "silkTouchIronSpade");
|
||||
|
||||
unbreakingOneSpade = new Item().setUnlocalizedName("unbreakingOneSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneSpade, "unbreakingOneSpade");
|
||||
|
||||
unbreakingTwoSpade = new Item().setUnlocalizedName("unbreakingTwoSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingTwoSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingTwoSpade, "unbreakingTwoSpade");
|
||||
|
||||
efficOneSpade = new Item().setUnlocalizedName("efficOneSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficOneSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficOneSpade, "efficOneSpade");
|
||||
|
||||
efficTwoSpade = new Item().setUnlocalizedName("efficTwoSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficTwoSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficTwoSpade, "efficTwoSpade");
|
||||
|
||||
fortuneOneSpade = new Item().setUnlocalizedName("fortuneOneSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneOneSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(fortuneOneSpade, "fortuneOneSpade");
|
||||
|
||||
fortuneTwoSpade = new Item().setUnlocalizedName("fortuneTwoSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneTwoSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(fortuneTwoSpade, "fortuneTwoSpade");
|
||||
|
||||
unbreakingOneEfficOneSpade = new Item().setUnlocalizedName("unbreakingOneEfficOneSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneEfficOneSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneEfficOneSpade, "unbreakingOneEfficOneSpade");
|
||||
|
||||
unbreakingOneFortuneOneSpade = new Item().setUnlocalizedName("unbreakingOneFortuneOneSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneFortuneOneSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneFortuneOneSpade, "unbreakingOneFortuneOneSpade");
|
||||
|
||||
efficOneFortuneOneSpade = new Item().setUnlocalizedName("efficOneFortuneOneSpade").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficOneFortuneOneSpade").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficOneFortuneOneSpade, "efficOneFortuneOneSpade");
|
||||
|
||||
//-----------------------ENCHANTED LUMBERAXE PARTS-----------------------//
|
||||
|
||||
silkTouchIronLumberAxe = new Item().setUnlocalizedName("silkTouchIronLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "silkTouchIronLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(silkTouchIronLumberAxe, "silkTouchIronLumberAxe");
|
||||
|
||||
unbreakingOneLumberAxe = new Item().setUnlocalizedName("unbreakingOneLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneLumberAxe, "unbreakingOneLumberAxe");
|
||||
|
||||
unbreakingTwoLumberAxe = new Item().setUnlocalizedName("unbreakingTwoLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingTwoLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingTwoLumberAxe, "unbreakingTwoLumberAxe");
|
||||
|
||||
efficOneLumberAxe = new Item().setUnlocalizedName("efficOneLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficOneLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficOneLumberAxe, "efficOneLumberAxe");
|
||||
|
||||
efficTwoLumberAxe = new Item().setUnlocalizedName("efficTwoLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficTwoLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficTwoLumberAxe, "efficTwoLumberAxe");
|
||||
|
||||
fortuneOneLumberAxe = new Item().setUnlocalizedName("fortuneOneLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneOneLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(fortuneOneLumberAxe, "fortuneOneLumberAxe");
|
||||
|
||||
fortuneTwoLumberAxe = new Item().setUnlocalizedName("fortuneTwoLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "fortuneTwoLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(fortuneTwoLumberAxe, "fortuneTwoLumberAxe");
|
||||
|
||||
unbreakingOneEfficOneLumberAxe = new Item().setUnlocalizedName("unbreakingOneEfficOneLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneEfficOneLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneEfficOneLumberAxe, "unbreakingOneEfficOneLumberAxe");
|
||||
|
||||
unbreakingOneFortuneOneLumberAxe = new Item().setUnlocalizedName("unbreakingOneFortuneOneLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "unbreakingOneFortuneOneLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(unbreakingOneFortuneOneLumberAxe, "unbreakingOneFortuneOneLumberAxe");
|
||||
|
||||
efficOneFortuneOneLumberAxe = new Item().setUnlocalizedName("efficOneFortuneOneLumberAxe").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "efficOneFortuneOneLumberAxe").setMaxStackSize(1);
|
||||
GameRegistry.registerItem(efficOneFortuneOneLumberAxe, "efficOneFortuneOneLumberAxe");
|
||||
|
||||
//BUCKETS
|
||||
filteredBucket = new FluidBucket(ModBlocks.blockFilteredWater);
|
||||
filteredBucket.setUnlocalizedName("filteredBucket").setContainerItem(Items.bucket).setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "filteredBucket");
|
||||
GameRegistry.registerItem(filteredBucket, "filteredBucket");
|
||||
FluidContainerRegistry.registerFluidContainer(ModBlocks.fluidFiltered, new ItemStack(filteredBucket), new ItemStack(Items.bucket));
|
||||
|
||||
tanninBucket = new FluidBucket(ModBlocks.blockTannin);
|
||||
tanninBucket.setUnlocalizedName("tanninBucket").setContainerItem(Items.bucket).setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "tanninBucket");
|
||||
GameRegistry.registerItem(tanninBucket, "tanninBucket");
|
||||
FluidContainerRegistry.registerFluidContainer(ModBlocks.fluidTan, new ItemStack(tanninBucket), new ItemStack(Items.bucket));
|
||||
|
||||
slackBucket = new FluidBucket(ModBlocks.blockSlackedLime);
|
||||
slackBucket.setUnlocalizedName("slackBucket").setContainerItem(Items.bucket).setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":" + "slackBucket");
|
||||
GameRegistry.registerItem(slackBucket, "slackBucket");
|
||||
FluidContainerRegistry.registerFluidContainer(ModBlocks.fluidSlackedLime, new ItemStack(slackBucket), new ItemStack(Items.bucket));
|
||||
|
||||
itemShit = new ItemShit();
|
||||
itemTester = new ItemTester();
|
||||
|
||||
itemModelArrow = new ItemModelArrow();
|
||||
itemIronTippedModelArrow = new ItemIronTippedModelArrow();
|
||||
|
||||
itemBark= new ItemBark();
|
||||
itemSmallBarrelLid = new ItemSmallBarrelLid();
|
||||
|
||||
forgeHammer = new ForgeHammer();
|
||||
inlayHammer = new InlayHammer();
|
||||
workBlade = new WorkBlade();
|
||||
|
||||
slottedTongs = new SlottedTongs();
|
||||
//testLongbow0 = new ItemTestLongbow0();
|
||||
//testLongbow1 = new ItemTestLongbow1();
|
||||
//testLongbow10 = new ItemTestLongbow10();
|
||||
longbow = new ItemLongbow();
|
||||
|
||||
coarseFilter = new CoarseFilter();
|
||||
mediumFilter = new MediumFilter();
|
||||
fineFilter = new FineFilter();
|
||||
charcoalFilter = new Item().setUnlocalizedName("charcoalFilter").setCreativeTab(CustomTab.MedievalCraftTab).setTextureName(Main.MODID + ":charcoalFilter");
|
||||
GameRegistry.registerItem(charcoalFilter, "charcoalFilter");
|
||||
|
||||
rawCuredLeather = new RawCuredLeather();
|
||||
//ironShield = new ItemIronShield();
|
||||
fireBow = new FireBow();
|
||||
leatherShears = new LeatherShears();
|
||||
ironSaw = new IronSaw();
|
||||
flintSaw = new FlintSaw();
|
||||
|
||||
ironPickaxeForm = new IronPickaxeForm();
|
||||
ironSpadForm = new IronSpadeForm();
|
||||
ironHoeForm = new IronHoeForm();
|
||||
ironAxeForm = new IronAxeForm();
|
||||
ironLongswordForm = new IronLongswordForm();
|
||||
ironShortSwordForm = new IronShortSwordForm();
|
||||
ironDaggerForm = new IronDaggerForm();
|
||||
ironHandleForm = new IronHandleForm();
|
||||
ironSpearTipForm = new IronSpearTipForm();
|
||||
ironMaceHeadForm = new IronMaceHeadForm();
|
||||
ironBattleAxeForm = new IronBattleAxeForm();
|
||||
ironSawBladeForm = new IronSawBladeForm();
|
||||
ironSharpTipForm = new IronSharpTipForm();
|
||||
ironRingForm = new IronRingForm();
|
||||
//clayFormBook = new ItemClayFormBook();
|
||||
|
||||
|
||||
//-----------------------MATERIALS REGISTERY-----------------------//
|
||||
|
||||
GameRegistry.registerItem(gladius = new ItemGladius("gladius", longswordmat), "gladius");
|
||||
GameRegistry.registerItem(longSword = new ItemLongSword("longSword", longswordmat), "longSword");
|
||||
GameRegistry.registerItem(woodenShield = new ItemWoodenShield("woodenShield", woodenshieldmat), "woodenShield");
|
||||
GameRegistry.registerItem(ironShield = new ItemIronShield("ironShield", ironshieldmat), "ironShield");
|
||||
//GameRegistry.registerItem(ironShield = new ItemIronShield("ironShield", ironshieldmat), "ironShield");
|
||||
|
||||
GameRegistry.registerItem(heavyMace = new ItemHeavyMace("heavyMace", heavymacemat), "heavyMace");
|
||||
GameRegistry.registerItem(battleAxe = new ItemBattleAxe("battleAxe", heavymacemat), "battleAxe");
|
||||
|
||||
GameRegistry.registerItem(customIronPick = new CustomIronPick("customIronPick", customWoodNormal), "customIronPick");
|
||||
GameRegistry.registerItem(customStrongIronPick = new CustomStrongIronPick("customStrongIronPick", customWoodStrong), "customStrongIronPick");
|
||||
GameRegistry.registerItem(customWeakIronPick = new CustomWeakIronPick("customWeakIronPick", customWoodWeak), "customWeakIronPick");
|
||||
GameRegistry.registerItem(customHandleIronPick = new CustomHandleIronPick("customHandleIronPick", customIronToolRodNormal), "customHandleIronPick");
|
||||
GameRegistry.registerItem(customHandleStrongIronPick = new CustomHandleStrongIronPick("customHandleStrongIronPick", customIronToolRodStrong), "customHandleStrongIronPick");
|
||||
|
||||
GameRegistry.registerItem(customIronShovel = new CustomIronShovel("customIronShovel", customWoodNormal), "customIronShovel");
|
||||
GameRegistry.registerItem(customStrongIronShovel = new CustomStrongIronShovel("customStrongIronShovel", customWoodStrong), "customStrongIronShovel");
|
||||
GameRegistry.registerItem(customWeakIronShovel = new CustomWeakIronShovel("customWeakIronShovel", customWoodWeak), "customWeakIronShovel");
|
||||
GameRegistry.registerItem(customHandleIronShovel = new CustomHandleIronShovel("customHandleIronShovel", customIronToolRodNormal), "customHandleIronShovel");
|
||||
GameRegistry.registerItem(customHandleStrongIronShovel = new CustomHandleStrongIronShovel("customHandleStrongIronShovel", customIronToolRodStrong), "customHandleStrongIronShovel");
|
||||
|
||||
GameRegistry.registerItem(customIronLumberAxe = new CustomIronLumberAxe("customIronLumberAxe", customWoodNormal), "customIronLumberAxe");
|
||||
GameRegistry.registerItem(customStrongIronLumberAxe = new CustomStrongIronLumberAxe("customStrongIronLumberAxe", customWoodStrong), "customStrongIronLumberAxe");
|
||||
GameRegistry.registerItem(customWeakIronLumberAxe = new CustomWeakIronLumberAxe("customWeakIronLumberAxe", customWoodWeak), "customWeakIronLumberAxe");
|
||||
GameRegistry.registerItem(customHandleIronLumberAxe = new CustomHandleIronLumberAxe("customHandleIronLumberAxe", customIronToolRodNormal), "customHandleIronLumberAxe");
|
||||
GameRegistry.registerItem(customHandleStrongIronLumberAxe = new CustomHandleStrongIronLumberAxe("customHandleStrongIronLumberAxe", customIronToolRodStrong), "customHandleStrongIronLumberAxe");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.kitsu.medievalcraft.item;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class TongsDamageTable {
|
||||
|
||||
public static final Hashtable<Block, Integer> blockToStore = new Hashtable <Block, Integer>(){{
|
||||
|
||||
put(ModBlocks.crucibleIronOre, 1);
|
||||
put(ModBlocks.crucibleIronIngot, 2);
|
||||
put(ModBlocks.crucibleLapis, 3);
|
||||
put(ModBlocks.crucibleRedstone, 4);
|
||||
put(ModBlocks.crucibleWootz, 5);
|
||||
//put(ModBlocks.lapisIngot, 6);
|
||||
//put(ModBlocks.redstoneIngot, 7);
|
||||
//put(ModBlocks.damascusIngot, 8);
|
||||
//put(ModBlocks.myIronIngot, 9);
|
||||
//put(ModBlocks.hotIronBlock, 10);
|
||||
//put(ModBlocks.hotDamascusIngot, 11);
|
||||
//put(ModBlocks.hotIronPlate, 12);
|
||||
//put(ModBlocks.hotLapisIngot, 13);
|
||||
//put(ModBlocks.hotRedstoneIngot, 14);
|
||||
}};
|
||||
|
||||
public static final Hashtable<Integer, Block> blockToGet = new Hashtable <Integer, Block>(){{
|
||||
|
||||
put(1, ModBlocks.crucibleIronOre);
|
||||
put(2, ModBlocks.crucibleIronIngot);
|
||||
put(3, ModBlocks.crucibleLapis);
|
||||
put(4, ModBlocks.crucibleRedstone);
|
||||
put(5, ModBlocks.crucibleWootz);
|
||||
//put(6, ModBlocks.lapisIngot);
|
||||
//put(7, ModBlocks.redstoneIngot);
|
||||
//put(8, ModBlocks.damascusIngot);
|
||||
//put(9, ModBlocks.myIronIngot);
|
||||
//put(10, ModBlocks.hotIronBlock);
|
||||
//put(11, ModBlocks.hotDamascusIngot);
|
||||
//put(12, ModBlocks.hotIronPlate);
|
||||
//put(13, ModBlocks.hotLapisIngot);
|
||||
//put(14, ModBlocks.hotRedstoneIngot);
|
||||
}};
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
public class FireBow extends Item {
|
||||
|
||||
private String name = "fireBow";
|
||||
private Item item;
|
||||
Random rand = new Random();
|
||||
|
||||
public FireBow() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(100);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
|
||||
if(rand.nextInt(5) == 0){
|
||||
world.setBlock(x, y + 1, z , Blocks.fire);
|
||||
//item.setDamage(new ItemStack(item), +1);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability () {
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair){
|
||||
return Items.stick == repair.getItem() ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class FlintSaw extends Item {
|
||||
private String name = "flintSaw";
|
||||
private Item item;
|
||||
|
||||
public FlintSaw() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(128);
|
||||
setNoRepair();
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.crafting.ForgeAnvilCrafting;
|
||||
import com.kitsu.medievalcraft.crafting.TestForgeCrafting;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacket;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocY;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocZ;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketlTicks;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
public class ForgeHammer extends Item {
|
||||
|
||||
private String name = "forgeHammer";
|
||||
private Item item;
|
||||
//private Block test;
|
||||
private int hit, key, blockKey, keys;
|
||||
public static boolean forgeHammerLeftClick;
|
||||
//TileEntityHotIronIngotBlock tileBlock;
|
||||
//TileEntityHotIronPlate tilePlate;
|
||||
Random rand;
|
||||
|
||||
public ForgeHammer() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(500);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
private Block blockToRun(Block block) {
|
||||
|
||||
if(block == TestForgeCrafting.blockToCook.get(0)){
|
||||
blockKey = 0;
|
||||
return TestForgeCrafting.blockToCook.get(0);
|
||||
} else
|
||||
if(block == TestForgeCrafting.blockToCook.get(3)){
|
||||
blockKey = 3;
|
||||
return TestForgeCrafting.blockToCook.get(3);
|
||||
} else
|
||||
if(block == TestForgeCrafting.blockToCook.get(6)){
|
||||
blockKey = 6;
|
||||
return TestForgeCrafting.blockToCook.get(6);
|
||||
} else return block = Blocks.air;
|
||||
}
|
||||
|
||||
private void onClick(Block block, Block blockSub, World world, int x, int y, int z, EntityPlayer p, ItemStack stack, Random rand){
|
||||
|
||||
if(block == ModBlocks.hotIronBlock){
|
||||
tileBlock = (TileEntityHotIronIngotBlock) world.getTileEntity(x, y, z);
|
||||
}
|
||||
if(block == ModBlocks.hotIronPlate){
|
||||
tilePlate = (TileEntityHotIronPlate) world.getTileEntity(x, y, z);
|
||||
}
|
||||
if((block == blockToRun(block)) && (blockSub == ModBlocks.forgeAnvil) && (p.isSwingInProgress == false)){
|
||||
TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z);
|
||||
|
||||
if((tileEnt.getStackInSlot(0) == null) && (blockKey == 0)){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileBlock.hits++;
|
||||
}
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
|
||||
if(tileBlock.hits >= 4){
|
||||
tileBlock.hits = 0;
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
world.setBlock(x, y, z, ModBlocks.ironPlate, 0, 2);
|
||||
stack.damageItem(1, p);
|
||||
}
|
||||
}
|
||||
if((tileEnt.getStackInSlot(0) != null)){
|
||||
if((tileEnt.getStackInSlot(0).getItem() == Items.flower_pot) && (blockKey == 0)){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileBlock.hits++;
|
||||
}
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
|
||||
if(tileBlock.hits >= 4){
|
||||
tileBlock.hits = 0;
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
ItemStack bucket = new ItemStack(Items.bucket);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, bucket));
|
||||
stack.damageItem(1, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEnt.getStackInSlot(0) != null){
|
||||
Item checkItem = tileEnt.getStackInSlot(0).getItem();
|
||||
String displayName = tileEnt.getStackInSlot(0).getDisplayName();
|
||||
|
||||
if(displayName.equals(getTool(tileEnt.getStackInSlot(0)))){
|
||||
if(tileEnt.getStackInSlot(0).isItemDamaged() == true){
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
stack.damageItem(1, p);
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileBlock.hits++;
|
||||
}
|
||||
}
|
||||
if(tileBlock.hits >= 4){
|
||||
tileBlock.hits=0;
|
||||
checkItem.setDamage(tileEnt.getStackInSlot(0), 0);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if((blockKey == 3) && tileEnt.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
tilePlate.hitGood=true;
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tilePlate.hits++;
|
||||
}
|
||||
if(tilePlate.hits >= 4){
|
||||
tilePlate.hits=0;
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
ItemStack ironForm = new ItemStack(ModItems.ironHandleForm);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, ironForm));
|
||||
}
|
||||
}
|
||||
|
||||
if((checkItem == getItem(checkItem)) || (checkItem == getItem3(checkItem)) || (checkItem == getItem2(checkItem).getItem())){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
if(blockKey == 0){
|
||||
tileBlock.hits++;
|
||||
}
|
||||
if(blockKey == 3){
|
||||
tilePlate.hits++;
|
||||
}
|
||||
}
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
|
||||
if((blockKey == 0) && (checkItem == getItem(checkItem))){
|
||||
|
||||
if(tileBlock.hits >= 4){
|
||||
tileBlock.hits=0;
|
||||
giveItem(key, world, x, y, z, p);
|
||||
stack.damageItem(1, p);
|
||||
if(tileEnt.getStackInSlot(0).getMaxStackSize() == 1){
|
||||
if(tileEnt.getStackInSlot(0).getItemDamage() == tileEnt.getStackInSlot(0).getMaxDamage()-1){
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
} else {tileEnt.getStackInSlot(0).setItemDamage(tileEnt.getStackInSlot(0).getItemDamage()+1);}
|
||||
}
|
||||
if((tileEnt.getStackInSlot(0).getItem() == getItem3(checkItem))){
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((blockKey == 0) && (checkItem == getItem3(checkItem))){
|
||||
if(tileBlock.hits >= 4){
|
||||
tileBlock.hits=0;
|
||||
giveItem(key, world, x, y, z, p);
|
||||
stack.damageItem(1, p);
|
||||
if(tileEnt.getStackInSlot(0).getMaxStackSize() == 1){
|
||||
if(tileEnt.getStackInSlot(0).getItemDamage() == tileEnt.getStackInSlot(0).getMaxDamage()-1){
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
} else {tileEnt.getStackInSlot(0).setItemDamage(tileEnt.getStackInSlot(0).getItemDamage()+1);}
|
||||
}
|
||||
if((tileEnt.getStackInSlot(0).getItem() == getItem3(checkItem))){
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(blockKey == 3){
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
Main.sNet.sendToAll(new MsgPacketlTicks(x));
|
||||
Main.sNet.sendToAll(new MsgPacketLocY(y));
|
||||
Main.sNet.sendToAll(new MsgPacketLocZ(z));
|
||||
if((checkItem == getItem2(checkItem).getItem())){
|
||||
if(tilePlate.hits >= 3){
|
||||
tilePlate.hits=0;
|
||||
giveItem(key, world, x, y, z, p);
|
||||
stack.damageItem(1, p);
|
||||
if(tileEnt.getStackInSlot(0).getItem() == getItem2(checkItem).getItem()){
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* ItemStack gladius0 = new ItemStack(ModItems.gladius);
|
||||
gladius0.stackTagCompound = new NBTTagCompound();
|
||||
gladius0.stackTagCompound.setInteger("GLADIUSTEXTURE", 0);
|
||||
*/
|
||||
|
||||
public void giveItem(int a, World world, int x, int y, int z, EntityPlayer p){
|
||||
if(blockKey == 0){
|
||||
//Item item = ForgeAnvilCrafting.itemToGive.get(key);
|
||||
//ItemStack stack = ForgeAnvilCrafting.itemToGive.get(key);
|
||||
|
||||
//world.spawnParticle("lava", x, y, z, 0.0F, 0.0F, 0.0F);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, ForgeAnvilCrafting.itemToGive.get(key)));
|
||||
//stack.stackTagCompound = new NBTTagCompound();
|
||||
//stack.stackTagCompound.setInteger("UPGRADES", 0);
|
||||
}
|
||||
if(blockKey == 3){
|
||||
Item item = ForgeAnvilCrafting.itemToCheck.get(key);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, new ItemStack(item, 1, 0)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Item getItem(Item testItem){
|
||||
for(int i = 0; i < ForgeAnvilCrafting.itemToCheck.size(); i++){
|
||||
if(testItem == ForgeAnvilCrafting.itemToCheck.get(i)){
|
||||
key = i;
|
||||
}
|
||||
}
|
||||
return ForgeAnvilCrafting.itemToCheck.get(key);
|
||||
}
|
||||
|
||||
private ItemStack getItem2(Item testItem){
|
||||
for(int i = 0; i < ForgeAnvilCrafting.itemToGive.size(); i++){
|
||||
if(testItem == ForgeAnvilCrafting.itemToGive.get(i).getItem()){
|
||||
key = i;
|
||||
}
|
||||
}
|
||||
return ForgeAnvilCrafting.itemToGive.get(key);
|
||||
}
|
||||
|
||||
private Item getItem3(Item testItem){
|
||||
for(int i = 0; i < ForgeAnvilCrafting.itemToCheckClay.size(); i++){
|
||||
if(testItem == ForgeAnvilCrafting.itemToCheckClay.get(i)){
|
||||
key = i;
|
||||
}
|
||||
}
|
||||
return ForgeAnvilCrafting.itemToCheckClay.get(key);
|
||||
}
|
||||
|
||||
|
||||
private String getTool(ItemStack s){
|
||||
for(int i = 0; i < ForgeAnvilCrafting.toolToRepair.size(); i++){
|
||||
if(s.getDisplayName().equals(ForgeAnvilCrafting.toolToRepair.get(i)) ){
|
||||
keys = i;
|
||||
}
|
||||
}
|
||||
return ForgeAnvilCrafting.toolToRepair.get(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Block anvil = world.getBlock(x, y-1, z);
|
||||
if(!world.isRemote){
|
||||
onClick(block, anvil, world, x, y, z, player, stack, world.rand);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int p_77663_4_, boolean using) {
|
||||
|
||||
if(using == true){
|
||||
((EntityLivingBase) player).addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 10, 4, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability () {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair)
|
||||
{
|
||||
return Items.iron_ingot == repair.getItem() ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,745 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyDiamond;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyEmerald;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
import com.kitsu.medievalcraft.util.InlayTables;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class InlayHammer extends Item {
|
||||
|
||||
private String name = "inlayHammer";
|
||||
//private Item item;
|
||||
//private Block test;
|
||||
private int keyUpgrade, keyCheck, keyCheckOne, hit;
|
||||
public static boolean forgeHammerLeftClick;
|
||||
TileEntityMyDiamond tileDiamond;
|
||||
TileEntityMyEmerald tileEmerald;
|
||||
//TileEntityHotRedstoneIngot tileRedstone;
|
||||
//TileEntityHotLapisIngot tileLapis;
|
||||
//TileEntityHotIronPlate tilePlate;
|
||||
Random rand;
|
||||
|
||||
public InlayHammer() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(500);
|
||||
setNoRepair();
|
||||
|
||||
//item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Block anvil = world.getBlock(x, y-1, z);
|
||||
if(!world.isRemote){
|
||||
onClick(block, anvil, world, x, y, z, player, stack, world.rand);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* ItemStack gladius0 = new ItemStack(ModItems.gladius);
|
||||
gladius0.stackTagCompound = new NBTTagCompound();
|
||||
gladius0.stackTagCompound.setInteger("GLADIUSTEXTURE", 0);*/
|
||||
|
||||
private void onClick(Block block, Block blockSub, World world, int x, int y, int z, EntityPlayer player, ItemStack stack, Random rand){
|
||||
if(block == ModBlocks.myDiamond){
|
||||
tileDiamond = (TileEntityMyDiamond) world.getTileEntity(x, y, z);
|
||||
}
|
||||
if(block == ModBlocks.myEmerald){
|
||||
tileEmerald = (TileEntityMyEmerald) world.getTileEntity(x, y, z);
|
||||
}
|
||||
if(block == ModBlocks.hotRedstoneIngot){
|
||||
tileRedstone = (TileEntityHotRedstoneIngot) world.getTileEntity(x, y, z);
|
||||
}
|
||||
if(block == ModBlocks.hotLapisIngot){
|
||||
tileLapis = (TileEntityHotLapisIngot) world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
if((block == blockToRun(block)) && (blockSub == ModBlocks.forgeAnvil) && (player.isSwingInProgress == false)){
|
||||
TileEntityAnvilForge tileAnvil = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z);
|
||||
//DIAMOND BLOCK
|
||||
if(keyUpgrade == 0){
|
||||
|
||||
if(tileAnvil.getStackInSlot(0) != null){
|
||||
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
ItemStack resetStack = new ItemStack(ModItems.unbreakingWoodRod);
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
//System.out.println("Lvl 1 second upgrade");
|
||||
//System.out.println(keyCheckOne);
|
||||
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
|
||||
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
|
||||
//keyCHeckone is oneUpgrade check
|
||||
if(keyCheckOne == 0){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 1){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits = 0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 2){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 3){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 4){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 5){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits = 0;
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 6){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 7){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 8){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileDiamond.hits++;
|
||||
}
|
||||
if(tileDiamond.hits >= 8){
|
||||
tileDiamond.hits=0;
|
||||
//CHECKS IF ITS A ZERO UPGRADED TOOL HEAD AND RETURNS THE LVL 1 UNBREAKING VARIANT
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
Item reset = InlayTables.oneUpgrade.get(keyCheck);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
|
||||
resetStack.stackTagCompound.setString("ENCHANTTYPE", "unbreaking");
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyUpgrade == 1){
|
||||
if(tileAnvil.getStackInSlot(0) != null){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileEmerald.hits++;
|
||||
}
|
||||
if(tileEmerald.hits >= 8){
|
||||
tileEmerald.hits = 0;
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
Item reset = InlayTables.silkTouch.get(keyCheck);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyUpgrade == 2){
|
||||
if(tileAnvil.getStackInSlot(0) != null){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
|
||||
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
ItemStack resetStack = new ItemStack(ModItems.fortuneWoodRod);
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.ironweaponHandle)){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
ItemStack resetStack = new ItemStack(ModItems.fortuneIronRod);
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
//System.out.println("Lvl 1 second upgrade");
|
||||
//System.out.println(keyCheckOne);
|
||||
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
|
||||
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
|
||||
//keyCHeckone is oneUpgrade check
|
||||
if(keyCheckOne == 0){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 1){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 2){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 3){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 4){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 5){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 6){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 7){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 8){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileLapis.hits++;
|
||||
}
|
||||
if(tileLapis.hits >= 8){
|
||||
tileLapis.hits=0;
|
||||
Item reset = InlayTables.oneUpgrade.get(keyCheck+6);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
|
||||
resetStack.stackTagCompound.setString("ENCHANTTYPE", "fortune");
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
//System.out.println(resetStack.stackTagCompound.getString("ENCHANTTYPE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(keyUpgrade == 3){
|
||||
if(tileAnvil.getStackInSlot(0) != null){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
|
||||
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.ironweaponHandle)){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
ItemStack resetStack = new ItemStack(ModItems.efficIronRod);
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
//System.out.println("Lvl 1 second upgrade");
|
||||
//System.out.println(keyCheckOne);
|
||||
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
|
||||
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
|
||||
//keyCHeckone is oneUpgrade check
|
||||
if(keyCheckOne == 0){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 1){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 2){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 3){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 4){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 5){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
|
||||
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 6){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 7){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyCheckOne == 8){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
|
||||
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
|
||||
if (rand.nextInt(2) == 0 ) {
|
||||
tileRedstone.hits++;
|
||||
}
|
||||
if(tileRedstone.hits >= 8){
|
||||
tileRedstone.hits=0;
|
||||
Item reset = InlayTables.oneUpgrade.get(keyCheck+3);
|
||||
ItemStack resetStack = new ItemStack(reset);
|
||||
resetStack.stackTagCompound = new NBTTagCompound();
|
||||
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
|
||||
resetStack.stackTagCompound.setString("ENCHANTTYPE", "effic");
|
||||
tileAnvil.setInventorySlotContents(0, resetStack);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
stack.damageItem(1, player);
|
||||
//System.out.println(resetStack.stackTagCompound.getString("ENCHANTTYPE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Block blockToRun(Block testBlock){
|
||||
for(int i = 0; i < InlayTables.upgrade.size(); i++){
|
||||
if(testBlock == InlayTables.upgrade.get(i)){
|
||||
keyUpgrade = i;
|
||||
}
|
||||
}
|
||||
return InlayTables.upgrade.get(keyUpgrade);
|
||||
}
|
||||
|
||||
private Item zeroUpgradeCheck(Item testItem){
|
||||
for(int i = 0; i < InlayTables.zeroUpgrade.size(); i++){
|
||||
if(testItem == InlayTables.zeroUpgrade.get(i)){
|
||||
keyCheck = i;
|
||||
}
|
||||
}
|
||||
return InlayTables.zeroUpgrade.get(keyCheck);
|
||||
}
|
||||
|
||||
private Item oneUpgradeCheck(Item testItem){
|
||||
for(int i = 0; i < InlayTables.oneUpgrade.size(); i++){
|
||||
if(testItem == InlayTables.oneUpgrade.get(i)){
|
||||
keyCheckOne = i;
|
||||
}
|
||||
}
|
||||
return InlayTables.oneUpgrade.get(keyCheckOne);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class IronSaw extends Item {
|
||||
private String name = "ironSaw";
|
||||
private Item item;
|
||||
|
||||
public IronSaw() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(512);
|
||||
setNoRepair();
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class LeatherShears extends Item {
|
||||
|
||||
private String name = "leatherShears";
|
||||
private Item item;
|
||||
|
||||
public LeatherShears() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(64);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
//itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleBase;
|
||||
import com.kitsu.medievalcraft.item.TongsDamageTable;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
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.world.World;
|
||||
|
||||
public class SlottedTongs extends Item {
|
||||
|
||||
private String name = "slottedTongs";
|
||||
private Item item;
|
||||
|
||||
public SlottedTongs() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(100);
|
||||
setNoRepair();
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
if(!world.isRemote){
|
||||
if((world.getBlock(x, y, z).getMaterial().isSolid()==true)){
|
||||
if((player.isSneaking())){
|
||||
if(stack.getItemDamage()!=0){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, TongsDamageTable.blockToGet.get(stack.getItemDamage()), 0, 2);
|
||||
TileCrucibleBase tile = (TileCrucibleBase) world.getTileEntity(x, y+1, z);
|
||||
tile.hot=true;
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if((world.getBlock(x, y, z) instanceof CrucibleBase) && (player.isSneaking())){
|
||||
TileCrucibleBase tile = (TileCrucibleBase) world.getTileEntity(x, y, z);
|
||||
Block tempBlock = world.getBlock(x, y, z);
|
||||
if(tile.hot==true){
|
||||
this.setDamage(stack, TongsDamageTable.blockToStore.get(tempBlock));
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(world.isRemote){
|
||||
//System.out.println(stack.getItemDamage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
//import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class WorkBlade extends Item {
|
||||
|
||||
private String name = "workBlade";
|
||||
private Item item;
|
||||
//private int[] locarray = new int[3];
|
||||
//private int hits;
|
||||
//private boolean inUse;
|
||||
Random rand;
|
||||
|
||||
public WorkBlade() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
//setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(500);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
stack.stackTagCompound.setInteger("X", 1);
|
||||
stack.stackTagCompound.setInteger("Y", 1);
|
||||
stack.stackTagCompound.setInteger("Z", 1);
|
||||
stack.stackTagCompound.setInteger("BARKHITS", 0);
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
|
||||
if(!world.isRemote){
|
||||
getBark(world, x, y, z, player, stack);
|
||||
makeLonbow(world, x, y, z, player, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void getBark(World world, int x, int y, int z, EntityPlayer player, ItemStack stack){
|
||||
//if(player.isSwingInProgress == false){
|
||||
if(world.getBlock(x, y, z).getUnlocalizedName().equals("tile.log")){
|
||||
//System.out.println(stack.stackTagCompound.getInteger("BARKHITS"));
|
||||
//System.out.println(stack.stackTagCompound.getInteger("X"));
|
||||
//System.out.println(stack.stackTagCompound.getInteger("Y"));
|
||||
//System.out.println(stack.stackTagCompound.getInteger("Z"));
|
||||
//System.out.println(world.getBlockMetadata(x, y, z));
|
||||
|
||||
if((stack.stackTagCompound.getInteger("BARKHITS") == 0) || (stack.stackTagCompound.getInteger("X") != x) || (stack.stackTagCompound.getInteger("Y") != y) || (stack.stackTagCompound.getInteger("Z") != z)){
|
||||
stack.stackTagCompound.setInteger("X", x);
|
||||
stack.stackTagCompound.setInteger("Y", y);
|
||||
stack.stackTagCompound.setInteger("Z", z);
|
||||
stack.stackTagCompound.setInteger("BARKHITS", 1);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.33F, 1.0F);
|
||||
//System.out.println("lvl2");
|
||||
}
|
||||
if(stack.stackTagCompound.getInteger("BARKHITS") > 0){
|
||||
if((stack.stackTagCompound.getInteger("X") == x) && (stack.stackTagCompound.getInteger("Y") == y) && (stack.stackTagCompound.getInteger("Z") == z)){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.33F, 1.0F);
|
||||
if (world.rand.nextInt(2) == 0 ) {
|
||||
stack.stackTagCompound.setInteger("BARKHITS", stack.stackTagCompound.getInteger("BARKHITS") + 1);
|
||||
stack.stackTagCompound.setInteger("X", x);
|
||||
stack.stackTagCompound.setInteger("Y", y);
|
||||
stack.stackTagCompound.setInteger("Z", z);
|
||||
stack.damageItem(1, player);
|
||||
//System.out.println("lvl3");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(stack.stackTagCompound.getInteger("BARKHITS") >= 6 + world.rand.nextInt(4)){
|
||||
stack.stackTagCompound.setInteger("BARKHITS", 0);
|
||||
stack.stackTagCompound.setInteger("X", 0);
|
||||
stack.stackTagCompound.setInteger("Y", 0);
|
||||
stack.stackTagCompound.setInteger("Z", 0);
|
||||
//System.out.println("lvl4");
|
||||
|
||||
if(world.getBlock(x, y, z).equals(Blocks.log)){
|
||||
//System.out.println("lvl5");
|
||||
int woodMeta = world.getBlockMetadata(x, y, z);
|
||||
if(woodMeta == 0){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanOak, 0, 2);
|
||||
}
|
||||
if(woodMeta == 4){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanOak, 4, 2);
|
||||
}
|
||||
if(woodMeta == 8){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanOak, 8, 2);
|
||||
}
|
||||
if(woodMeta == 1){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanSpruce, 0, 2);
|
||||
}
|
||||
if(woodMeta == 5){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanSpruce, 4, 2);
|
||||
}
|
||||
if(woodMeta == 9){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanSpruce, 8, 2);
|
||||
}
|
||||
if(woodMeta == 2){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanBirch, 0, 2);
|
||||
}
|
||||
if(woodMeta == 6){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanBirch, 4, 2);
|
||||
}
|
||||
if(woodMeta == 10){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanBirch, 8, 2);
|
||||
}
|
||||
if(woodMeta == 3){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanJungle, 0, 2);
|
||||
}
|
||||
if(woodMeta == 7){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanJungle, 4, 2);
|
||||
}
|
||||
if(woodMeta == 11){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanJungle, 8, 2);
|
||||
}
|
||||
}
|
||||
if(world.getBlock(x, y, z).equals(Blocks.log2)){
|
||||
//System.out.println("lvl6");
|
||||
int woodMeta = world.getBlockMetadata(x, y, z);
|
||||
if(woodMeta == 0){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanAcacia, 0, 2);
|
||||
}
|
||||
if(woodMeta == 4){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanAcacia, 4, 2);
|
||||
}
|
||||
if(woodMeta == 8){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanAcacia, 8, 2);
|
||||
}
|
||||
if(woodMeta == 1){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanDarkOak, 0, 2);
|
||||
}
|
||||
if(woodMeta == 5){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanDarkOak, 4, 2);
|
||||
}
|
||||
if(woodMeta == 9){
|
||||
world.setBlock(x, y, z, ModBlocks.cleanDarkOak, 8, 2);
|
||||
}
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.itemBark, 5 + world.rand.nextInt(4), 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void makeLonbow(World world, int x, int y, int z, EntityPlayer player, ItemStack stack){
|
||||
if(!world.isRemote){
|
||||
if((world.getBlock(x, y, z).equals(ModBlocks.jungleSplitLog))&&world.getBlock(x, y-1, z).equals(ModBlocks.jungleSplitLog)){
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":scrapes1", 0.25F, 1.8F);
|
||||
player.swingItem();
|
||||
if(world.rand.nextInt(10)==0){
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(x, y-1, z);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.unstrungLongbow, 1, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
if(player.isSwingInProgress == false){
|
||||
if(!world.isRemote){
|
||||
if((world.getBlock(x, y, z).equals(Blocks.log)) && (world.getBlockMetadata(x, y, z)==3)){
|
||||
if((world.getBlock(x, y-1, z).equals(Blocks.log)) && (world.getBlockMetadata(x, y-1, z)==3)){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.air)){
|
||||
|
||||
if((stack.stackTagCompound.getInteger("HITS") == 0) || (stack.stackTagCompound.getInteger("X") != x) || (stack.stackTagCompound.getInteger("Y") != y) || (stack.stackTagCompound.getInteger("Z") != z)){
|
||||
stack.stackTagCompound.setInteger("X", x);
|
||||
stack.stackTagCompound.setInteger("Y", y);
|
||||
stack.stackTagCompound.setInteger("Z", z);
|
||||
stack.stackTagCompound.setInteger("HITS", 1);
|
||||
}
|
||||
if(stack.stackTagCompound.getInteger("HITS") > 0){
|
||||
if((stack.stackTagCompound.getInteger("X") == x) && (stack.stackTagCompound.getInteger("Y") == y) && (stack.stackTagCompound.getInteger("Z") == z)){
|
||||
if (world.rand.nextInt(2) == 0 ) {
|
||||
stack.stackTagCompound.setInteger("HITS", stack.stackTagCompound.getInteger("HITS") + 1);
|
||||
stack.stackTagCompound.setInteger("X", x);
|
||||
stack.stackTagCompound.setInteger("Y", y);
|
||||
stack.stackTagCompound.setInteger("Z", z);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(stack.stackTagCompound.getInteger("HITS") == 10){
|
||||
stack.stackTagCompound.setInteger("HITS", 0);
|
||||
stack.stackTagCompound.setInteger("X", 0);
|
||||
stack.stackTagCompound.setInteger("Y", 0);
|
||||
stack.stackTagCompound.setInteger("Z", 0);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||
world.setBlock(x, y-1, z, Blocks.air, 0, 2);
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModItems.unstrungLongbow, 1, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability () {
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack item, ItemStack repair)
|
||||
{
|
||||
return Items.iron_ingot == repair.getItem() ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools.filters;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class CoarseFilter extends Item {
|
||||
private String name = "coarseFilter";
|
||||
private Item item;
|
||||
|
||||
public CoarseFilter() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(300);
|
||||
setNoRepair();
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
|
||||
return true;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools.filters;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class FineFilter extends Item {
|
||||
private String name = "fineFilter";
|
||||
private Item item;
|
||||
|
||||
public FineFilter() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(300);
|
||||
setNoRepair();
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools.filters;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class MediumFilter extends Item {
|
||||
private String name = "mediumFilter";
|
||||
private Item item;
|
||||
|
||||
public MediumFilter() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(300);
|
||||
setNoRepair();
|
||||
item = this;
|
||||
GameRegistry.registerItem(this, name);
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.kitsu.medievalcraft.item.forms.iron;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class IronAxeForm extends Item {
|
||||
private String name = "ironAxeForm";
|
||||
private Item item;
|
||||
|
||||
public IronAxeForm() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(64);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
//itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.kitsu.medievalcraft.item.forms.iron;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class IronBattleAxeForm extends Item {
|
||||
private String name = "ironBattleAxeForm";
|
||||
private Item item;
|
||||
|
||||
public IronBattleAxeForm() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(64);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
//itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.kitsu.medievalcraft.item.forms.iron;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class IronDaggerForm extends Item {
|
||||
private String name = "ironDaggerForm";
|
||||
private Item item;
|
||||
|
||||
public IronDaggerForm() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(64);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
//itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user