diff options
Diffstat (limited to 'src/main/java/lance5057/tDefense/baubles/tools')
3 files changed, 299 insertions, 0 deletions
diff --git a/src/main/java/lance5057/tDefense/baubles/tools/BaubleTool.java b/src/main/java/lance5057/tDefense/baubles/tools/BaubleTool.java new file mode 100644 index 0000000..b393100 --- /dev/null +++ b/src/main/java/lance5057/tDefense/baubles/tools/BaubleTool.java @@ -0,0 +1,152 @@ +package lance5057.tDefense.baubles.tools; + +import java.util.List; + +import javax.annotation.Nullable; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import baubles.api.render.IRenderBauble; +import lance5057.tDefense.core.materials.ShieldMaterialStats; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.EnumAction; +import net.minecraft.item.IItemPropertyGetter; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ActionResult; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.Optional; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import slimeknights.tconstruct.library.client.model.ToolModelLoader; +import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.tools.ToolCore; +import slimeknights.tconstruct.library.tools.ToolNBT; +import slimeknights.tconstruct.tools.TinkerTools; + +//@Optional.InterfaceList({@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.ISheathed"), @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IArrowCatcher"), @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IArrowDisplay"), @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IShield")}) +public abstract class BaubleTool extends ToolCore implements IBauble, IRenderBauble +{ + //protected static PartMaterialType ShieldMat = new PartMaterialType(TinkerTools.largePlate, ShieldMaterialStats.TYPE); + + public BaubleTool(PartMaterialType... requiredComponents) + { + super(requiredComponents); + +// this.addPropertyOverride(new ResourceLocation("block"), new IItemPropertyGetter() +// { +// @SideOnly(Side.CLIENT) +// public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) +// { +// float i = entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F; +// return i; +// } +// }); + } + + protected float baseSpeed() + { + return 1.5f; + } + + protected float effectiveSpeed() + { + return 15f; + } + + public float breakSpeedModifier() + { + return 1.0f; + } + +// @Override +// public float getDigSpeed(ItemStack stack, Block block, int meta) +// { +// return 0.0f; +// } + + /** + * returns the action that specifies what animation to play when the items + * is being used + */ +// @Override +// public EnumAction getItemUseAction(ItemStack par1ItemStack) +// { +// return EnumAction.BLOCK; +// } + +// public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) +// { +// playerIn.setActiveHand(hand); +// return new ActionResult(EnumActionResult.SUCCESS, itemStackIn); +// } +// +// public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) +// { +// return super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ); +// } + + /** + * How long it takes to use or consume an item + */ + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + @Override + @SideOnly(Side.CLIENT) + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) + { +// super.onUpdate(stack, world, entity, par4, par5); +// if(entity instanceof EntityPlayerSP) +// { +// final EntityPlayerSP player = (EntityPlayerSP) entity; +// final ItemStack usingItem = player.getActiveItemStack(); +// if(usingItem != null && usingItem.getItem() == this) +// { +// player.movementInput.moveForward *= 2.5F; +// player.movementInput.moveStrafe *= 2.5F; +// } +// } + } + + protected String getHarvestType() + { + return null; + } + + @Override + public float damagePotential() { + // TODO Auto-generated method stub + return 0.1f; + } + + @Override + public double attackSpeed() { + // TODO Auto-generated method stub + return 4; + } + + @Override + public NBTTagCompound buildTag( + List<slimeknights.tconstruct.library.materials.Material> materials) { + ToolNBT data = buildDefaultTag(materials); + return data.get(); + } +} diff --git a/src/main/java/lance5057/tDefense/baubles/tools/Sheathe.java b/src/main/java/lance5057/tDefense/baubles/tools/Sheathe.java new file mode 100644 index 0000000..f9c62cc --- /dev/null +++ b/src/main/java/lance5057/tDefense/baubles/tools/Sheathe.java @@ -0,0 +1,48 @@ +package lance5057.tDefense.baubles.tools; + +import baubles.api.BaubleType; +import lance5057.tDefense.Reference; +import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.baubles.BaublesBase; +import lance5057.tDefense.proxy.ClientProxy; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.tools.TinkerTools; + +public class Sheathe extends BaubleTool { + private static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/model/sheathe.png"); + + public Sheathe(PartMaterialType... requiredComponents) { + super(PartMaterialType.head(TinkerTools.largePlate), PartMaterialType.handle(TinkerTools.toolRod), + PartMaterialType.extra(TinkerTools.bowString)); + + } + + @Override + public BaubleType getBaubleType(ItemStack itemstack) { + // TODO Auto-generated method stub + return BaubleType.BODY; + } + + @Override + public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) { + // TODO Auto-generated method stub + + if (type == RenderType.BODY) { + float s = 1F / 16F; + GlStateManager.scale(s, s, s); + + GlStateManager.enableLighting(); + GlStateManager.enableRescaleNormal(); + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + + ClientProxy.baubles.sheathe.render(1f, player.inventory.getStackInSlot(0), player.inventory.getStackInSlot(1), player.getHeldItemMainhand(), player.getHeldItemOffhand()); + } + } + +} diff --git a/src/main/java/lance5057/tDefense/baubles/tools/TDBaubles.java b/src/main/java/lance5057/tDefense/baubles/tools/TDBaubles.java new file mode 100644 index 0000000..f06a217 --- /dev/null +++ b/src/main/java/lance5057/tDefense/baubles/tools/TDBaubles.java @@ -0,0 +1,99 @@ +package lance5057.tDefense.baubles.tools; + +import com.google.common.eventbus.Subscribe; + +import lance5057.tDefense.core.tools.HeaterShield; +import lance5057.tDefense.core.tools.RoundShield; +import lance5057.tDefense.core.tools.TDToolEvents; +import lance5057.tDefense.core.tools.Zweihander; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; +import slimeknights.tconstruct.library.TinkerRegistry; +import slimeknights.tconstruct.library.tools.ToolCore; + +public class TDBaubles +{ + + TDToolEvents events = new TDToolEvents(); + + // Tools + public static ToolCore sheathe = new Sheathe(); + + // Tool Parts + + // Modifiers + + // Helper stuff +// static List<ToolCore> tools = Lists.newLinkedList(); // contains all tools registered in this pulse +// static List<ToolPart> toolparts = Lists.newLinkedList(); // ^ all toolparts +// static List<IModifier> modifiers = Lists.newLinkedList(); // ^ all modifiers + + // PRE-INITIALIZATION + @Subscribe + public void preInit(FMLPreInitializationEvent event) { + // register items + MinecraftForge.EVENT_BUS.register(events); + + regToolParts(); + regTools(); + registerModifiers(); + + // register blocks + + // register entities + + //proxy.preInit(); + } + + private void regToolParts() { + // The order the items are registered in represents the order in the stencil table GUI too + + } + + private void regTools() { + + regTool(sheathe, "sheathe"); + + TinkerRegistry.registerToolStationCrafting(sheathe); + } + + private void regTool(ToolCore tool, String name) + { + tool.setRegistryName(new ResourceLocation("tinkersdefense:" + name)); + TinkerRegistry.registerTool(tool); + GameRegistry.register(tool); + } + + private void registerModifiers() { + + } + + // INITIALIZATION + @Subscribe + public void init(FMLInitializationEvent event) { + regToolBuilding(); + regRecipies(); + + //proxy.init(); + } + + private void regToolBuilding() { + TinkerRegistry.registerToolCrafting(sheathe); + } + + private void regRecipies() { + + } + + // POST-INITIALIZATION + @Subscribe + public void postInit(FMLPostInitializationEvent event) { + //proxy.postInit(); + } + + +}
\ No newline at end of file |
