-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reach trait now affects attack range... that was more difficult than it should be Fixed 'empty' melting recipes for Valkyrie Armour
- Loading branch information
Showing
7 changed files
with
132 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/shnupbups/tinkersaether/network/HandlerExtendedAttack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package shnupbups.tinkersaether.network; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; | ||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; | ||
import shnupbups.tinkersaether.traits.Reach; | ||
import slimeknights.tconstruct.library.tools.TinkerToolCore; | ||
import slimeknights.tconstruct.library.utils.ToolHelper; | ||
|
||
public class HandlerExtendedAttack implements IMessageHandler<MessageExtendedAttack,IMessage> { | ||
@Override | ||
public IMessage onMessage(MessageExtendedAttack message, MessageContext ctx) { | ||
EntityPlayerMP player = ctx.getServerHandler().player; | ||
player.getServer().addScheduledTask( new Runnable() { | ||
@Override | ||
public void run() { | ||
Entity entity = player.getEntityWorld().getEntityByID(message.getEntityId()); | ||
ItemStack stack = player.getHeldItemMainhand(); | ||
if(stack.isEmpty() || !(stack.getItem() instanceof TinkerToolCore)) { | ||
return; | ||
} | ||
if(ToolHelper.getTraits(stack).contains(Reach.reach)) { | ||
player.attackTargetEntityWithCurrentItem(entity); | ||
} | ||
} | ||
}); | ||
return null; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/shnupbups/tinkersaether/network/MessageExtendedAttack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package shnupbups.tinkersaether.network; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import net.minecraftforge.fml.common.network.ByteBufUtils; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
|
||
public class MessageExtendedAttack implements IMessage { | ||
|
||
private int entity; | ||
|
||
public MessageExtendedAttack() { | ||
|
||
} | ||
|
||
public MessageExtendedAttack(int entity) { | ||
this.entity=entity; | ||
} | ||
|
||
@Override | ||
public void fromBytes(ByteBuf buf) { | ||
entity = ByteBufUtils.readVarInt(buf, 4); | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf buf) { | ||
ByteBufUtils.writeVarInt(buf, entity, 4); | ||
} | ||
|
||
public int getEntityId() { | ||
return entity; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters