-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
207 additions
and
15 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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/thaumicboots/api/serverfiles/PacketOmniToggle.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,35 @@ | ||
package thaumicboots.api.serverfiles; | ||
|
||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import cpw.mods.fml.common.network.simpleimpl.IMessage; | ||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; | ||
import cpw.mods.fml.common.network.simpleimpl.MessageContext; | ||
import io.netty.buffer.ByteBuf; | ||
import thaumicboots.api.ItemBoots; | ||
|
||
public class PacketOmniToggle implements IMessage, IMessageHandler<PacketOmniToggle, IMessage> { | ||
|
||
public void fromBytes(ByteBuf byteBuf) { | ||
// not needed | ||
} | ||
|
||
public void toBytes(ByteBuf byteBuf) { | ||
// not needed | ||
} | ||
|
||
@Override | ||
public IMessage onMessage(PacketOmniToggle message, MessageContext ctx) { | ||
EntityPlayerMP player = ctx.getServerHandler().playerEntity; | ||
final ItemStack boots = ItemBoots.getBoots(player); | ||
if (boots != null) { | ||
boolean omniState = ItemBoots.changeOmniState(ItemBoots.isOmniEnabled(boots)); | ||
ItemBoots.setModeOmni(boots, omniState); | ||
PacketOmniToggleAck ackMessage = new PacketOmniToggleAck(); | ||
ackMessage.state = omniState; | ||
PacketHandler.INSTANCE.sendTo(ackMessage, player); | ||
} | ||
return null; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/thaumicboots/api/serverfiles/PacketOmniToggleAck.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,42 @@ | ||
package thaumicboots.api.serverfiles; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import cpw.mods.fml.common.network.simpleimpl.IMessage; | ||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; | ||
import cpw.mods.fml.common.network.simpleimpl.MessageContext; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import io.netty.buffer.ByteBuf; | ||
import thaumicboots.api.ItemBoots; | ||
import thaumicboots.main.utils.compat.GTNHLibHelper; | ||
|
||
public class PacketOmniToggleAck implements IMessage, IMessageHandler<PacketOmniToggleAck, IMessage> { | ||
|
||
public boolean state; | ||
|
||
@Override | ||
public void fromBytes(ByteBuf byteBuf) { | ||
state = byteBuf.readBoolean(); | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf byteBuf) { | ||
byteBuf.writeBoolean(state); | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
public IMessage onMessage(PacketOmniToggleAck message, MessageContext ctx) { | ||
Minecraft mc = Minecraft.getMinecraft(); | ||
final ItemStack boots = ItemBoots.getBoots(mc.thePlayer); | ||
if (boots != null) { | ||
ItemBoots.setModeOmni(boots, message.state); | ||
if (GTNHLibHelper.isActive()) { | ||
ItemBoots.renderHUDOmniNotification(); | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/thaumicboots/item/boots/unique/ItemSlowBoots.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,23 @@ | ||
package thaumicboots.item.boots.unique; | ||
|
||
import thaumicboots.api.ItemBoots; | ||
import thaumicboots.main.utils.TabThaumicBoots; | ||
|
||
public class ItemSlowBoots extends ItemBoots { | ||
|
||
public ItemSlowBoots(ArmorMaterial par2EnumArmorMaterial, int par3, int par4) { | ||
super(par2EnumArmorMaterial, par3, par4); | ||
setCreativeTab(TabThaumicBoots.tabThaumicBoots); | ||
setUnlocalizedName(unlocalisedName); | ||
} | ||
|
||
protected void setBootsData() { | ||
super.setBootsData(); | ||
tier = 2; | ||
runBonus = -0.035F; | ||
negateFall = true; | ||
unlocalisedName = "ItemSlowBoots"; | ||
iconResPath = "thaumicboots:bootsSlow_16x"; | ||
armorResPath = "thaumicboots:model/slowboots.png"; | ||
} | ||
} |
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
Oops, something went wrong.