mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64d179543c | ||
|
|
e1d8a847a9 | ||
|
|
38fb7fc71f | ||
|
|
6479b0b635 | ||
|
|
5b388b5cba | ||
|
|
3cc1026704 |
No files matched your search
+17
-13
@@ -1,25 +1,29 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.6-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.9-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-586-GTNH:api')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-652-GTNH:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.4.7:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
|
||||
exclude module: 'Baubles'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.12.6-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.7.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.4:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.13.21-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.2:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.13-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.12.12-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.18:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.7.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.10:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.13.40-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.7:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.3:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.16-GTNH:api') {transitive=false}
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.266:dev") {transitive=false}
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.368:dev") {transitive=false}
|
||||
compileOnly('curse.maven:computercraft-67504:2269339')
|
||||
compileOnly('curse.maven:cofh-core-69162:2388751')
|
||||
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.4.8:dev') {
|
||||
runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.0:dev') {
|
||||
exclude module: 'Baubles'
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,9 @@ public class ThaumicTinkerer {
|
||||
@SidedProxy(clientSide = LibMisc.CLIENT_PROXY, serverSide = LibMisc.COMMON_PROXY)
|
||||
public static TTCommonProxy proxy;
|
||||
|
||||
public static boolean isBootsActive = false;
|
||||
public static final String BOOTS = "thaumicboots";
|
||||
|
||||
public static CommonProxy tcProxy;
|
||||
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
|
||||
|
||||
@@ -74,6 +77,9 @@ public class ThaumicTinkerer {
|
||||
"register",
|
||||
"thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
|
||||
}
|
||||
if (Loader.isModLoaded(BOOTS)) {
|
||||
isBootsActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
|
||||
public ItemBloodSword() {
|
||||
super(EnumHelper.addToolMaterial("TT_BLOOD", 0, 950, 0, 0, ThaumcraftApi.toolMatThaumium.getEnchantability()));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -112,60 +112,6 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == this
|
||||
&& stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
// if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
// for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDamageTaken(LivingAttackEvent event) {
|
||||
if (event.entity == null) return;
|
||||
|
||||
if (event.entity.worldObj.isRemote) return;
|
||||
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle) handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == this) {
|
||||
|
||||
event.setCanceled(true);
|
||||
handleNext = 3;
|
||||
player.attackEntityFrom(DamageSource.magic, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == this) attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
|
||||
@@ -239,4 +185,62 @@ public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkerer
|
||||
new ItemStack(Items.diamond),
|
||||
new ItemStack(Items.ghast_tear));
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == ItemBloodSword.this
|
||||
&& stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
// ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
// AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
// if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
// for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDamageTaken(LivingAttackEvent event) {
|
||||
if (event.entity == null) return;
|
||||
|
||||
if (event.entity.worldObj.isRemote) return;
|
||||
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle) handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this) {
|
||||
|
||||
event.setCanceled(true);
|
||||
handleNext = 3;
|
||||
player.attackEntityFrom(DamageSource.magic, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == ItemBloodSword.this)
|
||||
attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4.
|
||||
* Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [Nov 24, 2013, 7:31:51 PM (GMT)]
|
||||
*/
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.client.core.helper.IconHelper;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.core.helper.EnumMobAspect;
|
||||
import thaumic.tinkerer.common.lib.LibItemNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ITTinkererItem;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererInfusionRecipe;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
import thaumic.tinkerer.common.research.TTResearchItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ItemBloodSword extends ItemSword implements IRepairable, ITTinkererItem {
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
|
||||
return super.getItemUseAction(par1ItemStack);
|
||||
}
|
||||
|
||||
private static final int DAMAGE = 10;
|
||||
|
||||
public ItemBloodSword() {
|
||||
super(EnumHelper.addToolMaterial("TT_BLOOD", 0, 950, 0, 0, ThaumcraftApi.toolMatThaumium.getEnchantability()));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
private IIcon activeIcon;
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
<<<<<<< HEAD
|
||||
if(stack==null)
|
||||
return itemIcon;
|
||||
if(stack.stackTagCompound==null)
|
||||
return itemIcon;
|
||||
return stack.stackTagCompound.getInteger("Activated") == 1 ? activeIcon : itemIcon;
|
||||
=======
|
||||
return (stack.stackTagCompound != null && stack.stackTagCompound.getInteger("Activated") == 1) ? activeIcon : itemIcon;
|
||||
>>>>>>> develop
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
|
||||
activeIcon = IconHelper.forItem(par1IconRegister, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
Multimap multimap = HashMultimap.create();
|
||||
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", DAMAGE, 0));
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 0.25, 1));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
static int handleNext = 0;
|
||||
|
||||
public void addDrops(LivingDropsEvent event, ItemStack dropStack) {
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
if (event.source.damageType.equals("player")) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == this && stack.stackTagCompound != null && stack.stackTagCompound.getInteger("Activated") == 1) {
|
||||
Aspect[] aspects = EnumMobAspect.getAspectsForEntity(event.entity);
|
||||
//ScanResult sr=new ScanResult((byte)2,0,0,event.entity,"");
|
||||
//AspectList as=ScanManager.getScanAspects(sr,event.entity.worldObj);
|
||||
//if(as!=null && as.size()!=0){
|
||||
if (aspects != null) {
|
||||
event.drops.removeAll(event.drops);
|
||||
//for(Aspect a:as.getAspects()){
|
||||
for (Aspect a : aspects) {
|
||||
addDrops(event, ItemMobAspect.getStackFromAspect(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDamageTaken(LivingAttackEvent event) {
|
||||
if (event.entity.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
boolean handle = handleNext == 0;
|
||||
if (!handle)
|
||||
handleNext--;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer && handle) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack itemInUse = player.itemInUse;
|
||||
if (itemInUse != null && itemInUse.getItem() == this) {
|
||||
|
||||
event.setCanceled(true);
|
||||
handleNext = 3;
|
||||
player.attackEntityFrom(DamageSource.magic, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
Entity source = event.source.getSourceOfDamage();
|
||||
if (source != null && source instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) source;
|
||||
ItemStack itemInUse = attacker.getHeldItem();
|
||||
if (itemInUse != null && itemInUse.getItem() == this)
|
||||
attacker.attackEntityFrom(DamageSource.magic, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World,
|
||||
EntityPlayer par3EntityPlayer) {
|
||||
|
||||
ItemStack cache = super.onItemRightClick(stack, par2World, par3EntityPlayer);
|
||||
if (par3EntityPlayer.isSneaking() && !par2World.isRemote) {
|
||||
if (stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
if (stack.stackTagCompound.getInteger("Activated") == 0) {
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.bloodSword.activateEssentiaHarvest"));
|
||||
stack.stackTagCompound.setInteger("Activated", 1);
|
||||
} else {
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.bloodSword.deactivateEssentiaHarvest"));
|
||||
stack.stackTagCompound.setInteger("Activated", 0);
|
||||
}
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemName() {
|
||||
return LibItemNames.BLOOD_SWORD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_BLOOD_SWORD, new AspectList().add(Aspect.HUNGER, 2).add(Aspect.WEAPON, 1).add(Aspect.FLESH, 1).add(Aspect.SOUL, 1), -4, 6, 3, new ItemStack(this)).setParents(LibResearch.KEY_CLEANSING_TALISMAN)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_BLOOD_SWORD), new ResearchPage("1")).setSecondary();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_BLOOD_SWORD, new ItemStack(this), 6, new AspectList().add(Aspect.HUNGER, 20).add(Aspect.DARKNESS, 5).add(Aspect.SOUL, 10).add(Aspect.MAN, 6), new ItemStack(ConfigItems.itemSwordThaumium),
|
||||
new ItemStack(Items.rotten_flesh), new ItemStack(Items.porkchop), new ItemStack(Items.beef), new ItemStack(Items.bone), new ItemStack(Items.diamond), new ItemStack(Items.ghast_tear));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -49,50 +49,6 @@ public class ItemProtoclay extends ItemKamiBase {
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void Interact(PlayerInteractEvent event) {
|
||||
if (event.entityPlayer.inventory.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemProtoclay.class))) {
|
||||
World par2World = event.world;
|
||||
Entity par3Entity = event.entityPlayer;
|
||||
EntityPlayer player = (EntityPlayer) par3Entity;
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool)) return;
|
||||
IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();
|
||||
|
||||
if (tool.getType().equals("sword")) return;
|
||||
|
||||
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
|
||||
String typeToFind = "";
|
||||
|
||||
if (player.isSwingInProgress && pos != null) {
|
||||
Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
if (block != null) {
|
||||
Material mat = block.getMaterial();
|
||||
if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) typeToFind = "pick";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) typeToFind = "shovel";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) typeToFind = "axe";
|
||||
}
|
||||
}
|
||||
|
||||
if (tool.getType().equals(typeToFind) || typeToFind.isEmpty()) return;
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool
|
||||
&& stackInSlot != currentStack) {
|
||||
IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
|
||||
if (toolInSlot.getType().equals(typeToFind)) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
|
||||
player.inventory.setInventorySlotContents(i, currentStack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {}
|
||||
|
||||
@@ -136,7 +92,56 @@ public class ItemProtoclay extends ItemKamiBase {
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
return super.shouldRegister();
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void Interact(PlayerInteractEvent event) {
|
||||
if (event.entityPlayer.inventory
|
||||
.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemProtoclay.class))) {
|
||||
World par2World = event.world;
|
||||
Entity par3Entity = event.entityPlayer;
|
||||
EntityPlayer player = (EntityPlayer) par3Entity;
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool)) return;
|
||||
IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();
|
||||
|
||||
if (tool.getType().equals("sword")) return;
|
||||
|
||||
MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
|
||||
String typeToFind = "";
|
||||
|
||||
if (player.isSwingInProgress && pos != null) {
|
||||
Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
if (block != null) {
|
||||
Material mat = block.getMaterial();
|
||||
if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) typeToFind = "pick";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) typeToFind = "shovel";
|
||||
else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) typeToFind = "axe";
|
||||
}
|
||||
}
|
||||
|
||||
if (tool.getType().equals(typeToFind) || typeToFind.isEmpty()) return;
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool
|
||||
&& stackInSlot != currentStack) {
|
||||
IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
|
||||
if (toolInSlot.getType().equals(typeToFind)) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
|
||||
player.inventory.setInventorySlotContents(i, currentStack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,15 +20,21 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
@@ -41,8 +47,12 @@ import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
import thaumic.tinkerer.common.research.KamiResearchItem;
|
||||
import thaumic.tinkerer.common.research.ResearchHelper;
|
||||
import thaumicboots.api.IBoots;
|
||||
|
||||
public class ItemGemBoots extends ItemIchorclothArmorAdv {
|
||||
@Interface(iface = "thaumicboots.api.IBoots", modid = "thaumicboots")
|
||||
public class ItemGemBoots extends ItemIchorclothArmorAdv implements IBoots {
|
||||
|
||||
public float speedBonus = 0.075F;
|
||||
|
||||
public static List<String> playersWith1Step = new ArrayList<>();
|
||||
|
||||
@@ -63,14 +73,14 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv {
|
||||
|
||||
if (player.worldObj.isRemote) player.stepHeight = player.isSneaking() ? 0.5F : 1F;
|
||||
if ((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
|
||||
player.moveFlying(0F, 1F, player.capabilities.isFlying ? 0.075F : 0.15F);
|
||||
player.moveFlying(0F, speedBonus, player.capabilities.isFlying ? 0.075F : 0.15F);
|
||||
player.jumpMovementFactor = player.isSprinting() ? 0.05F : 0.04F;
|
||||
player.fallDistance = 0F;
|
||||
|
||||
if (ConfigHandler.shouldKamiBootsDoGrass) {
|
||||
int x = (int) player.posX;
|
||||
int y = (int) player.posY - 1;
|
||||
int z = (int) player.posZ;
|
||||
int x = MathHelper.floor_double(player.posX);
|
||||
int y = MathHelper.floor_double(player.posY) - 1;
|
||||
int z = MathHelper.floor_double(player.posZ);
|
||||
if (player.worldObj.getBlock(x, y, z) == Blocks.dirt && player.worldObj.getBlockMetadata(x, y, z) == 0)
|
||||
player.worldObj.setBlock(x, y, z, Blocks.grass, 0, 2);
|
||||
}
|
||||
@@ -120,47 +130,143 @@ public class ItemGemBoots extends ItemIchorclothArmorAdv {
|
||||
new ItemStack(Items.lead));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerJump(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
|
||||
|
||||
if (hasArmor && ThaumicTinkerer.proxy.armorStatus(player) && player.getCurrentArmor(0).getItemDamage() == 0)
|
||||
player.motionY += 0.3;
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (getIntertialState(itemStack) && player.moveForward == 0
|
||||
&& player.moveStrafing == 0
|
||||
&& player.capabilities.isFlying) {
|
||||
player.motionX *= 0.5;
|
||||
player.motionZ *= 0.5;
|
||||
}
|
||||
}
|
||||
boolean omniMode = false;
|
||||
if (ThaumicTinkerer.isBootsActive) {
|
||||
omniMode = isOmniEnabled(itemStack);
|
||||
if ((player.moveForward == 0F && player.moveStrafing == 0F && omniMode)
|
||||
|| (player.moveForward <= 0F && !omniMode)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (player.moveForward != 0.0F || player.moveStrafing != 0.0F) {
|
||||
if (player.worldObj.isRemote && !player.isSneaking()) {
|
||||
if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId())) {
|
||||
Thaumcraft.instance.entityEventHandler.prevStep.put(player.getEntityId(), player.stepHeight);
|
||||
}
|
||||
player.stepHeight = 1.0F;
|
||||
}
|
||||
float speedMod = (float) getSpeedModifier(itemStack);
|
||||
if (player.onGround || player.isOnLadder() || player.capabilities.isFlying) {
|
||||
float bonus = speedBonus;
|
||||
if (player.isInWater()) {
|
||||
bonus /= 4.0F;
|
||||
}
|
||||
|
||||
// Attempt at fixing a bug with falling on SMP
|
||||
// In theory, this should be redundant
|
||||
@SubscribeEvent
|
||||
public void onFall(LivingFallEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
|
||||
if (hasArmor) {
|
||||
event.distance = 0;
|
||||
if (player.isSneaking()) {
|
||||
bonus /= 2.0F;
|
||||
}
|
||||
bonus *= speedMod;
|
||||
if (ThaumicTinkerer.isBootsActive) {
|
||||
applyOmniState(player, bonus, itemStack);
|
||||
} else if (player.moveForward > 0.0) {
|
||||
player.moveFlying(0.0F, player.moveForward, bonus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
@Optional.Method(modid = "thaumicboots")
|
||||
public void applyOmniState(EntityPlayer player, float bonus, ItemStack itemStack) {
|
||||
if (player.moveForward != 0.0) {
|
||||
player.moveFlying(0.0F, player.moveForward, bonus);
|
||||
}
|
||||
if (player.moveStrafing != 0.0 && getOmniState(itemStack)) {
|
||||
player.moveFlying(player.moveStrafing, 0.0F, bonus);
|
||||
}
|
||||
}
|
||||
|
||||
boolean highStepListed = playersWith1Step.contains(player.getGameProfile().getName());
|
||||
boolean hasHighStep = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
|
||||
// Avoid NSM Exception when ThaumicBoots is not present.
|
||||
public double getSpeedModifier(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getDouble("speed");
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
if (!highStepListed && (hasHighStep && ThaumicTinkerer.proxy.armorStatus(player)
|
||||
&& player.getCurrentArmor(0).getItemDamage() == 0))
|
||||
playersWith1Step.add(player.getGameProfile().getName());
|
||||
public double getJumpModifier(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getDouble("jump");
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
if ((!hasHighStep || !ThaumicTinkerer.proxy.armorStatus(player)
|
||||
|| player.getCurrentArmor(0).getItemDamage() == 1) && highStepListed) {
|
||||
playersWith1Step.remove(player.getGameProfile().getName());
|
||||
player.stepHeight = 0.5F;
|
||||
public boolean getOmniState(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getBoolean("omni");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getIntertialState(ItemStack stack) {
|
||||
if (stack.stackTagCompound != null) {
|
||||
return stack.stackTagCompound.getBoolean("inertiacanceling");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
super.registerEvents();
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerJump(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack boots = player.getCurrentArmor(0);
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null
|
||||
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
|
||||
|
||||
if (hasArmor && ThaumicTinkerer.proxy.armorStatus(player)
|
||||
&& player.getCurrentArmor(0).getItemDamage() == 0)
|
||||
player.motionY += 0.3 * (float) getJumpModifier(boots);;
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt at fixing a bug with falling on SMP
|
||||
// In theory, this should be redundant
|
||||
@SubscribeEvent
|
||||
public void onFall(LivingFallEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
boolean hasArmor = player.getCurrentArmor(0) != null
|
||||
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
|
||||
if (hasArmor) {
|
||||
event.distance = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer && event.entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
boolean highStepListed = playersWith1Step.contains(player.getGameProfile().getName());
|
||||
boolean hasHighStep = player.getCurrentArmor(0) != null
|
||||
&& player.getCurrentArmor(0).getItem() == ItemGemBoots.this;
|
||||
|
||||
if (!highStepListed && (hasHighStep && ThaumicTinkerer.proxy.armorStatus(player)
|
||||
&& player.getCurrentArmor(0).getItemDamage() == 0))
|
||||
playersWith1Step.add(player.getGameProfile().getName());
|
||||
|
||||
if ((!hasHighStep || !ThaumicTinkerer.proxy.armorStatus(player)
|
||||
|| player.getCurrentArmor(0).getItemDamage() == 1) && highStepListed) {
|
||||
playersWith1Step.remove(player.getGameProfile().getName());
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -128,27 +129,36 @@ public class ItemGemChest extends ItemIchorclothArmorAdv {
|
||||
new ItemStack(Items.arrow));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
super.registerEvents();
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == this) tickPlayer(player);
|
||||
public class EventHandler {
|
||||
|
||||
if (playersWithFlight.contains(playerStr(player))) {
|
||||
if (shouldPlayerHaveFlight(player)) player.capabilities.allowFlying = true;
|
||||
else {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.capabilities.disableDamage = false;
|
||||
@SubscribeEvent
|
||||
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == ItemGemChest.this) tickPlayer(player);
|
||||
|
||||
if (playersWithFlight.contains(playerStr(player))) {
|
||||
if (shouldPlayerHaveFlight(player)) player.capabilities.allowFlying = true;
|
||||
else {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.capabilities.disableDamage = false;
|
||||
}
|
||||
playersWithFlight.remove(playerStr(player));
|
||||
}
|
||||
playersWithFlight.remove(playerStr(player));
|
||||
} else if (shouldPlayerHaveFlight(player)) {
|
||||
playersWithFlight.add(playerStr(player));
|
||||
player.capabilities.allowFlying = true;
|
||||
}
|
||||
} else if (shouldPlayerHaveFlight(player)) {
|
||||
playersWithFlight.add(playerStr(player));
|
||||
player.capabilities.allowFlying = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
public ItemIchorclothArmorAdv(int par2) {
|
||||
super(par2);
|
||||
setHasSubtypes(true);
|
||||
if (ticks()) MinecraftForge.EVENT_BUS.register(this);
|
||||
registerEvents();
|
||||
}
|
||||
|
||||
public ItemIchorclothArmorAdv() {
|
||||
@@ -86,16 +86,6 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
return false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == this) tickPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
void tickPlayer(EntityPlayer player) {
|
||||
// NO-OP
|
||||
}
|
||||
@@ -119,4 +109,21 @@ public abstract class ItemIchorclothArmorAdv extends ItemIchorclothArmor impleme
|
||||
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void registerEvents() {
|
||||
if (ticks()) MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
ItemStack armor = player.getCurrentArmor(3 - armorType);
|
||||
if (armor != null && armor.getItem() == ItemIchorclothArmorAdv.this) tickPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,7 +411,7 @@ ttresearch.lore.FOCUS_HEAL=Pansements etc.
|
||||
ttresearch.page.FOCUS_HEAL.0=You know Pech carry powerful foci that can induce diseases, with that, you devised a way to use them to your benefits.<BR><BR>This focus will slowly mend the caster's wounds as they're using it, using vis from the wand in the process.
|
||||
|
||||
# -- WAND FOCUS: ENDER RIFT
|
||||
ttresearch.name.FOCUS_ENDER_Foci de baguette: Crevasse du Néant
|
||||
ttresearch.name.FOCUS_ENDER_CHEST=Foci de baguette: Crevasse du Néant
|
||||
ttresearch.lore.FOCUS_ENDER_CHEST=Une poche de la quatrième dimension
|
||||
ttresearch.page.FOCUS_ENDER_CHEST.0=By combining a Hand Mirror with a portable hole, you managed to construct a focus that tears a rift in the ender, allowing you to access the contents of your Ender Chest remotely.
|
||||
ttresearch.page.FOCUS_ENDER_CHEST.ES=By combining a Hand Mirror with a portable hole, you managed to construct a focus that tears a rift in the ender, allowing you to access the contents of your Ender Chests remotely. <BR> Shift right click on an ender chest to set the focus to that colour, or shift right click on a block of obsidian to set the focus to the vanilla ender storage.
|
||||
|
||||
Reference in new issue
Block a user