-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
103 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package furgl.autoPickup; | ||
|
||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
public class IgnoreKey | ||
{ | ||
public static boolean isPressed; | ||
|
||
public IgnoreKey() | ||
{ | ||
|
||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@SubscribeEvent | ||
public void playerTick(PlayerTickEvent event) | ||
{ | ||
if (event.side == Side.CLIENT && event.phase == Phase.START) | ||
{ | ||
if ((AutoPickup.ignoreBlacklist.isPressed() || AutoPickup.ignoreBlacklist.isKeyDown()) != isPressed) | ||
{ | ||
isPressed = AutoPickup.ignoreBlacklist.isPressed() || AutoPickup.ignoreBlacklist.isKeyDown(); | ||
AutoPickup.network.sendToServer(new PacketIgnoreKey(isPressed)); | ||
} | ||
} | ||
} | ||
} |
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,53 @@ | ||
package furgl.autoPickup; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import net.minecraft.util.IThreadListener; | ||
import net.minecraft.world.WorldServer; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; | ||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; | ||
|
||
public class PacketIgnoreKey implements IMessage | ||
{ | ||
protected boolean pressed; | ||
|
||
public PacketIgnoreKey() | ||
{ | ||
|
||
} | ||
|
||
public PacketIgnoreKey(boolean pressed) | ||
{ | ||
this.pressed = pressed; | ||
} | ||
|
||
@Override | ||
public void fromBytes(ByteBuf buf) | ||
{ | ||
this.pressed = buf.readBoolean(); | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf buf) | ||
{ | ||
buf.writeBoolean(pressed); | ||
} | ||
|
||
public static class Handler implements IMessageHandler<PacketIgnoreKey, IMessage> | ||
{ | ||
@Override | ||
public IMessage onMessage(final PacketIgnoreKey packet, final MessageContext ctx) | ||
{ | ||
IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; | ||
mainThread.addScheduledTask(new Runnable() | ||
{ | ||
@Override | ||
public void run() | ||
{ | ||
IgnoreKey.isPressed = packet.pressed; | ||
} | ||
}); | ||
return null; | ||
} | ||
} | ||
} |
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